/* =============================================
   REON — Global Design System
   ============================================= */

:root {
  --primary: #6c63ff;
  --primary-dark: #4b44cc;
  --accent: #ff6584;
  --bg: #0d0d1a;
  --surface: #14142b;
  --surface2: #1e1e3a;
  --border: #2a2a4a;
  --text: #e8e8ff;
  --text-muted: #888ab0;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(108,99,255,.18);
  --font: 'Inter', system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ---- Utilities ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
}
.badge-free { background: var(--surface2); color: var(--text-muted); }
.badge-premium { background: linear-gradient(90deg,#6c63ff,#ff6584); color: #fff; }
.badge-active { background: #16532d; color: var(--success); }
.badge-canceled { background: #451a03; color: var(--warning); }
.badge-past_due { background: #450a0a; color: var(--danger); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  border: none;
  transition: transform .15s, box-shadow .15s, opacity .15s;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #9b5de5);
  color: #fff;
  box-shadow: 0 4px 18px rgba(108,99,255,.4);
}
.btn-primary:hover { opacity: .9; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: rgba(108,99,255,.08); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .88; }
.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { opacity: .88; }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

/* ---- Forms ---- */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.form-control {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: .9rem;
  outline: none;
  transition: border-color .2s;
  width: 100%;
}
.form-control:focus { border-color: var(--primary); }
.form-control::placeholder { color: var(--text-muted); }

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: .875rem;
  margin-bottom: 16px;
}
.alert-error { background: rgba(239,68,68,.12); border: 1px solid var(--danger); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.12); border: 1px solid var(--success); color: #86efac; }
.alert-info { background: rgba(108,99,255,.12); border: 1px solid var(--primary); color: #c4bfff; }

/* ---- Navbar ---- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,13,26,.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  max-width: 1100px;
  margin: 0 auto;
}
.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.navbar-brand .brand-logo {
  width: auto;
  height: 34px;
  object-fit: contain;
}
.navbar-brand .brand-wordmark {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.navbar-links { display: flex; align-items: center; gap: 8px; }
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: .9rem;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color .15s, background .15s;
}
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--surface); }

/* ---- Stats Grid ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { text-align: left; padding: 10px 14px; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

/* ---- Plan cards ---- */
.plan-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media(max-width:600px){ .plan-cards { grid-template-columns: 1fr; } }
.plan-card {
  border-radius: var(--radius);
  padding: 28px;
  border: 2px solid var(--border);
  position: relative;
  transition: border-color .2s;
}
.plan-card.premium-card {
  border-color: var(--primary);
  background: linear-gradient(145deg, rgba(108,99,255,.08), var(--surface));
}
.plan-card .plan-price { font-size: 2.4rem; font-weight: 800; }
.plan-card .plan-period { color: var(--text-muted); font-size: .9rem; }
.plan-card ul { list-style: none; margin: 18px 0; display: flex; flex-direction: column; gap: 10px; }
.plan-card ul li::before { content: "✓ "; color: var(--success); }

/* ---- Video player ---- */
.video-player-wrap video {
  width: 100%;
  border-radius: var(--radius);
  background: #000;
  max-height: 420px;
}

/* ---- Progress bar ---- */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 99px;
  transition: width .4s;
}

/* ---- Loader ---- */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 32px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Hero ---- */
.hero {
  padding: 100px 24px 80px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 20px;
}
.hero h1 span {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p { font-size: 1.1rem; color: var(--text-muted); max-width: 600px; margin: 0 auto 36px; }

/* ---- Page layout ---- */
.page-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 4px 12px 20px;
  text-decoration: none;
}
.sidebar-brand .brand-logo {
  width: auto;
  height: 42px;
  object-fit: contain;
}
.sidebar-brand .brand-wordmark {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar a:hover, .sidebar a.active { background: var(--surface2); color: var(--text); }
.sidebar-footer { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.main-content { flex: 1; padding: 32px; overflow-y: auto; }
.page-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 24px; }

@media(max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 20px; }
}

/* ---- Hamburger button ---- */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 42px;
  height: 42px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,.4);
  transition: background .15s;
}
.hamburger-btn:hover { background: var(--surface2); }
.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- Sidebar overlay (mobile) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1050;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

@media(max-width: 900px) {
  .hamburger-btn { display: flex; }
  .main-content { padding: 20px 16px; padding-top: 70px; }

  .sidebar {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    z-index: 1090;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 24px rgba(0,0,0,.5);
    overflow-y: auto;
  }
  .sidebar.open {
    transform: translateX(0);
  }
}

/* ---- General responsive tweaks ---- */
@media(max-width: 900px) {
  .page-title { font-size: 1.3rem; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .plan-cards { grid-template-columns: 1fr; }
  .revenue-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media(max-width: 480px) {
  .card { padding: 18px; }
  .btn { padding: 9px 16px; font-size: .85rem; }
  .page-title { font-size: 1.15rem; }
  .stat-card .stat-value { font-size: 1.5rem; }
  .plan-card .plan-price { font-size: 1.8rem; }
  .hero h1 { font-size: 1.8rem; }
  #toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: unset; width: 100%; }
}

/* ---- Toast ---- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: 8px;
  color: #fff;
  font-size: .875rem;
  font-weight: 500;
  animation: slide-in .25s ease;
  min-width: 220px;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.toast-success { background: #16a34a; }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }
@keyframes slide-in { from { transform: translateX(60px); opacity:0; } to { transform: translateX(0); opacity:1; } }
