/* NovaFree — Purple-Pink Gradient, Glassmorphism, Dark Mode, Responsive */

:root {
  --gradient-1: #7c3aed;
  --gradient-2: #db2777;
  --gradient-3: #a855f7;
  --bg-primary: #0f0a1a;
  --bg-secondary: #1a1128;
  --bg-card: rgba(255, 255, 255, 0.06);
  --bg-card-hover: rgba(255, 255, 255, 0.1);
  --bg-glass: rgba(255, 255, 255, 0.08);
  --border-glass: rgba(255, 255, 255, 0.12);
  --text-primary: #f3e8ff;
  --text-secondary: #c4b5fd;
  --text-muted: #8b7faa;
  --accent-green: #22c55e;
  --accent-green-bg: rgba(34, 197, 94, 0.15);
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;
  --shadow-lg: 0 8px 32px rgba(124, 58, 237, 0.2);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --nav-height: 64px;
  --max-width: 1200px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f5f0ff;
  --bg-secondary: #ede5ff;
  --bg-card: rgba(124, 58, 237, 0.06);
  --bg-card-hover: rgba(124, 58, 237, 0.1);
  --bg-glass: rgba(255, 255, 255, 0.7);
  --border-glass: rgba(124, 58, 237, 0.15);
  --text-primary: #1e1033;
  --text-secondary: #5b21b6;
  --text-muted: #7c6a9e;
  --shadow-lg: 0 8px 32px rgba(124, 58, 237, 0.12);
  --shadow-card: 0 4px 24px rgba(124, 58, 237, 0.08);
}

/* --- Reset --- */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: var(--gradient-3); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gradient-2); }

img { max-width: 100%; display: block; }

/* --- Background Gradient Mesh --- */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(124, 58, 237, 0.15), transparent),
    radial-gradient(ellipse 60% 80% at 90% 80%, rgba(219, 39, 119, 0.12), transparent),
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(168, 85, 247, 0.08), transparent);
  pointer-events: none;
  z-index: -1;
}

/* --- Glassmorphism Nav --- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--border-glass);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a, .nav-links button {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.nav-links a:hover, .nav-links button:hover {
  background: var(--bg-card-hover);
}

.nav-links .btn-primary {
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
  color: #fff;
  border-radius: var(--radius-sm);
}

.nav-links .btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
}

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition);
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  transform: rotate(20deg);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    flex-direction: column;
    padding: 16px;
    gap: 4px;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition);
  }
  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }
  .nav-links a, .nav-links button { width: 100%; text-align: center; }
}

/* --- Main Container --- */

.main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(var(--nav-height) + 32px) 24px 48px;
}

/* --- Hero Section --- */

.hero {
  text-align: center;
  padding: 80px 0 60px;
}

.hero-badge {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 50px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 20px;
  letter-spacing: -1.5px;
}

.hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2), var(--gradient-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 36px;
}

.hero-buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
  color: #fff;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.45);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
  padding: 8px 18px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* --- Cards --- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all var(--transition);
  box-shadow: var(--shadow-card);
}

.card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(219, 39, 119, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 16px;
}

.card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- Feature Grid (Dashboard) --- */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.feature-card {
  position: relative;
  overflow: hidden;
}

.feature-card.locked {
  opacity: 0.7;
}

.feature-card.locked .card-icon {
  background: rgba(100, 100, 120, 0.15);
}

.feature-card.unlocked .card-icon {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.05));
}

.feature-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.feature-badge.unlocked {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.feature-badge.locked {
  background: rgba(100, 100, 120, 0.15);
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
}

.feature-action {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.feature-action .action-icon {
  font-size: 1rem;
}

.feature-card .unlock-btn {
  margin-top: 16px;
  width: 100%;
}

/* --- Forms --- */

.form-container {
  max-width: 440px;
  margin: 0 auto;
}

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 40px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
}

.form-card h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
  text-align: center;
}

.form-card .form-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--gradient-1);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-error {
  color: var(--accent-red);
  font-size: 0.82rem;
  margin-top: 4px;
  display: none;
}

.form-error.visible {
  display: block;
}

.form-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.form-footer a {
  font-weight: 600;
}

/* --- Dashboard Header --- */

.dash-header {
  margin-bottom: 36px;
}

.dash-header h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.dash-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

.dash-stats {
  display: flex;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
}

.stat-chip .stat-value {
  font-weight: 700;
  color: var(--gradient-3);
}

.stat-chip .stat-label {
  color: var(--text-muted);
}

/* --- Profile Section --- */

.profile-section {
  max-width: 600px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.profile-info h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.profile-info p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(12px);
  margin-bottom: 20px;
}

.profile-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
}

/* --- Toast Notification --- */

.toast-container {
  position: fixed;
  top: calc(var(--nav-height) + 16px);
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--gradient-3); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* --- Loading Spinner --- */

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-glass);
  border-top-color: var(--gradient-1);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Streak Flame --- */

.streak-flame {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-amber);
  font-weight: 700;
}

/* --- Section Divider --- */

.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-glass), transparent);
  margin: 40px 0;
}

/* --- Responsive --- */

@media (max-width: 640px) {
  .main { padding: calc(var(--nav-height) + 20px) 16px 32px; }
  .hero { padding: 40px 0 30px; }
  .hero h1 { font-size: 2.2rem; }
  .form-card { padding: 28px 20px; }
  .feature-grid { grid-template-columns: 1fr; }
  .dash-stats { flex-direction: column; }
  .profile-header { flex-direction: column; text-align: center; }
}

/* --- Modal --- */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 20px;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
}

.modal-card h3 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.btn-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
  background: rgba(34, 197, 94, 0.25);
}

.feature-badge.ready {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* --- Utility --- */

.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }
