/* ============================================================
   Premium Design System — Light / Dark Mode Luxe Edition
   ============================================================ */

/* ── Design Tokens (Dark = default) ── */
:root,
[data-theme="dark"] {
  --bg-primary: #07070d;
  --bg-secondary: #0e0e18;
  --bg-card: rgba(18, 18, 30, 0.75);
  --bg-card-solid: #12121e;
  --bg-sidebar: rgba(12, 12, 22, 0.92);
  --bg-input: rgba(22, 22, 38, 0.8);
  --bg-topbar: rgba(10, 10, 20, 0.9);

  --border-color: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(245, 158, 11, 0.3);
  --border-active: rgba(245, 158, 11, 0.5);

  --text-primary: #f1f1f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-accent: #f59e0b;

  --gold-50: #fefce8;
  --gold-100: #fef3c7;
  --gold-200: #fde68a;
  --gold-300: #fcd34d;
  --gold-400: #fbbf24;
  --gold-500: #f59e0b;
  --gold-600: #d97706;
  --gold-700: #b45309;

  --emerald-500: #10b981;
  --emerald-600: #059669;

  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;
  --radius-3xl: 1.75rem;

  --shadow-glow-sm: 0 0 20px -5px rgba(245, 158, 11, 0.15);
  --shadow-glow-md: 0 0 40px -10px rgba(245, 158, 11, 0.2);
  --shadow-glow-lg: 0 8px 60px -15px rgba(245, 158, 11, 0.25);
  --shadow-card: 0 4px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-card-hover: 0 8px 40px -10px rgba(0, 0, 0, 0.6), 0 0 30px -10px rgba(245, 158, 11, 0.12);

  --canvas-bg: #07070d;
  --particle-color: 245, 158, 11;
  --noise-opacity: 0.025;
  --scrollbar-thumb: rgba(245, 158, 11, 0.35);
  --scrollbar-thumb-hover: rgba(245, 158, 11, 0.6);
}

/* ── Light Theme ── */
[data-theme="light"] {
  --bg-primary: #f8f7f4;
  --bg-secondary: #f0efe9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-solid: #ffffff;
  --bg-sidebar: rgba(255, 255, 255, 0.95);
  --bg-input: rgba(255, 255, 255, 0.9);
  --bg-topbar: rgba(255, 255, 255, 0.92);

  --border-color: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(217, 119, 6, 0.35);
  --border-active: rgba(217, 119, 6, 0.55);

  --text-primary: #1a1a2e;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --text-accent: #d97706;

  --gold-50: #fffbeb;
  --gold-100: #fef3c7;
  --gold-200: #fde68a;
  --gold-300: #fcd34d;
  --gold-400: #f59e0b;
  --gold-500: #d97706;
  --gold-600: #b45309;
  --gold-700: #92400e;

  --emerald-500: #059669;
  --emerald-600: #047857;

  --shadow-glow-sm: 0 0 20px -5px rgba(217, 119, 6, 0.12);
  --shadow-glow-md: 0 0 40px -10px rgba(217, 119, 6, 0.15);
  --shadow-glow-lg: 0 8px 60px -15px rgba(217, 119, 6, 0.2);
  --shadow-card: 0 4px 24px -8px rgba(0, 0, 0, 0.08);
  --shadow-card-hover: 0 8px 32px -8px rgba(0, 0, 0, 0.12), 0 0 20px -8px rgba(217, 119, 6, 0.1);

  --canvas-bg: #f8f7f4;
  --particle-color: 217, 119, 6;
  --noise-opacity: 0.015;
  --scrollbar-thumb: rgba(217, 119, 6, 0.4);
  --scrollbar-thumb-hover: rgba(217, 119, 6, 0.7);
}

/* ── Smooth theme transition ── */
html {
  color-scheme: dark;
  transition: color-scheme 0.35s ease;
}
html[data-theme="light"] {
  color-scheme: light;
}

body {
  cursor: default;
  background-color: var(--bg-primary) !important;
  color: var(--text-primary);
  transition:
    background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Soft fade during theme switch */
body.theme-switching::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: var(--bg-primary);
  opacity: 0.35;
  animation: theme-fade 0.4s ease forwards;
}
@keyframes theme-fade {
  0% { opacity: 0.35; }
  100% { opacity: 0; }
}

