/* ============================================================
   style.css — Main Stylesheet for BeatWave Music Website
   ============================================================
   CONCEPT: What is CSS?
   CSS (Cascading Style Sheets) controls HOW HTML looks.
   HTML = structure (bones), CSS = appearance (skin + clothes)

   CONCEPT: CSS Variables (Custom Properties)
   We define colors and fonts ONCE here using --variable-name.
   Then use them everywhere with var(--variable-name).
   WHY? If you want to change your main color, you change it
   in ONE place instead of 100 places. This is called DRY:
   Don't Repeat Yourself.
   ============================================================ */

   
/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=DM+Sans:wght@300;400;500;600&display=swap');

/* --- 1. CSS VARIABLES (Design Tokens) ---------------------- */
:root {
  /* Colors */
  --color-bg:         #0a0a0f;        /* Near-black background */
  --color-surface:    #13131a;        /* Card/panel backgrounds */
  --color-surface-2:  #1c1c28;        /* Slightly lighter surface */
  --color-border:     #2a2a3d;        /* Subtle borders */
  --color-accent:     #7c3aed;        /* Purple — our brand color */
  --color-accent-2:   #06b6d4;        /* Cyan — secondary accent */
  --color-text:       #e2e8f0;        /* Main readable text */
  --color-text-muted: #64748b;        /* Dimmed/secondary text */
  --color-success:    #22c55e;
  --color-error:      #ef4444;

  /* Typography */
  --font-display: 'Playfair Display', serif;   /* Headings — elegant */
  --font-body:    'DM Sans', sans-serif;        /* Body text — clean */
  --font-mono:    'JetBrains Mono', monospace; /* Code/numbers */

  /* Spacing scale — consistent spacing throughout */
  --space-xs:   0.25rem;   /*  4px */
  --space-sm:   0.5rem;    /*  8px */
  --space-md:   1rem;      /* 16px */
  --space-lg:   1.5rem;    /* 24px */
  --space-xl:   2rem;      /* 32px */
  --space-2xl:  3rem;      /* 48px */
  --space-3xl:  5rem;      /* 80px */

  /* Radii (rounded corners) */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-full: 9999px;  /* Makes a perfect pill/circle */

  /* Transitions — smooth animations */
  --transition: 0.3s ease;

  /* Shadows */
  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.3);
  --shadow-card: 0 8px 32px rgba(0,0,0,0.4);
}

/* --- 2. LIGHT THEME OVERRIDE ------------------------------- */
/* CONCEPT: When we add class="light-theme" to <body>, ALL
   the variables below get overridden. This is how theme
   toggle works — just swap one class! */
body.light-theme {
  --color-bg:         #f0f0f8;
  --color-surface:    #ffffff;
  --color-surface-2:  #e8e8f0;
  --color-border:     #d0d0e0;
  --color-text:       #1a1a2e;
  --color-text-muted: #6b7280;
  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.15);
  --shadow-card: 0 8px 32px rgba(0,0,0,0.1);
}

/* --- 3. RESET & BASE STYLES -------------------------------- */
/* CONCEPT: Browsers have DEFAULT styles that differ between
   Chrome, Firefox, Safari etc. This "reset" makes everything
   start from zero, so YOUR design looks the same everywhere. */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box; /* Include padding in width calc */
}

html {
  scroll-behavior: smooth; /* Smooth scroll when clicking anchor links */
  font-size: 16px;          /* Base font size — 1rem = 16px */
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;          /* Space between lines of text */
  overflow-x: hidden;        /* Prevent horizontal scroll */
  transition: background-color var(--transition), color var(--transition);
}

/* Links — remove default underline, inherit color */
a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition);
}

/* Images — always fit their container */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Lists — remove default bullet points */
ul, ol {
  list-style: none;
}

/* Buttons — remove browser default styling */
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-body);
}

/* --- 4. REUSABLE UTILITY CLASSES --------------------------- */
/* CONCEPT: Utility classes are small, single-purpose classes
   you can mix and match. You'll use these all over your HTML.
   e.g. <div class="container"> centers content on the page. */

.container {
  max-width: 1200px;   /* Never wider than 1200px */
  margin: 0 auto;      /* Centers the container */
  padding: 0 var(--space-lg);
}

.section {
  padding: var(--space-3xl) 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem); /* Fluid — scales with screen */
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.section-subtitle {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  margin-bottom: var(--space-2xl);
}

.accent-text {
  color: var(--color-accent);
}

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

/* --- 5. BUTTONS -------------------------------------------- */
/* CONCEPT: We define multiple button "variants" using classes.
   .btn is the BASE style, then .btn-primary adds the specific color. */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-accent), #9b59f5);
  color: #fff;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);       /* Lift up on hover */
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.6);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--color-border);
  color: var(--color-text);
}

.btn-outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  transform: translateY(-2px);
}

