@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@400;500;600;700&subset=cyrillic,latin,latin-ext&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #10051f;
  --card: rgba(255,255,255,.04);
  --card-solid: #170a33;
  --card2: #1d1240;
  --border: rgba(255,255,255,.09);
  --text: #f3eefc;
  --muted: #a89bc9;
  --cyan: #2ed2ff;
  --violet: #9b58ff;
  --magenta: #ff4fc3;
  --gold: #ffc96b;
  --success: #2ed88f;
  --danger: #ff5470;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --font: 'Comfortaa', 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(255,79,195,.16), transparent 42%),
    radial-gradient(circle at 88% 14%, rgba(46,210,255,.13), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(155,88,255,.16), transparent 48%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100svh;
  line-height: 1.5;
  font-size: 15px;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ---------------- Topbar ---------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0;
}
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo img { width: 34px; height: 34px; object-fit: contain; }
.logo span { font-size: 19px; font-weight: 700; letter-spacing: .01em; }
.logo .accent {
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px; font-family: var(--font);
  font-size: 14px; font-weight: 700; cursor: pointer; border: 1px solid transparent;
  transition: filter .15s, transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--violet)); color: #050318;
  box-shadow: 0 0 26px rgba(46,210,255,.28);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 0 32px rgba(46,210,255,.4); }
.btn-ghost { background: rgba(255,255,255,.05); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-danger { background: rgba(255,84,112,.14); color: var(--danger); border-color: rgba(255,84,112,.32); }
.btn-danger:hover { background: rgba(255,84,112,.22); }
.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

.admin-link {
  font-size: 12px; color: var(--muted); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 999px; transition: all .15s;
}
.admin-link:hover { color: var(--cyan); border-color: rgba(46,210,255,.4); }

/* ---------------- Glass card base ---------------- */
.glass {
  background: linear-gradient(155deg, rgba(255,255,255,.05), rgba(255,255,255,.012)), var(--card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(3,0,20,.45);
  backdrop-filter: blur(18px);
}

/* ---------------- Auth pages (viewer + admin login) ---------------- */
.auth-shell {
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 420px;
  padding: 40px;
}
.auth-logo { text-align: center; margin-bottom: 26px; }
.auth-logo img { width: 46px; height: 46px; margin: 0 auto 14px; }
.auth-logo h1 { font-size: 21px; font-weight: 700; }
.auth-logo p { font-size: 13px; color: var(--muted); margin-top: 6px; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600; color: var(--muted);
  margin-bottom: 7px; text-transform: uppercase; letter-spacing: .04em;
}
.form-control {
  width: 100%; padding: 12px 14px; background: rgba(0,0,0,.22);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; font-family: var(--font); outline: none;
  transition: border-color .15s;
}
.form-control:focus { border-color: var(--cyan); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.error-msg {
  background: rgba(255,84,112,.12); border: 1px solid rgba(255,84,112,.34);
  color: var(--danger); border-radius: var(--radius-sm); padding: 11px 14px;
  font-size: 13px; margin-bottom: 16px;
}
.success-msg {
  background: rgba(46,216,143,.12); border: 1px solid rgba(46,216,143,.34);
  color: var(--success); border-radius: var(--radius-sm); padding: 11px 14px;
  font-size: 13px; margin-bottom: 16px;
}

/* ---------------- Hero (showcase page) ---------------- */
.hero { text-align: center; padding: 56px 0 44px; }
.hero h1 {
  font-size: clamp(30px, 4.2vw, 46px); font-weight: 700; line-height: 1.15;
  margin-bottom: 16px;
}
.hero p { font-size: 16px; color: var(--muted); max-width: 560px; margin: 0 auto; }

/* ---------------- Demo grid ---------------- */
.demo-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 26px; padding-bottom: 80px;
}
.demo-card {
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .2s, box-shadow .2s;
}
.demo-card:hover { transform: translateY(-4px); box-shadow: 0 30px 70px rgba(3,0,20,.55); }
.demo-thumb {
  width: 100%; height: auto; display: block;
  border-bottom: 1px solid var(--border);
}
.demo-thumb-placeholder {
  aspect-ratio: 16/10; width: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(46,210,255,.12), rgba(155,88,255,.12));
  border-bottom: 1px solid var(--border);
  color: var(--muted); font-size: 13px; font-weight: 600;
}
.demo-body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.demo-category {
  align-self: flex-start;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--cyan); background: rgba(46,210,255,.12); border: 1px solid rgba(46,210,255,.28);
  padding: 4px 10px; border-radius: 20px;
}
.demo-name { font-size: 19px; font-weight: 700; }
.demo-tagline { font-size: 13px; color: var(--muted); line-height: 1.55; flex: 1; }
.demo-actions { display: flex; gap: 10px; margin-top: 6px; }
.demo-actions .btn { flex: 1; }
.demo-creds {
  margin-top: 4px; font-size: 12px; color: var(--muted);
  background: rgba(0,0,0,.2); border: 1px solid var(--border);
  border-radius: var(--radius-xs); padding: 9px 12px; display: flex; flex-direction: column; gap: 4px;
}
.demo-creds b { color: var(--text); font-weight: 600; }
.demo-creds code {
  background: rgba(255,255,255,.06); padding: 1px 7px; border-radius: 4px;
  font-family: monospace; color: var(--gold);
}

