/* ═══════════════════════════════════════════════════
   Netflix Content Analytics — styles.css
   Author: Data Analytics Portfolio Project
   Description: All visual styles for the dashboard
═══════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────
   1. DESIGN TOKENS (CSS Custom Properties)
───────────────────────────────────────────────── */
:root {
  /* Brand colors */
  --red:          #E50914;
  --red-soft:     #ff2b37;
  --red-dim:      rgba(229, 9, 20, 0.15);
  --red-border:   rgba(229, 9, 20, 0.28);

  /* Background scale */
  --bg:           #080810;
  --bg-1:         #0e0e18;
  --bg-2:         #13131f;
  --bg-3:         #191927;
  --bg-4:         #1f1f30;

  /* Border / divider */
  --line:         rgba(255, 255, 255, 0.065);
  --line-hi:      rgba(255, 255, 255, 0.13);

  /* Text scale */
  --t-1:          #f2f2f5;
  --t-2:          #9999b0;
  --t-3:          #5a5a72;
  --t-4:          #35354a;

  /* Accent palette */
  --teal:         #00d4bc;
  --blue:         #3d9eff;
  --gold:         #f0c040;
  --purple:       #9f6eff;
  --green:        #3ddc84;
  --orange:       #ff8c42;

  /* Layout */
  --sidebar:      240px;
  --r:            10px;
  --r-lg:         14px;

  /* Typography */
  --head:         'Syne', sans-serif;
  --body:         'Inter', sans-serif;
}

/* ─────────────────────────────────────────────────
   2. RESET & BASE
───────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--t-1);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────────────────────────
   3. CUSTOM SCROLLBAR
───────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: var(--bg-1);
}
::-webkit-scrollbar-thumb {
  background: #2a2a40;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--red);
}

/* ─────────────────────────────────────────────────
   4. LOADING SCREEN
───────────────────────────────────────────────── */
#loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 18px;
  transition: opacity 0.5s ease;
}
#loader.out {
  opacity: 0;
  pointer-events: none;
}
.loader-logo {
  font-family: var(--head);
  font-size: 56px;
  font-weight: 800;
  color: var(--red);
  letter-spacing: -1px;
  text-shadow: 0 0 40px rgba(229, 9, 20, 0.4);
}
.loader-sub {
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--t-3);
}
.loader-track {
  width: 200px;
  height: 2px;
  background: var(--bg-4);
  border-radius: 2px;
  overflow: hidden;
}
.loader-bar {
  height: 100%;
  width: 0;
  background: var(--red);
  transition: width 0.15s ease;
  border-radius: 2px;
}
#loader-msg {
  font-size: 12px;
  color: var(--t-3);
  letter-spacing: 0.5px;
}

/* ─────────────────────────────────────────────────
   5. PAGE SHELL LAYOUT
───────────────────────────────────────────────── */
.shell {
  display: flex;
  min-height: 100vh;
}

/* ─────────────────────────────────────────────────
   6. SIDEBAR
───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

/* Brand block */
.sb-brand {
  padding: 22px 18px 16px;
  border-bottom: 1px solid var(--line);
}
.sb-wordmark {
  font-family: var(--head);
  font-size: 26px;
  font-weight: 800;
  color: var(--red);
  letter-spacing: -0.5px;
}
.sb-tagline {
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--t-3);
  margin-top: 3px;
}

/* Navigation */
.sb-nav {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.sb-nav-label {
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--t-4);
  padding: 8px 18px 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--t-2);
  cursor: pointer;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.18s;
  user-select: none;
}
.nav-link:hover {
  color: var(--t-1);
  background: rgba(255, 255, 255, 0.03);
}
.nav-link.on {
  color: var(--red);
  border-left-color: var(--red);
  background: var(--red-dim);
}
.nav-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Sidebar filters panel */
.sb-filters {
  padding: 14px 14px 20px;
  flex: 1;
}
.sf-head {
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--t-4);
  margin-bottom: 12px;
}
.sf-group {
  margin-bottom: 11px;
}
.sf-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--t-3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.sf-select,
.sf-input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--t-1);
  font-family: var(--body);
  font-size: 12px;
  padding: 7px 9px;
  outline: none;
  appearance: none;
  transition: border-color 0.2s;
}
.sf-select:focus,
.sf-input:focus {
  border-color: var(--red);
}
.sf-select option {
  background: var(--bg-3);
}
.sf-yr {
  display: flex;
  gap: 5px;
  align-items: center;
}
.sf-yr span {
  font-size: 10px;
  color: var(--t-3);
  flex-shrink: 0;
}
.sf-yr .sf-input {
  text-align: center;
}

