/* =============================================================
   TRYTRACK LAYOUT.CSS  — v2
   App shell · Sidebar · Page header · Responsive grid system
   ============================================================= */

/* ── App Shell ─────────────────────────────────────────────── */

.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.main-content {
  flex: 1;
  min-width: 0;
  margin-left: calc(var(--sidebar-w) + 40px);
  padding: var(--page-pad);
  position: relative;
  z-index: 1;
}

/* Subtle ambient light behind content */
.main-content::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 18%, rgba(56,189,248,0.05), transparent 22%),
    radial-gradient(circle at 80% 8%,  rgba(14,165,233,0.07), transparent 22%),
    radial-gradient(circle at 50% 82%, rgba(34,197,94,0.04),  transparent 24%);
}

/* ── Elite Sidebar ─────────────────────────────────────────── */

.elite-sidebar {
  width: var(--sidebar-w);
  position: fixed;
  top: 18px;
  left: 18px;
  bottom: 18px;

  display: flex;
  flex-direction: column;

  border-radius: 28px;
  background: linear-gradient(180deg, rgba(8,15,32,0.96), rgba(3,8,20,0.98));
  border: 1px solid rgba(56,189,248,0.10);

  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);

  box-shadow: 0 28px 72px rgba(0,0,0,0.44), inset 0 1px 0 rgba(255,255,255,0.04);

  overflow: hidden;
  z-index: var(--z-sidebar);
  transition: transform var(--ease-slow);
}

/* ── Sidebar Top / Brand ───────────────────────────────────── */

.sidebar-top {
  padding: 28px 20px 18px;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  justify-content: center;
  align-items: center;
}

.sidebar-logo-image {
  width: 160px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(14,165,233,0.26));
}

/* ── Sidebar Navigation ────────────────────────────────────── */

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 14px 20px;
}

.sidebar-section { margin-bottom: 24px; }

.sidebar-section-title {
  padding: 0 12px;
  margin-bottom: 10px;
  color: rgba(148,163,184,0.65);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  position: relative;
  min-height: 48px;

  display: flex;
  align-items: center;
  gap: 12px;

  padding: 0 14px;
  border-radius: 16px;

  color: rgba(226,232,240,0.78);
  text-decoration: none;
  transition: background var(--ease), color var(--ease), transform var(--ease), box-shadow var(--ease);
}

.sidebar-link:hover {
  background: rgba(56,189,248,0.08);
  color: #fff;
  transform: translateX(3px);
}

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(37,99,235,0.22), rgba(56,189,248,0.12));
  border: 1px solid rgba(56,189,248,0.14);
  color: #fff;
  box-shadow: 0 10px 28px rgba(37,99,235,0.16);
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 16px rgba(56,189,248,0.8);
}

.sidebar-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  font-size: 14px;
  transition: background var(--ease), box-shadow var(--ease);
}

.sidebar-link.active .sidebar-icon {
  background: linear-gradient(135deg, rgba(37,99,235,0.32), rgba(56,189,248,0.20));
  box-shadow: 0 0 18px rgba(56,189,248,0.16);
}

.sidebar-label {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* ── Sidebar Footer / User Card ────────────────────────────── */

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.04);
  flex-shrink: 0;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.03);
}

.sidebar-user-avatar {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 14px;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.sidebar-user-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-user-info strong {
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-info small {
  color: #4ade80;
  font-size: 11px;
  font-weight: 700;
}

.sidebar-logout-btn {
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(239,68,68,0.10);
  border: 1px solid rgba(239,68,68,0.18);
  color: #fca5a5;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}

.sidebar-logout-btn:hover {
  background: rgba(239,68,68,0.20);
  border-color: rgba(239,68,68,0.36);
  color: #fff;
}

/* ── Notification badge ────────────────────────────────────── */

.sidebar-notification-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  box-shadow: 0 0 12px rgba(239,68,68,0.5);
}

.sidebar-notification-badge.hidden { display: none; }

/* ── Mobile toggle + overlay ───────────────────────────────── */

.mobile-menu-btn,
.sidebar-overlay {
  display: none;
}

/* ── Page Header ───────────────────────────────────────────── */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 28px;
  padding: 32px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(15,23,42,0.78), rgba(2,6,23,0.58)),
    radial-gradient(circle at top right, rgba(56,189,248,0.16), transparent 34%);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.page-header-content { min-width: 0; }

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ── Section headers / toolbars ────────────────────────────── */

.section-header,
.filter-toolbar,
.notification-center-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.section-header h2,
.filter-toolbar h2 { margin-bottom: 0; }

.team-filter-select,
.filter-toolbar select { min-width: 200px; }

/* ── Common layout regions ─────────────────────────────────── */

.page-section         { margin-bottom: 26px; }
.page-section:last-child { margin-bottom: 0; }

.two-col   { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.split-col { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 22px; align-items: start; }

/* ── Section eyebrow ───────────────────────────────────────── */

.section-eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* ── Stats grid ────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

/* ── Charts grid ───────────────────────────────────────────── */

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 26px;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════ */

/* ── Tablet landscape / small desktop ─── 1100px ── */
@media (max-width: 1100px) {
  :root { --sidebar-w: 260px; }

  .main-content { margin-left: calc(var(--sidebar-w) + 28px); }

  .two-col,
  .split-col { grid-template-columns: 1fr; }
}

/* ── Tablet ─── 980px ── */
@media (max-width: 980px) {

  /* Show hamburger button */
  .mobile-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed !important;
    top: 18px !important;
    left: 18px !important;
    z-index: var(--z-menu) !important;
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: var(--gradient-primary);
    color: #fff;
    font-size: 22px;
    font-weight: 900;
    box-shadow: 0 12px 30px rgba(0,0,0,0.38);
    border: none;
    cursor: pointer;
    transition: transform var(--ease), box-shadow var(--ease);
  }

  .mobile-menu-btn:hover { transform: scale(1.05); }
  .mobile-menu-btn:active { transform: scale(0.97); }

  /* Slide sidebar off-screen by default */
  .elite-sidebar {
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    height: 100dvh !important;
    border-radius: 0 24px 24px 0;
    transform: translateX(-100%);
    transition: transform var(--ease-slow);
    z-index: var(--z-menu) !important;
  }

  .elite-sidebar.sidebar-open { transform: translateX(0); }

  /* Overlay */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: var(--z-overlay);
    background: rgba(0,0,0,0.54);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--ease), visibility var(--ease);
  }

  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  /* Full-width main with top padding for the hamburger */
  .main-content {
    margin-left: 0 !important;
    padding: 80px var(--page-pad) var(--page-pad) !important;
  }
}

/* ── Mobile ─── 700px ── */
@media (max-width: 700px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
    padding: 22px;
    border-radius: var(--r-lg);
  }

  .page-actions {
    justify-content: stretch;
    flex-direction: column;
  }

  .page-actions > * { width: 100%; }

  .section-header,
  .filter-toolbar,
  .notification-center-header {
    flex-direction: column;
    align-items: stretch;
  }

  .team-filter-select,
  .filter-toolbar select,
  .notification-center-header .btn-secondary { width: 100%; }

  .three-col { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
}

/* ── Small mobile ─── 480px ── */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
