/* ================================================================
   Nixie DMS — App Stylesheet
   Dark Navy + Orange theme (matching nixie.in)
   ================================================================ */

/* ── Design Tokens ───────────────────────────────────── */
:root {
  --navy:       #0A1628;
  --navy-2:     #112035;
  --navy-3:     #0D2040;
  --navy-4:     #0B1A30;
  --border:     #1E3050;
  --border-l:   #263A56;
  --orange:     #FF6B35;
  --orange-h:   #e85a22;
  --orange-bg:  rgba(255,107,53,.08);
  --green:      #00C853;
  --green-bg:   rgba(0,200,83,.12);
  --red:        #FF4D4D;
  --red-bg:     rgba(255,77,77,.1);
  --yellow:     #FFBD2E;
  --yellow-bg:  rgba(255,189,46,.1);
  --blue:       #4DA6FF;
  --blue-bg:    rgba(77,166,255,.1);
  --text:       #E8EAF0;
  --muted:      #8892A4;
  --white:      #FFFFFF;
  --radius:     12px;
  --radius-sm:  8px;
  --radius-xs:  6px;
  --radius-pill:999px;
  --shadow:     0 4px 24px rgba(0,0,0,0.25);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.35);
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.15);
  --font-head:  'Poppins', sans-serif;
  --font-body:  'Inter', sans-serif;
  --trans:      0.2s ease;
  --sidebar-w:  260px;
  --topbar-h:   60px;
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--navy);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--orange); text-decoration: none; transition: color var(--trans); }
a:hover { color: var(--orange-h); }
h1,h2,h3,h4 { font-family: var(--font-head); color: var(--white); font-weight: 700; line-height: 1.3; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
p { margin-bottom: .75rem; }
p:last-child { margin-bottom: 0; }

/* ══════════════════════════════════════════════════════
   AUTH SCREENS
═══════════════════════════════════════════════════════ */
.auth-wrapper {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,107,53,.06) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(77,166,255,.04) 0%, transparent 50%),
    var(--navy);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.auth-logo {
  font-family: var(--font-head); font-size: 1.8rem; font-weight: 800;
  color: var(--white); text-align: center; margin-bottom: 32px;
}
.auth-logo span { color: var(--orange); }
.auth-screen { display: none; }
.auth-screen.active { display: block; }
.auth-screen h2 { text-align: center; margin-bottom: 6px; font-size: 1.4rem; }
.auth-sub { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 28px; }
.auth-switch { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 20px; }
.otp-input {
  text-align: center; font-size: 1.8rem; font-weight: 700;
  letter-spacing: 12px; font-family: var(--font-head);
}
.expired-icon { text-align: center; font-size: 3rem; margin-bottom: 12px; }

/* Alert inside auth */
.alert {
  margin-top: 16px; padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: .85rem; text-align: center;
}
.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid rgba(255,77,77,.2); }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(0,200,83,.2); }

/* ══════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .85rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-control {
  width: 100%; background: var(--navy-3); border: 1px solid var(--border);
  color: var(--text); padding: 11px 14px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: .92rem; transition: border-color var(--trans);
}
.form-control:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,107,53,.1); }
.form-control::placeholder { color: rgba(136,146,164,.6); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238892A4' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* ══════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 22px; border-radius: var(--radius-pill);
  font-family: var(--font-body); font-size: .9rem; font-weight: 600;
  border: 2px solid transparent; cursor: pointer; transition: all var(--trans);
  text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--orange); color: var(--white); border-color: var(--orange); }
.btn-primary:hover { background: var(--orange-h); border-color: var(--orange-h); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--orange); color: var(--orange); }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: rgba(255,77,77,.2); }
.btn-danger:hover { background: rgba(255,77,77,.18); }
.btn-ghost { background: transparent; color: var(--muted); border: none; padding: 6px 12px; }
.btn-ghost:hover { color: var(--white); }
.btn-sm { padding: 7px 16px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn-green { background: var(--green); color: var(--white); border-color: var(--green); }
.btn-green:hover { background: #00b34a; border-color: #00b34a; }

/* ══════════════════════════════════════════════════════
   APP LAYOUT
═══════════════════════════════════════════════════════ */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  grid-row: 1 / -1;
  background: var(--navy-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  font-family: var(--font-head); font-size: 1.4rem; font-weight: 800;
  color: var(--white); padding: 24px 22px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo span { color: var(--orange); }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section-label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); opacity: .6;
  padding: 16px 22px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 22px; color: var(--muted); font-size: .88rem; font-weight: 500;
  transition: all var(--trans); border-left: 3px solid transparent;
  text-decoration: none;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,.03); }