/* Sidebar buttons */
.btn-primary {
  width: 100%;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: var(--body);
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.18s, transform 0.1s;
  letter-spacing: 0.3px;
}
.btn-primary:hover {
  background: #c9080f;
}
.btn-primary:active {
  transform: scale(0.98);
}
.btn-ghost {
  width: 100%;
  background: transparent;
  color: var(--t-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--body);
  font-size: 11.5px;
  padding: 7px;
  cursor: pointer;
  margin-top: 5px;
  transition: all 0.18s;
}
.btn-ghost:hover {
  border-color: var(--t-3);
  color: var(--t-1);
}

/* Sidebar live stats */
.sb-stats {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.sbs-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 4px;
}
.sbs-row span:first-child {
  color: var(--t-3);
}
.sbs-row span:last-child {
  color: var(--teal);
  font-weight: 600;
}

/* ─────────────────────────────────────────────────
   7. MAIN COLUMN
───────────────────────────────────────────────── */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ─────────────────────────────────────────────────
   8. TOPBAR
───────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  height: 54px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 98;
}
.tb-section {
  font-family: var(--head);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--t-1);
}
.tb-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 11px;
  color: var(--t-3);
}
.tb-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--t-2);
}
.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}
.menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--t-1);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

/* ─────────────────────────────────────────────────
   9. CONTENT AREA
───────────────────────────────────────────────── */
.content {
  padding: 22px 26px 50px;
  flex: 1;
}

/* ─────────────────────────────────────────────────
   10. FILTER CHIPS
───────────────────────────────────────────────── */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  min-height: 22px;
}
.chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--red-dim);
  border: 1px solid var(--red-border);
  border-radius: 20px;
  padding: 2px 8px 2px 9px;
  font-size: 11px;
  color: var(--red);
  font-weight: 500;
}
.chip-x {
  cursor: pointer;
  opacity: 0.7;
  font-size: 12px;
  margin-left: 3px;
}
.chip-x:hover {
  opacity: 1;
}

/* ─────────────────────────────────────────────────
   11. SECTION HEADINGS
───────────────────────────────────────────────── */
.section {
  margin-bottom: 34px;
}
.sec-head {
  margin-bottom: 16px;
}
.sec-title {
  font-family: var(--head);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--t-1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sec-badge {
  font-size: 9.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid var(--red-border);
  border-radius: 20px;
  padding: 2px 8px;
  font-weight: 600;
  font-family: var(--body);
}
.sec-desc {
  font-size: 12px;
  color: var(--t-3);
  margin-top: 4px;
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 6px 0 30px;
}

/* ─────────────────────────────────────────────────
   12. KPI METRIC CARDS
───────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 14px 12px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  cursor: default;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--kpi-color, var(--red));
}
.kpi:hover {
  border-color: var(--line-hi);
  transform: translateY(-2px);
}
.kpi-ico {
  font-size: 20px;
  margin-bottom: 9px;
}
.kpi-val {
  font-family: var(--head);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--t-1);
}
.kpi-lbl {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--t-3);
  margin-top: 4px;
}
.kpi-sub {
  font-size: 10.5px;
  color: var(--t-3);
  margin-top: 3px;
}

/* ─────────────────────────────────────────────────
   13. CARD GRID LAYOUTS
───────────────────────────────────────────────── */
.g2     { display: grid; grid-template-columns: 1fr 1fr;       gap: 14px; }
.g3     { display: grid; grid-template-columns: 1fr 1fr 1fr;   gap: 14px; }
.g-wide { display: grid; grid-template-columns: 2fr 1fr;        gap: 14px; }
.g-wide2{ display: grid; grid-template-columns: 1fr 2fr;        gap: 14px; }

/* ─────────────────────────────────────────────────
   14. CHART CARDS
───────────────────────────────────────────────── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  transition: border-color 0.2s;
}
.card:hover {
  border-color: var(--line-hi);
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--t-1);
  margin-bottom: 2px;
  letter-spacing: 0.2px;
}
.card-sub {
  font-size: 11px;
  color: var(--t-3);
  margin-bottom: 14px;
}
.cw {
  position: relative;
}
.cw canvas {
  max-width: 100%;
}

/* Chart type toggle buttons */
.ctoggle {
  display: flex;
  gap: 5px;
  margin-bottom: 12px;
}
.ct-btn {
  background: var(--bg-4);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--t-3);
  font-family: var(--body);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.ct-btn.on {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.ct-btn:hover:not(.on) {
  border-color: var(--t-3);
  color: var(--t-1);
}

/* ─────────────────────────────────────────────────
   15. INSIGHT CALLOUT CARDS
───────────────────────────────────────────────── */
.insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.insight {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 13px 14px;
  display: flex;
  gap: 11px;
}
.ins-ico {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.ins-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--t-1);
  margin-bottom: 2px;
}
.ins-body {
  font-size: 11px;
  color: var(--t-3);
  line-height: 1.5;
}

/* ─────────────────────────────────────────────────
   16. STAT HIGHLIGHT ROW
───────────────────────────────────────────────── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.stat {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  text-align: center;
}
.stat-val {
  font-family: var(--head);
  font-size: 22px;
  font-weight: 700;
  color: var(--t-1);
}
.stat-lbl {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--t-3);
  margin-top: 2px;
}

/* ─────────────────────────────────────────────────
   17. MONTHLY HEATMAP TABLE
───────────────────────────────────────────────── */
.heatmap-wrap {
  overflow-x: auto;
}
.heatmap-table {
  border-collapse: collapse;
  font-size: 11px;
  min-width: 520px;
  width: 100%;
}
.heatmap-table th {
  padding: 5px 8px;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--t-3);
  letter-spacing: 0.5px;
  background: var(--bg-3);
}
.heatmap-table td {
  padding: 4px 6px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 500;
  border-radius: 3px;
  cursor: default;
  transition: transform 0.15s;
}
.heatmap-table td:hover {
  transform: scale(1.1);
  z-index: 1;
  position: relative;
}
.heatmap-table .row-label {
  font-size: 11px;
  color: var(--t-3);
  text-align: right;
  padding-right: 10px;
  font-weight: 500;
  white-space: nowrap;
  background: transparent;
  border: none;
}