* {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

::selection {
  background-color: rgba(245, 158, 11, 0.3);
  color: #fff;
}
::-moz-selection {
  background-color: rgba(245, 158, 11, 0.3);
  color: #fff;
}

button, a, input[type="button"], input[type="submit"],
label, select, [role="button"], .cursor-pointer {
  cursor: pointer !important;
}
input[type="text"], input[type="email"], input[type="password"], textarea {
  cursor: text !important;
}

/* ── Visible Custom Scrollbar ── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(128, 128, 128, 0.08);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background 0.25s;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) rgba(128, 128, 128, 0.08);
}

/* Modal stronger scrollbar */
.modal-content::-webkit-scrollbar,
.modal-scroll::-webkit-scrollbar {
  width: 10px;
}
.modal-content::-webkit-scrollbar-track,
.modal-scroll::-webkit-scrollbar-track {
  background: rgba(128, 128, 128, 0.12);
  border-radius: 0 12px 12px 0;
  margin: 8px 0;
}
.modal-content::-webkit-scrollbar-thumb,
.modal-scroll::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  min-height: 40px;
}
.modal-content::-webkit-scrollbar-thumb:hover,
.modal-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}

canvas#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.45s ease;
}
[data-theme="light"] canvas#bg {
  opacity: 0.55;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: var(--noise-opacity);
  mix-blend-mode: overlay;
  transition: opacity 0.4s ease;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-accent);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--border-hover);
  background: rgba(245, 158, 11, 0.1);
  transform: scale(1.06);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.theme-toggle:active svg {
  transform: rotate(25deg) scale(0.92);
}

.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

@property --glow-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes glow-rotate {
  to { --glow-angle: 360deg; }
}
.glow-border {
  position: relative;
  overflow: hidden;
}
.glow-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: conic-gradient(
    from var(--glow-angle),
    transparent 60%,
    rgba(245, 158, 11, 0.3) 75%,
    rgba(245, 158, 11, 0.5) 80%,
    rgba(245, 158, 11, 0.3) 85%,
    transparent 100%
  );
  animation: glow-rotate 4s linear infinite;
  z-index: -1;
}
.glow-border::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: var(--bg-card-solid);
  z-index: -1;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.shake { animation: shake 0.38s cubic-bezier(.36,.07,.19,.97) both; }