.nav-link.active { color: var(--orange); background: var(--orange-bg); border-left-color: var(--orange); }
.nav-icon { font-size: 1.05rem; width: 22px; text-align: center; flex-shrink: 0; }
.sidebar-footer {
  padding: 16px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.sidebar-user { font-size: .82rem; color: var(--muted); }
.sidebar-logout { font-size: .82rem; color: var(--muted); transition: color var(--trans); }
.sidebar-logout:hover { color: var(--red); }

/* ── Topbar ── */
.topbar {
  display: none; /* shown on mobile */
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: var(--navy-2); border-bottom: 1px solid var(--border);
  padding: 0 20px; align-items: center; z-index: 90;
}
.topbar-toggle {
  background: none; border: 1px solid var(--border); color: var(--text);
  font-size: 1.2rem; padding: 6px 10px; border-radius: var(--radius-sm);
  cursor: pointer;
}
.topbar-title { font-family: var(--font-head); font-weight: 700; color: var(--white); margin-left: 14px; font-size: 1rem; }
.topbar-actions { margin-left: auto; }

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  padding: 32px 36px;
  min-height: 100vh;
  background: var(--navy);
}

/* Pages */
.page { display: none; }
.page.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 28px; flex-wrap: wrap; gap: 12px;
}
.page-desc { color: var(--muted); font-size: .9rem; }

/* ══════════════════════════════════════════════════════
   PANELS & CARDS
═══════════════════════════════════════════════════════ */
.panel {
  background: var(--navy-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.panel-title {
  font-family: var(--font-head); font-size: 1rem; font-weight: 700;
  color: var(--white); margin-bottom: 18px;
}

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat-card {
  background: var(--navy-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 20px;
  transition: all var(--trans); position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--orange), #ff9a6c);
  opacity: 0; transition: opacity var(--trans);
}
.stat-card:hover { border-color: rgba(255,107,53,.2); transform: translateY(-2px); }
.stat-card:hover::before { opacity: 1; }
.stat-card .stat-icon { font-size: 1.6rem; margin-bottom: 10px; }
.stat-card .stat-value {
  font-family: var(--font-head); font-size: 1.8rem; font-weight: 800;
  color: var(--white); line-height: 1;
}
.stat-card .stat-label { font-size: .8rem; color: var(--muted); margin-top: 4px; }

/* ── Data Tables ── */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: .75rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 14px; font-size: .88rem; border-bottom: 1px solid rgba(30,48,80,.5);
  color: var(--text);
}
.data-table tr:hover td { background: rgba(255,255,255,.015); }
.data-table .actions { display: flex; gap: 6px; }

/* Empty state */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--muted);
}
.empty-state span { font-size: 3rem; display: block; margin-bottom: 12px; opacity: .5; }
.empty-state p { font-size: .9rem; }