/* ─────────────────────────────────────────────────
   18. DATA TABLE SECTION
───────────────────────────────────────────────── */
.table-bar {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.t-search {
  flex: 1;
  min-width: 190px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--t-1);
  font-family: var(--body);
  font-size: 12.5px;
  padding: 8px 13px;
  outline: none;
}
.t-search:focus {
  border-color: var(--red);
}
.t-info {
  font-size: 11px;
  color: var(--t-3);
  white-space: nowrap;
}
.btn-export {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--teal);
  font-family: var(--body);
  font-size: 11.5px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.btn-export:hover {
  border-color: var(--teal);
  background: var(--bg-4);
}

/* Table */
.tbl-outer {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-2);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
thead th {
  background: var(--bg-3);
  padding: 10px 13px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--t-3);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
thead th:hover {
  color: var(--t-1);
}
thead th.sorted {
  color: var(--red);
}
tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  transition: background 0.13s;
}
tbody tr:last-child {
  border-bottom: none;
}
tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}
tbody td {
  padding: 9px 13px;
  color: var(--t-1);
  line-height: 1.4;
}

/* Table badges */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.b-movie {
  background: rgba(229, 9, 20, 0.12);
  color: #ff5561;
  border: 1px solid rgba(229, 9, 20, 0.2);
}
.b-show {
  background: rgba(61, 158, 255, 0.1);
  color: #6ab5ff;
  border: 1px solid rgba(61, 158, 255, 0.18);
}
.b-rate {
  background: rgba(240, 192, 64, 0.1);
  color: var(--gold);
  border: 1px solid rgba(240, 192, 64, 0.18);
}

/* Pagination */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 14px 0 2px;
}
.pg-btn {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--t-3);
  font-family: var(--body);
  font-size: 11.5px;
  padding: 5px 11px;
  cursor: pointer;
  transition: all 0.18s;
}
.pg-btn:hover:not(:disabled) {
  border-color: var(--red);
  color: var(--t-1);
}
.pg-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.pg-btn.on {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.pg-info {
  font-size: 11px;
  color: var(--t-3);
  padding: 0 8px;
}

/* ─────────────────────────────────────────────────
   19. SCROLLABLE CHART WRAPPER
───────────────────────────────────────────────── */
.sx {
  overflow-x: auto;
}
.sx canvas {
  min-width: 560px;
}

/* ─────────────────────────────────────────────────
   20. RESPONSIVE BREAKPOINTS
───────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .g2,
  .g3,
  .g-wide,
  .g-wide2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 30px rgba(0, 0, 0, 0.6);
  }
  .menu-btn {
    display: block;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