@keyframes spin-custom {
  to { transform: rotate(360deg); }
}
.animate-spin-custom { animation: spin-custom 0.75s linear infinite; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
  animation: fade-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.animate-fade-in-up {
  animation: fade-in-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.animate-slide-in-right {
  animation: slide-in-right 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 0 0 20px rgba(245, 158, 11, 0); }
}
.animate-pulse-glow { animation: pulse-glow 2.5s infinite; }

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.shimmer {
  background: linear-gradient(90deg, transparent 25%, rgba(245, 158, 11, 0.06) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.animate-float { animation: float 3s ease-in-out infinite; }

@keyframes gradient-x {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.animate-gradient-x {
  background-size: 200% 200%;
  animation: gradient-x 3s ease infinite;
}

.transition-smooth {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card-hover {
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-hover) !important;
}

*:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}

@keyframes count-up {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}
.stat-value {
  animation: count-up 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gradient-text {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
.dot-pulse { animation: dot-pulse 2s ease-in-out infinite; }

.stagger-children > * {
  opacity: 0;
  animation: fade-in-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.stagger-children > *:nth-child(1) { animation-delay: 0s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.06s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.12s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.18s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.24s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }

.plan-card-compact {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.plan-card-compact:hover {
  transform: translateY(-3px);
}

/* Light mode overrides */
[data-theme="light"] .bg-\[\#0a0a14\]\/95,
[data-theme="light"] .bg-\[\#0a0a14\]\/90,
[data-theme="light"] .bg-\[\#12121e\] {
  background-color: var(--bg-sidebar) !important;
  transition: background-color 0.4s ease;
}
[data-theme="light"] .text-white {
  color: #0f172a !important;
}
[data-theme="light"] .text-gray-200,
[data-theme="light"] .text-gray-300 {
  color: #1e293b !important;
}
[data-theme="light"] .text-gray-400 {
  color: #334155 !important;
}
[data-theme="light"] .text-gray-500 {
  color: #475569 !important;
}
[data-theme="light"] .text-gray-600 {
  color: #64748b !important;
}
[data-theme="light"] .text-amber-400 {
  color: #b45309 !important;
}
[data-theme="light"] .border-white\/\[0\.06\],
[data-theme="light"] .border-white\/\[0\.08\],
[data-theme="light"] .border-white\/5,
[data-theme="light"] .border-white\/\[0\.1\] {
  border-color: rgba(0, 0, 0, 0.09) !important;
}
[data-theme="light"] .bg-white\/\[0\.03\],
[data-theme="light"] .bg-white\/\[0\.02\],
[data-theme="light"] .bg-white\/\[0\.04\],
[data-theme="light"] .bg-white\/\[0\.05\],
[data-theme="light"] .bg-white\/\[0\.06\] {
  background-color: rgba(0, 0, 0, 0.03) !important;
}
[data-theme="light"] .bg-black\/70,
[data-theme="light"] .bg-black\/80 {
  background-color: rgba(0, 0, 0, 0.45) !important;
}
[data-theme="light"] .modal-content {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15) !important;
}

/* ============================================================
   Auth & Registration Pages Luxe Light Mode Theme Overrides
   ============================================================ */
[data-theme="light"] .form-box {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.09) !important;
  box-shadow: 0 20px 45px -12px rgba(0, 0, 0, 0.1), 0 0 1px 1px rgba(0, 0, 0, 0.04) !important;
}
[data-theme="light"] .right {
  background: rgba(255, 255, 255, 0.5) !important;
  border-color: rgba(0, 0, 0, 0.07) !important;
}
[data-theme="light"] .left-heading,
[data-theme="light"] .left-title,
[data-theme="light"] .form-title {
  color: #0f172a !important;
}
[data-theme="light"] .left-heading span,
[data-theme="light"] .left-title span {
  background: linear-gradient(135deg, #b45309, #d97706) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}
[data-theme="light"] .left-desc {
  color: #334155 !important;
}
[data-theme="light"] .left-chip {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(180, 83, 9, 0.3) !important;
}
[data-theme="light"] .chip-text,
[data-theme="light"] .form-eyebrow {
  color: #92400e !important;
  font-weight: 700 !important;
}
[data-theme="light"] .chip-dot {
  background-color: #d97706 !important;
}
[data-theme="light"] .logo-name {
  color: #1e293b !important;
  font-weight: 800 !important;
}
[data-theme="light"] .logo-hex {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(180, 83, 9, 0.3) !important;
}
[data-theme="light"] .logo-hex svg {
  color: #b45309 !important;
}

/* Modality Badges & Features */
[data-theme="light"] .left-middle .grid > div,
[data-theme="light"] .left-mid .grid > div {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  color: #1e293b !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
}
[data-theme="light"] .left-middle .grid > div span.bg-amber-400,
[data-theme="light"] .left-mid .grid > div span.bg-amber-400 {
  background-color: #d97706 !important;
}
[data-theme="light"] .feat-text,
[data-theme="light"] .step-head {
  color: #0f172a !important;
  font-weight: 600 !important;
}
[data-theme="light"] .feat-icon {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(180, 83, 9, 0.25) !important;
  color: #b45309 !important;
}
[data-theme="light"] .steps-title {
  color: #475569 !important;
  font-weight: 700 !important;
}
[data-theme="light"] .step-sub,
[data-theme="light"] .feat div span:last-child {
  color: #475569 !important;
}
[data-theme="light"] .step-num {
  background: rgba(245, 158, 11, 0.14) !important;
  border-color: rgba(180, 83, 9, 0.35) !important;
  color: #92400e !important;
  font-weight: 700 !important;
}

/* Inputs & Form Elements */
[data-theme="light"] input,
[data-theme="light"] .field-input {
  background-color: #f8fafc !important;
  color: #0f172a !important;
  border: 1.5px solid #cbd5e1 !important;
}
[data-theme="light"] .field-input:focus {
  background-color: #ffffff !important;
  border-color: #d97706 !important;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.15) !important;
}
[data-theme="light"] .field-label {
  color: #64748b !important;
}
[data-theme="light"] .peer:focus ~ .field-label,
[data-theme="light"] .peer:not(:placeholder-shown) ~ .field-label {
  color: #b45309 !important;
  font-weight: 700 !important;
}
[data-theme="light"] input::placeholder {
  color: #94a3b8 !important;
}
[data-theme="light"] .eye-btn {
  color: #64748b !important;
}
[data-theme="light"] .eye-btn:hover {
  color: #b45309 !important;
}
[data-theme="light"] .form-sub {
  color: #475569 !important;
}
[data-theme="light"] .divider .div-line {
  background-color: #e2e8f0 !important;
}
[data-theme="light"] .divider .div-t {
  color: #64748b !important;
  font-weight: 600 !important;
}
[data-theme="light"] .reg-row {
  color: #475569 !important;
}
[data-theme="light"] .reg-row a {
  color: #b45309 !important;
  font-weight: 700 !important;
}
[data-theme="light"] .reg-row a:hover {
  color: #92400e !important;
}
[data-theme="light"] .status-bar {
  color: #64748b !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

/* Stepper dots & Password bars in Light Mode */
[data-theme="light"] .prog-dot {
  background: rgba(0, 0, 0, 0.1) !important;
}
[data-theme="light"] .prog-dot.active {
  background: #d97706 !important;
}
[data-theme="light"] .prog-dot.done {
  background: rgba(217, 119, 6, 0.4) !important;
}
[data-theme="light"] .pw-bar {
  background: rgba(0, 0, 0, 0.09) !important;
}

[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  transition: background 0.4s ease, border-color 0.4s ease;
}
[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.94) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.sidebar,
.topbar,
.m-card,
.add-card,
.modal-content,
.stat-card,
.plan-card-compact,
.form-box {
  transition:
    background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.35s ease,
    color 0.35s ease,
    box-shadow 0.35s ease;
}