/* Badges */
.badge {
  display: inline-block; font-size: .72rem; font-weight: 700;
  padding: 3px 10px; border-radius: var(--radius-pill);
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-muted { background: rgba(136,146,164,.1); color: var(--muted); }

/* Sub badge (topbar) */
.sub-badge {
  font-size: .72rem; font-weight: 700; padding: 4px 12px;
  border-radius: var(--radius-pill);
}

/* ══════════════════════════════════════════════════════
   SUBSCRIPTION / PRICING
═══════════════════════════════════════════════════════ */
.sub-status-card {
  background: var(--navy-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.sub-status-card .sub-plan {
  font-family: var(--font-head); font-size: 1.3rem; font-weight: 800;
  color: var(--white); margin-bottom: 4px;
}
.sub-status-card .sub-detail { color: var(--muted); font-size: .9rem; }

.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pricing-card {
  background: var(--navy-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
  transition: all var(--trans); text-align: center; position: relative;
}
.pricing-card:hover { border-color: rgba(255,107,53,.3); transform: translateY(-3px); box-shadow: var(--shadow); }
.pricing-card.featured { border-color: var(--orange); }
.pricing-card .plan-badge {
  display: inline-block; background: var(--orange); color: var(--white);
  font-size: .68rem; font-weight: 700; padding: 3px 10px;
  border-radius: var(--radius-pill); margin-bottom: 12px;
}
.pricing-card .plan-name { font-size: .88rem; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.pricing-card .plan-price {
  font-family: var(--font-head); font-size: 2.4rem; font-weight: 800; color: var(--white);
}
.pricing-card .plan-price sup { font-size: .9rem; }
.pricing-card .plan-period { font-size: .8rem; color: var(--muted); }
.pricing-card .plan-per { font-size: .78rem; color: var(--green); font-weight: 600; margin: 6px 0 16px; }
.pricing-card .btn { margin-top: 16px; }

/* Pricing mini (in expired screen) */
.pricing-mini { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 20px 0; }
.pricing-mini-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; background: var(--navy-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; transition: all var(--trans);
}
.pricing-mini-item:hover { border-color: var(--orange); }
.pricing-mini-item .plan-info { text-align: left; }
.pricing-mini-item .plan-info strong { color: var(--white); font-size: .9rem; display: block; }
.pricing-mini-item .plan-info small { color: var(--muted); font-size: .78rem; }
.pricing-mini-item .plan-cost { font-family: var(--font-head); font-weight: 700; color: var(--orange); }

/* ══════════════════════════════════════════════════════
   QUICK ACTIONS
═══════════════════════════════════════════════════════ */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick-btn {
  background: var(--navy-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px;
  color: var(--text); font-size: .88rem; font-weight: 600;
  cursor: pointer; transition: all var(--trans);
  font-family: var(--font-body);
}
.quick-btn:hover { border-color: var(--orange); color: var(--orange); background: var(--orange-bg); }

/* ══════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: var(--navy-2); border: 1px solid var(--border);
  border-radius: var(--radius); width: 100%; max-width: 540px;
  max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.05rem; }
.modal-close {
  background: none; border: none; color: var(--muted); font-size: 1.2rem;
  cursor: pointer; padding: 4px; transition: color var(--trans);
}
.modal-close:hover { color: var(--white); }
.modal-body { padding: 24px; }
.modal-body .form-group:last-of-type { margin-bottom: 20px; }

/* ══════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 2000;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--navy-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 20px;
  font-size: .88rem; box-shadow: var(--shadow);
  animation: toastIn .3s ease;
  display: flex; align-items: center; gap: 10px;
  min-width: 280px;
}
.toast.toast-success { border-left: 3px solid var(--green); }
.toast.toast-error { border-left: 3px solid var(--red); }
.toast.toast-info { border-left: 3px solid var(--blue); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ══════════════════════════════════════════════════════
   PROFILE
═══════════════════════════════════════════════════════ */
.profile-row {
  display: flex; justify-content: space-between; padding: 14px 0;
  border-bottom: 1px solid rgba(30,48,80,.4);
}
.profile-row:last-child { border-bottom: none; }
.profile-row .label { font-size: .85rem; color: var(--muted); }
.profile-row .value { font-size: .9rem; color: var(--white); font-weight: 600; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid { grid-template-columns: 1fr; max-width: 400px; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .3s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .topbar { display: flex; }
  .main-content {
    margin-left: 0;
    padding: 80px 16px 24px;
  }
  .page-header { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
}

/* ── Scrollbar (webkit) ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--navy); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-l); }

/* ── Loading spinner ── */
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