.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 70px 20px; color: var(--muted);
}
.empty-state .icon { font-size: 44px; margin-bottom: 14px; }

.site-footer {
  text-align: center; padding: 28px 0 40px; font-size: 12px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}

/* ================================================================
   ADMIN PANEL
   ================================================================ */
.admin-layout { display: flex; min-height: 100vh; min-height: 100svh; }
.admin-sidebar {
  width: 232px; flex: none;
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.01)), var(--card-solid);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 100;
  backdrop-filter: blur(18px);
}
.admin-main { margin-left: 232px; flex: 1; display: flex; flex-direction: column; }
.admin-sidebar-logo {
  padding: 20px 18px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.admin-sidebar-logo img { width: 28px; height: 28px; }
.admin-sidebar-logo .name {
  font-size: 15px; font-weight: 700;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.admin-sidebar-logo .sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.admin-nav { padding: 14px 10px; flex: 1; }
.admin-nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius-xs); color: var(--muted); font-size: 13px; font-weight: 600;
  margin-bottom: 3px; transition: all .15s;
}
.admin-nav a:hover, .admin-nav a.active { background: rgba(46,210,255,.12); color: var(--cyan); }
.admin-sidebar-footer { padding: 14px 16px; border-top: 1px solid var(--border); }
.admin-topbar {
  height: 62px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; border-bottom: 1px solid var(--border);
  background: rgba(20,10,46,.6); backdrop-filter: blur(18px);
  position: sticky; top: 0; z-index: 50;
}
.admin-topbar-title { font-size: 16px; font-weight: 700; }
.admin-content { padding: 28px; flex: 1; }

.admin-card { padding: 22px; margin-bottom: 20px; }
.admin-card-title { font-size: 15px; font-weight: 700; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.thumb-sm {
  width: 64px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
}
.status-dot {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
}
.status-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; }
.status-dot.on { color: var(--success); } .status-dot.on::before { background: var(--success); }
.status-dot.off { color: var(--muted); } .status-dot.off::before { background: var(--muted); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.thumb-preview {
  width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: var(--radius-sm);
  border: 1px solid var(--border); margin-top: 10px; background: rgba(255,255,255,.03);
}
.file-drop {
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm); padding: 20px;
  text-align: center; font-size: 12px; color: var(--muted); cursor: pointer;
  transition: border-color .15s; position: relative;
}
.file-drop:hover { border-color: var(--cyan); color: var(--cyan); }
.file-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.toast {
  position: fixed; bottom: 24px; right: 24px; padding: 13px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 600; z-index: 9999; box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.toast-ok { background: #12291f; color: var(--success); border: 1px solid rgba(46,216,143,.4); }
.toast-err { background: #2c1420; color: var(--danger); border: 1px solid rgba(255,84,112,.4); }

@media (max-width: 900px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform .2s; }
  .admin-sidebar.open { transform: none; }
  .admin-main { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
}

/* ---------------- Admin: language tab widget ---------------- */
.lang-form-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.lang-form-tab-btn {
  display: flex; align-items: center; gap: 6px; padding: 7px 12px;
  border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,.04);
  color: var(--muted); font-family: var(--font); font-size: 12px; font-weight: 600;
  cursor: pointer; position: relative;
}
.lang-form-tab-btn img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }
.lang-form-tab-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.lang-form-tab-btn.active { background: rgba(46,210,255,.14); border-color: rgba(46,210,255,.4); color: var(--cyan); }
.lang-tab-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); display: inline-block; }
.lang-form-pane textarea { resize: vertical; }
@media (max-width: 560px) {
  .demo-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 22px; }
}

