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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-obsidian);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: var(--brand-blue);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: #65b8ff;
  text-decoration: underline;
}

code, pre, .mono {
  font-family: var(--font-mono);
}

/* Ambient Clean Background */
.bg-ambient {
  display: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 64px);
  background-color: var(--bg-obsidian);
  transition: background-color 0.2s ease;
}

.container {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
}

/* YouTube Style Top Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-obsidian);
  border-bottom: 1px solid var(--border-subtle);
  height: 64px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
}

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

.brand-text-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
}

.brand-badge-pill {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: #aaaaaa;
  background: #272727;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid #383838;
}

/* Center YouTube Search Bar */
.yt-nav-search {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  max-width: 620px;
  margin: 0 16px;
}

.yt-search-box {
  display: flex;
  align-items: center;
  width: 100%;
}

.yt-search-input {
  flex: 1;
  height: 40px;
  background: #121212;
  border: 1px solid #303030;
  border-right: none;
  border-radius: 40px 0 0 40px;
  padding: 0 16px;
  color: #f1f1f1;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.yt-search-input:focus {
  border-color: #1c62b9;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.yt-search-btn {
  height: 40px;
  padding: 0 22px;
  background: #222222;
  border: 1px solid #303030;
  border-radius: 0 40px 40px 0;
  color: #f1f1f1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.yt-search-btn:hover {
  background: #2a2a2a;
}

/* Navbar Links & Actions */
.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 7px 14px;
  border-radius: 20px;
  color: #f1f1f1;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  background: transparent;
  border: none;
  font-family: inherit;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-link.active {
  background: #f1f1f1;
  color: #0f0f0f;
  font-weight: 600;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mobile-menu-btn {
  display: none;
  background: #272727;
  border: none;
  color: #f1f1f1;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-size: 18px;
  align-items: center;
  justify-content: center;
}

/* YouTube Realistic Surface Cards */
.glass-card {
  background: #181818;
  border: 1px solid #272727;
  border-radius: 12px;
  transition: transform 0.2s var(--ease-out), border-color 0.2s ease, background 0.2s ease;
}

.glass-card.interactive:hover {
  background: #212121;
  border-color: #383838;
}

/* YouTube Pill Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Primary = Pure White button like YouTube action buttons */
.btn-primary {
  background: #f1f1f1;
  color: #0f0f0f;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: #ffffff;
  transform: scale(1.02);
}

/* Secondary = #272727 dark gray pill */
.btn-secondary {
  background: #272727;
  color: #f1f1f1;
}

.btn-secondary:hover:not(:disabled) {
  background: #3f3f3f;
}

/* YouTube Signature Red Button */
.btn-yt-red {
  background: #ff0000;
  color: #ffffff;
}

.btn-yt-red:hover:not(:disabled) {
  background: #cc0000;
}

.btn-ghost {
  background: transparent;
  color: #f1f1f1;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(255, 78, 69, 0.16);
  color: #ff4e45;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(255, 78, 69, 0.28);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12.5px;
  border-radius: 16px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
  border-radius: 24px;
}

/* Form Inputs */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: #aaaaaa;
}

.input, .select, .textarea {
  width: 100%;
  background: #121212;
  border: 1px solid #303030;
  border-radius: 8px;
  color: #f1f1f1;
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: #3ea6ff;
}

.input:disabled {
  background: #1a1a1a;
  color: #555555;
  border-color: #272727;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-success { background: rgba(43, 166, 64, 0.2); color: #2ba640; }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.badge-danger  { background: rgba(255, 78, 69, 0.2); color: #ff4e45; }
.badge-info    { background: rgba(62, 166, 255, 0.2); color: #3ea6ff; }
.badge-neutral { background: #272727; color: #aaaaaa; }

/* Tables (YouTube Studio Dark Mode) */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #272727;
  background: #181818;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.data-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #aaaaaa;
  background: #212121;
  border-bottom: 1px solid #272727;
  white-space: nowrap;
}

table.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #272727;
  color: #f1f1f1;
  vertical-align: middle;
}

table.data-table tr:hover td {
  background: #212121;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  background: #1f1f1f;
  border: 1px solid #333333;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9);
}

.modal-card.wide {
  max-width: 720px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid #2f2f2f;
  padding-bottom: 12px;
}

.modal-close {
  background: transparent;
  border: none;
  color: #aaaaaa;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.modal-close:hover {
  background: #2a2a2a;
  color: #ffffff;
}

/* Toasts */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #212121;
  border: 1px solid #383838;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
  color: #ffffff;
  font-size: 13.5px;
}

/* Spinners */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 14px;
  color: #aaaaaa;
}

.spinner-lg {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid #272727;
  border-top-color: #ff0000;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  animation: spin 0.65s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Mobile Drawer */
.mobile-drawer {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px 24px;
  border-top: 1px solid #272727;
  background: #0f0f0f;
}

.mobile-drawer.open {
  display: flex;
}

@media (max-width: 960px) {
  .yt-nav-search {
    display: none;
  }
  .nav-links, .nav-actions .desktop-only {
    display: none;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
}

/* Theme Toggle Button */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  font-size: 16px;
  cursor: pointer;
  background: var(--bg-panel-hover);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  transition: all 0.2s ease;
}
.theme-toggle-btn:hover {
  background: var(--border-bright);
  transform: scale(1.05);
}

/* Light Theme Overrides */
[data-theme="light"] {
  color-scheme: light;
}

[data-theme="light"] .brand-mark {
  color: #0f172a;
}

[data-theme="light"] .glass-card,
[data-theme="light"] .panel-card,
[data-theme="light"] .plan-card,
[data-theme="light"] .dash-card,
[data-theme="light"] .dash-plan-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .plan-card.featured,
[data-theme="light"] .dash-plan-card.current-plan {
  background: #f8fafc !important;
  border-color: #0284c7 !important;
}

[data-theme="light"] .yt-shelf,
[data-theme="light"] .hero {
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .yt-search-box {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .yt-search-input {
  color: #0f172a !important;
}

[data-theme="light"] .yt-search-btn {
  background: #f1f5f9 !important;
  border-left-color: #cbd5e1 !important;
  color: #475569 !important;
}

[data-theme="light"] .nav-link {
  color: #475569 !important;
}

[data-theme="light"] .nav-link:hover,
[data-theme="light"] .nav-link.active {
  color: #0f172a !important;
  background: #e2e8f0 !important;
}

[data-theme="light"] .btn-secondary {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .btn-secondary:hover {
  background: #e2e8f0 !important;
}

[data-theme="light"] .btn-ghost {
  color: #334155 !important;
}

[data-theme="light"] .btn-ghost:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

[data-theme="light"] .input,
[data-theme="light"] .textarea,
[data-theme="light"] select {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] .table th {
  background: #f8fafc !important;
  color: #475569 !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .table td {
  border-color: #f1f5f9 !important;
  color: #1e293b !important;
}

[data-theme="light"] .modal-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-theme="light"] .site-footer {
  background: #f8fafc !important;
  border-top-color: #e2e8f0 !important;
  color: #475569 !important;
}

/* Global Footer (Razorpay Compliance & Legal Links) */
.site-footer {
  background: #0a0a0a;
  border-top: 1px solid #222222;
  color: #aaaaaa;
  padding: 48px 0 24px;
  margin-top: 64px;
  font-size: 13.5px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 36px;
}

@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
}

@media (max-width: 520px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-col h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--brand-blue);
  text-decoration: underline;
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
}