.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  transition: all var(--transition);
  font-size: 1.1rem;
}

.btn-icon:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  transform: scale(1.1);
}

/* --- 6. NAVIGATION BAR ------------------------------------- */
/* CONCEPT: The navbar is FIXED — it stays at top when scrolling.
   We use FLEXBOX to lay items in a row and space them out.
   Flexbox is THE most important CSS layout tool to learn. */

.navbar {
  position: fixed;            /* Sticks to top of screen */
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;              /* Stays above all other content */
  padding: var(--space-md) 0;
  transition: all var(--transition);
  border-bottom: 1px solid transparent;
}

/* When JS adds .scrolled class, the navbar gets a background */
.navbar.scrolled {
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(20px);        /* Frosted glass effect */
  border-bottom-color: var(--color-border);
}

body.light-theme .navbar.scrolled {
  background: rgba(240, 240, 248, 0.9);
}

.navbar .container {
  display: flex;              /* FLEXBOX: puts children in a row */
  align-items: center;        /* FLEXBOX: centers vertically */
  justify-content: space-between; /* FLEXBOX: pushes logo left, links right */
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
}

.nav-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* Navigation Links */
.nav-links {
  display: flex;              /* Links in a row */
  align-items: center;
  gap: var(--space-xl);
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-muted);
  position: relative;
  padding-bottom: 4px;
  transition: color var(--transition);
}

/* Underline animation on hover */
.nav-link::after {
  content: '';                /* Creates a pseudo-element (fake element) */
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;                   /* Starts at 0 width */
  height: 2px;
  background: var(--color-accent);
  transition: width var(--transition); /* Animates width */
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-text);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;                /* Expands to full width on hover */
}

/* Right side actions (theme toggle + hamburger) */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Theme toggle button */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition);
}

.theme-toggle:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  transform: rotate(20deg);
}

/* Hamburger menu — hidden on desktop, shown on mobile */
.hamburger {
  display: none;             /* Hidden by default */
  flex-direction: column;
  gap: 5px;
  width: 32px;
  cursor: pointer;
}

.hamburger span {
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: all var(--transition);
}

/* When .open class is added, create an X shape */
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --- 7. FOOTER --------------------------------------------- */
.footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-3xl) 0 var(--space-xl);
}

.footer-grid {
  display: grid;
  /* CONCEPT: CSS Grid creates 2D layouts. Here: 4 equal columns */
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

.footer-brand p {
  color: var(--color-text-muted);
  margin: var(--space-md) 0 var(--space-lg);
  max-width: 280px;
  font-size: 0.95rem;
}

.footer-social {
  display: flex;
  gap: var(--space-sm);
}

.social-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all var(--transition);
}

.social-btn:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  transform: translateY(-3px);
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

.footer-col ul li {
  margin-bottom: var(--space-sm);
}

.footer-col ul li a {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  transition: color var(--transition);
}

.footer-col ul li a:hover {
  color: var(--color-accent);
}

.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* --- 8. TOAST NOTIFICATIONS -------------------------------- */
/* CONCEPT: Toasts are small popups that appear temporarily
   to give feedback ("Song added!", "Form submitted!") */

.toast-container {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  min-width: 280px;
  max-width: 380px;
  /* Start invisible and below */
  opacity: 0;
  transform: translateY(20px);
  animation: toastIn 0.3s ease forwards;
}

.toast.success { border-left: 4px solid var(--color-success); }
.toast.error   { border-left: 4px solid var(--color-error); }
.toast.info    { border-left: 4px solid var(--color-accent); }

.toast-icon { font-size: 1.3rem; }
.toast-message { font-size: 0.95rem; }

.toast.hide {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(100px); }
}

/* --- 9. PAGE HEADER (for inner pages) ---------------------- */
.page-header {
  padding: 8rem 0 4rem;
  text-align: center;
  background: linear-gradient(to bottom, var(--color-surface), var(--color-bg));
  border-bottom: 1px solid var(--color-border);
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  margin-bottom: var(--space-md);
}

.page-header p {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  max-width: 500px;
  margin: 0 auto;
}

/* --- 10. CARDS --------------------------------------------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;           /* Content won't leak outside rounded corners */
  transition: all var(--transition);
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card);
  border-color: var(--color-accent);
}

/* --- 11. FORM ELEMENTS ------------------------------------- */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.875rem var(--space-lg);
  background: var(--color-surface-2);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--color-accent); /* Highlight on focus */
}

/* Error state */
.form-group input.error,
.form-group textarea.error {
  border-color: var(--color-error);
}

.form-group .error-msg {
  color: var(--color-error);
  font-size: 0.82rem;
  margin-top: var(--space-xs);
  display: none; /* Hidden until JS shows it */
}

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

/* Character counter */
.char-counter {
  text-align: right;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

.char-counter.warning { color: var(--color-error); }
