/* ============================================================
   COMPONENTS — preloader, sidebar, topbar, trial banner
   Shared across all app pages (not auth pages)
   ============================================================ */

/* ── Preloader ──────────────────────────────────────────────── */
#preloader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--surface);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  transition: opacity .5s ease, visibility .5s ease;
}
#preloader.hide { opacity: 0; visibility: hidden; }

.pl-wrap {
  position: relative; width: 72px; height: 72px;
  display: flex; align-items: center; justify-content: center;
}
.pl-ring {
  position: absolute; width: 72px; height: 72px; border-radius: 50%;
  border: 3px solid var(--teal-bg); border-top-color: var(--teal);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pl-logo {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--teal-bg); display: flex; align-items: center; justify-content: center;
}
.pl-logo svg { width: 26px; height: 26px; fill: var(--teal); }
.pl-name { font-size: 20px; font-weight: 800; color: var(--teal); letter-spacing: -.3px; }
.pl-dots { display: flex; gap: 5px; }
.pl-dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--teal);
  animation: dot-b 1.3s ease infinite;
}
.pl-dots span:nth-child(2) { animation-delay: .15s; }
.pl-dots span:nth-child(3) { animation-delay: .30s; }
@keyframes dot-b {
  0%,80%,100% { transform: translateY(0); opacity: .35; }
  40%          { transform: translateY(-8px); opacity: 1; }
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: 224px; background: #0f172a; flex-shrink: 0;
  display: flex; flex-direction: column; padding: 20px 0; overflow: hidden;
}

.sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px 20px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sb-logo {
  width: 36px; height: 36px; border-radius: 10px; background: var(--teal);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sb-logo svg { width: 20px; height: 20px; fill: white; }
.sb-name { font-size: 18px; font-weight: 800; color: white; letter-spacing: -.4px; }
.sb-name span { color: var(--teal-light); }

.sb-nav {
  flex: 1; padding: 14px 10px; display: flex; flex-direction: column;
  gap: 2px; overflow-y: auto;
}

.nav-group-label {
  font-size: 10px; font-weight: 700; color: rgba(255,255,255,.28);
  letter-spacing: 1.2px; text-transform: uppercase; padding: 10px 10px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  border-radius: var(--r-sm); cursor: pointer;
  color: rgba(255,255,255,.55); font-size: 13px; font-weight: 500;
  transition: var(--ease); text-decoration: none;
}
.nav-item svg {
  width: 16px; height: 16px; flex-shrink: 0;
  stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.nav-item:hover  { background: rgba(255,255,255,.06); color: rgba(255,255,255,.90); }
.nav-item.active { background: rgba(13,148,136,.20);  color: var(--teal-light); }

/* ── Sidebar footer ─────────────────────────────────────────── */
.sb-footer {
  padding: 14px 10px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column; gap: 7px;
}

.sb-btn {
  width: 100%; padding: 8px; border-radius: var(--r-sm); font-size: 13px;
  font-weight: 600; cursor: pointer; transition: var(--ease);
  text-align: center; display: block; text-decoration: none;
}
.sb-btn-solid   { background: var(--teal); color: white; border: none; }
.sb-btn-solid:hover { background: var(--teal-dark); }
.sb-btn-outline { background: transparent; color: rgba(255,255,255,.60); border: 1px solid rgba(255,255,255,.18); }
.sb-btn-outline:hover { border-color: rgba(255,255,255,.45); color: white; }

/* ── Sidebar: logged-in user block ──────────────────────────── */
.sb-user {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; background: rgba(255,255,255,.06);
  border-radius: var(--r-sm); margin-bottom: 8px;
}
.sb-user-av {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--teal); color: white;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name {
  font-size: 13px; font-weight: 600; color: white;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-user-plan { font-size: 10px; color: var(--teal-light); font-weight: 500; }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0; gap: 16px;
}
.tb-left { display: flex; flex-direction: column; }
.tb-left h1 { font-size: 17px; font-weight: 700; color: var(--ink); }
.tb-left p  { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.tb-right { display: flex; align-items: center; gap: 10px; }

.tb-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: #f0fdf4; border: 1px solid #86efac; color: #16a34a;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
}
.badge-dot {
  width: 6px; height: 6px; background: var(--green); border-radius: 50%;
  animation: blink 1.6s ease infinite;
}
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:.2; } }

/* ── Trial banner ───────────────────────────────────────────── */
.trial-banner {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 9px 24px;
  background: linear-gradient(90deg, var(--teal-dark) 0%, #0891b2 100%);
  color: white;
  font-size: 13px;
  flex-shrink: 0;
}
.trial-banner svg {
  width: 16px; height: 16px;
  stroke: white; fill: none; stroke-width: 2; flex-shrink: 0;
}
.trial-banner strong { font-weight: 700; }
.trial-banner a {
  color: white; font-weight: 700;
  text-decoration: underline; margin-left: auto;
  white-space: nowrap;
}
.banner-close {
  background: none; border: none; color: white; cursor: pointer;
  font-size: 18px; line-height: 1; opacity: .7; padding: 0 2px; flex-shrink: 0;
}
.banner-close:hover { opacity: 1; }

/* ── Mobile sidebar toggle button ───────────────────────────── */
.menu-toggle {
  display: none; width: 36px; height: 36px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; margin-right: 10px;
}
.menu-toggle svg { width: 18px; height: 18px; stroke: var(--ink-soft); fill: none; stroke-width: 2; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 199;
}
.sidebar-overlay.open { display: block; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 200;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle  { display: flex; }
  .trial-banner { padding: 9px 16px; }
}