/* ---------------- Language switcher ---------------- */
.lang-switcher { position: relative; }
.lang-switcher-btn {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,.05);
  color: var(--text); font-family: var(--font); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.lang-switcher-btn:hover { border-color: var(--cyan); }
.lang-flag { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; flex: none; }
.lang-switcher-menu {
  position: absolute; top: calc(100% + 10px); right: 0; min-width: 190px;
  background: linear-gradient(155deg, rgba(255,255,255,.05), rgba(255,255,255,.012)), var(--card-solid);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px;
  box-shadow: 0 24px 60px rgba(3,0,20,.55); backdrop-filter: blur(18px);
  z-index: 300; display: none; flex-direction: column; gap: 2px;
}
.lang-switcher-menu.open { display: flex; }
.lang-switcher-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border-radius: var(--radius-xs); color: var(--muted); font-size: 13px; font-weight: 500;
}
.lang-switcher-item:hover { background: rgba(46,210,255,.13); color: var(--cyan); }
.lang-switcher-item.active { background: rgba(46,210,255,.13); color: var(--cyan); font-weight: 700; }
[dir="rtl"] .lang-switcher-menu { right: auto; left: 0; }
[dir="rtl"] .demo-actions { flex-direction: row-reverse; }
[dir="rtl"] .topbar { flex-direction: row-reverse; }
[dir="rtl"] .logo { flex-direction: row-reverse; }
[dir="rtl"] .topbar-actions { flex-direction: row-reverse; }

/* ---------------- Demo detail page ---------------- */
.detail-hero { text-align: center; padding: 40px 0 12px; }
.detail-hero img.detail-thumb {
  width: 100%; max-width: 720px; height: auto; display: block;
  border-radius: var(--radius); border: 1px solid var(--border); margin: 22px auto 0;
  box-shadow: 0 24px 60px rgba(3,0,20,.5);
}
.back-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted);
  margin-bottom: 18px;
}
.back-link:hover { color: var(--cyan); }
.detail-boxes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  padding: 30px 0 70px; max-width: 900px; margin: 0 auto;
}
.detail-box { padding: 30px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.detail-box > *:last-child { margin-top: auto; }
.detail-box .icon {
  width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 26px; background: linear-gradient(135deg, rgba(46,210,255,.16), rgba(155,88,255,.16));
  border: 1px solid var(--border);
}
.detail-box h2 { font-size: 18px; font-weight: 700; }
.detail-box p { font-size: 13px; color: var(--muted); line-height: 1.6; }
.detail-creds {
  width: 100%; background: rgba(0,0,0,.22); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px;
  display: flex; flex-direction: column; gap: 8px; text-align: left;
}
[dir="rtl"] .detail-creds { text-align: right; }
.detail-creds .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.detail-creds .row span:first-child { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.detail-creds code {
  background: rgba(255,255,255,.07); padding: 3px 9px; border-radius: 5px;
  font-family: monospace; color: var(--gold); font-size: 13px;
}
.copy-btn {
  background: none; border: 1px solid var(--border); border-radius: 5px; padding: 3px 9px;
  font-size: 11px; color: var(--muted); cursor: pointer; font-family: var(--font);
}
.copy-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.no-admin-note { font-size: 12px; color: var(--muted); font-style: italic; }

@media (max-width: 700px) {
  .detail-boxes { grid-template-columns: 1fr; }
}
