/*
 * IndieCrates Application Styles
 * Following 37signals approach - native CSS features, no Tailwind
 */

/* ========================================
   CSS Variables & Design Tokens
   ======================================== */
:root {
  /* Core palette from design guidelines */
  --color-black: #000000;
  --color-primary: #14213d;
  --color-accent: #fca311;
  --color-muted: #e5e5e5;
  --color-white: #ffffff;

  /* Semantic aliases */
  --color-text: var(--color-black);
  --color-text-muted: var(--color-primary);
  --color-background: var(--color-white);
  --color-background-alt: var(--color-muted);
  --color-border: var(--color-muted);
  --color-link: var(--color-accent);
  --color-button-primary: var(--color-accent);
  --color-button-primary-text: var(--color-primary);
  --color-nav-bg: var(--color-primary);
  --color-nav-text: var(--color-white);

  /* Interactive states */
  --color-hover: oklch(from var(--color-accent) calc(l * 0.9) c h);
  --color-focus-ring: var(--color-accent);

  /* Font families */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  /* Font sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Font weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Line heights */
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Border radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px oklch(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px oklch(0 0 0 / 0.1);

  /* Container */
  --container-max: 1200px;
  --container-padding: var(--space-6);
}

/* ========================================
   Base Styles
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-4);
  color: var(--color-primary);
  line-height: var(--leading-tight);
}

h1 { font-size: var(--text-4xl); font-weight: var(--font-bold); }
h2 { font-size: var(--text-3xl); font-weight: var(--font-semibold); }
h3 { font-size: var(--text-xl); font-weight: var(--font-semibold); }

p {
  margin: 0 0 var(--space-4);
}

a {
  color: var(--color-link);
  text-decoration: none;

  &:hover {
    text-decoration: underline;
  }
}

/* ========================================
   Utility Classes
   ======================================== */
.text-muted {
  color: var(--color-text-muted);
  opacity: 0.7;
}

/* ========================================
   Navigation
   ======================================== */
.nav {
  background: var(--color-primary);
  color: var(--color-white);
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-white);
  text-decoration: none;

  &:hover {
    color: var(--color-accent);
    text-decoration: none;
  }
}

.nav-links {
  display: flex;
  gap: var(--space-6);
  align-items: center;

  a {
    color: var(--color-white);
    opacity: 0.85;
    text-decoration: none;
    font-weight: var(--font-medium);

    &:hover {
      opacity: 1;
      color: var(--color-accent);
    }
  }
}

/* User Menu Dropdown */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: oklch(from var(--color-primary) calc(l * 1.2) c h);
  border: none;
  border-radius: var(--radius-full);
  color: var(--color-white);
  cursor: pointer;
  transition: background 0.15s ease;

  &:hover, &.user-menu-trigger--open {
    background: oklch(from var(--color-primary) calc(l * 1.4) c h);
  }
}

.user-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  max-width: 28px;
  min-height: 28px;
  max-height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.user-name {
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
}

.dropdown-arrow {
  opacity: 0.7;
  transition: transform 0.15s ease;

  .user-menu-trigger--open & {
    transform: rotate(180deg);
  }
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  width: 240px;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px oklch(0 0 0 / 0.05);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 200;
}

.user-menu-dropdown--open {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

.user-menu-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.user-menu-username {
  display: block;
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

.user-menu-email {
  display: block;
  font-size: var(--text-sm);
  color: oklch(from var(--color-text) l c h / 0.6);
  margin-top: var(--space-1);
}

.user-menu-divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-2) 0;
}

.user-menu-dropdown .user-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: none;
  border: none;
  color: var(--color-black);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: background 0.1s ease;
  text-align: left;

  &:hover {
    background: var(--color-background-alt);
    color: var(--color-black);
    text-decoration: none;
  }

  svg {
    opacity: 0.6;
    color: var(--color-black);
  }

  &.user-menu-item--danger {
    color: oklch(55% 0.2 25);

    svg {
      color: oklch(55% 0.2 25);
    }

    &:hover {
      background: oklch(95% 0.05 25);
    }
  }
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  border: none;

  &:focus-visible {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 2px;
  }
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-primary);

  &:hover {
    background: oklch(from var(--color-accent) calc(l * 0.9) c h);
    text-decoration: none;
  }
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);

  &:hover {
    background: var(--color-primary);
    color: var(--color-white);
    text-decoration: none;
  }
}

.btn-large {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
}

.btn-block {
  width: 100%;
}

/* ========================================
   Form Elements
   ======================================== */
.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-white);
  font-family: inherit;
  font-size: var(--text-base);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;

  &:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px oklch(from var(--color-accent) l c h / 0.2);
  }

  &::placeholder {
    color: oklch(from var(--color-primary) l c h / 0.5);
  }
}

/* ========================================
   Landing Page
   ======================================== */
.landing-page {
  width: 100%;
}

/* Section Base */
.section {
  padding: var(--space-16) var(--container-padding);

  &.alt {
    background: var(--color-background-alt);
  }
}

.section-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto var(--space-12);

  h2 {
    margin-bottom: var(--space-3);
  }
}

.section-subtitle {
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  margin: 0;
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  align-items: center;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-16) var(--container-padding);
  min-height: 80vh;
}

.hero-content {
  max-width: 540px;
}

.hero-title {
  font-size: var(--text-5xl);
  margin-bottom: var(--space-6);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: var(--text-xl);
  color: var(--color-text-muted);
  margin-bottom: var(--space-8);
  line-height: var(--leading-relaxed);
}

.hero-form {
  margin-top: var(--space-8);
}

.signup-form .form-row {
  display: flex;
  gap: var(--space-3);

  .form-input {
    flex: 1;
  }

  .btn {
    white-space: nowrap;
  }
}

.form-note {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  opacity: 0.8;
}

.hero-image {
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-mockup {
  width: 100%;
  max-width: 500px;
  aspect-ratio: 4/3;
  background: var(--color-primary);
  border-radius: var(--radius-xl);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow-lg);
}

.mockup-placeholder {
  text-align: center;
  color: var(--color-white);
  opacity: 0.6;
}

.mockup-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: var(--space-4);
}

/* ========================================
   Partners Section
   ======================================== */
.partners {
  text-align: center;
  padding: var(--space-10) var(--container-padding);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.partners-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-6);
}

.partners-logos {
  display: flex;
  justify-content: center;
  gap: var(--space-10);
  flex-wrap: wrap;
}

.partner-logo {
  color: var(--color-text-muted);
  opacity: 0.5;
  font-size: var(--text-sm);
}

/* ========================================
   Benefits Section
   ======================================== */
.benefits-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
  max-width: var(--container-max);
  margin: 0 auto;
}

.benefit-card {
  background: var(--color-white);
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;

  &:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
  }

  h3 {
    margin-bottom: var(--space-3);
  }

  p {
    color: var(--color-text-muted);
    margin: 0;
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
  }
}

.benefit-icon {
  font-size: 2rem;
  margin-bottom: var(--space-4);
}

/* ========================================
   How It Works Section
   ======================================== */
.how-it-works {
  max-width: var(--container-max);
  margin: 0 auto;
}

.steps {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: var(--space-4);
}

.step {
  flex: 1;
  max-width: 280px;
  text-align: center;
  padding: var(--space-6);

  h3 {
    margin-bottom: var(--space-3);
  }

  p {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin: 0;
  }
}

.step-number {
  width: 48px;
  height: 48px;
  background: var(--color-accent);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  margin: 0 auto var(--space-4);
}

.step-connector {
  width: 60px;
  height: 2px;
  background: var(--color-border);
  margin-top: 24px;
  flex-shrink: 0;
}

/* ========================================
   Pricing Section
   ======================================== */
.pricing-cards {
  display: flex;
  justify-content: center;
  gap: var(--space-8);
  max-width: var(--container-max);
  margin: 0 auto;
}

.pricing-card {
  background: var(--color-white);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 380px;
  text-align: center;

  &.featured {
    border-color: var(--color-accent);
    position: relative;
  }
}

.pricing-badge {
  background: var(--color-accent);
  color: var(--color-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  display: inline-block;
  margin-bottom: var(--space-4);
}

.pricing-amount {
  margin-bottom: var(--space-6);
}

.price {
  font-size: var(--text-5xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
}

.period {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-8);
  text-align: left;

  li {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-muted);

    &::before {
      content: "✓";
      color: var(--color-accent);
      font-weight: var(--font-bold);
      margin-right: var(--space-3);
    }

    &:last-child {
      border-bottom: none;
    }
  }
}

.pricing-note {
  text-align: center;
  margin-top: var(--space-8);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ========================================
   Testimonials Section
   ======================================== */
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
  max-width: var(--container-max);
  margin: 0 auto;
}

.testimonial-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.testimonial-text {
  font-size: var(--text-base);
  font-style: italic;
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  line-height: var(--leading-relaxed);
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.author-avatar {
  width: 48px;
  height: 48px;
  background: var(--color-muted);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.author-info {
  display: flex;
  flex-direction: column;
}

.author-name {
  font-weight: var(--font-semibold);
  color: var(--color-primary);
}

.author-title {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ========================================
   FAQ Section
   ======================================== */
.faq-list {
  max-width: 700px;
  margin: 0 auto;
}

.faq-item {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  overflow: hidden;

  &[open] {
    .faq-question::after {
      transform: rotate(180deg);
    }
  }
}

.faq-question {
  padding: var(--space-5) var(--space-6);
  font-weight: var(--font-semibold);
  color: var(--color-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;

  &::-webkit-details-marker {
    display: none;
  }

  &::after {
    content: "▼";
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    transition: transform 0.2s ease;
  }

  &:hover {
    background: oklch(from var(--color-muted) l c h / 0.3);
  }
}

.faq-answer {
  padding: 0 var(--space-6) var(--space-5);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
  margin: 0;
}

/* ========================================
   Final CTA Section
   ======================================== */
.final-cta {
  background: var(--color-primary);
  text-align: center;
}

.cta-content {
  max-width: 600px;
  margin: 0 auto;

  h2 {
    color: var(--color-white);
    margin-bottom: var(--space-4);
  }

  p {
    color: var(--color-white);
    opacity: 0.85;
    font-size: var(--text-lg);
    margin-bottom: var(--space-8);
  }
}

.cta-buttons {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;

  .btn-secondary {
    border-color: var(--color-white);
    color: var(--color-white);

    &:hover {
      background: var(--color-white);
      color: var(--color-primary);
    }
  }
}

/* ========================================
   Footer
   ======================================== */
.footer {
  background: var(--color-black);
  color: var(--color-white);
  padding: var(--space-12) var(--container-padding) var(--space-8);
}

.footer-content {
  max-width: var(--container-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-10);
}

.footer-brand {
  h3 {
    color: var(--color-white);
    margin-bottom: var(--space-3);
  }

  p {
    color: var(--color-white);
    opacity: 0.7;
    font-size: var(--text-sm);
  }
}

.footer-links {
  h4 {
    color: var(--color-white);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-4);
  }

  ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  li {
    margin-bottom: var(--space-2);
  }

  a {
    color: var(--color-white);
    opacity: 0.7;
    font-size: var(--text-sm);

    &:hover {
      opacity: 1;
      color: var(--color-accent);
    }
  }
}

.footer-bottom {
  max-width: var(--container-max);
  margin: var(--space-10) auto 0;
  padding-top: var(--space-6);
  border-top: 1px solid oklch(from var(--color-white) l c h / 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
  color: var(--color-white);
  opacity: 0.6;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    min-height: auto;
    padding-top: var(--space-12);
    padding-bottom: var(--space-12);
  }

  .hero-content {
    max-width: 600px;
    margin: 0 auto;
  }

  .hero-image {
    order: -1;
  }

  .hero-mockup {
    max-width: 400px;
  }

  .benefits-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .testimonials-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-content {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --text-5xl: 2.5rem;
    --text-4xl: 2rem;
    --text-3xl: 1.5rem;
  }

  .signup-form .form-row {
    flex-direction: column;
  }

  .benefits-grid {
    grid-template-columns: 1fr;
  }

  .steps {
    flex-direction: column;
    align-items: center;
  }

  .step-connector {
    width: 2px;
    height: 40px;
    margin: 0;
  }

  .testimonials-grid {
    grid-template-columns: 1fr;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }
}

/* ========================================
   Main Content Area
   ======================================== */
.main-content {
  min-height: calc(100vh - 200px);
  padding: var(--space-8) var(--container-padding);
  max-width: var(--container-max);
  margin: 0 auto;
}

/* ========================================
   Page Headers
   ======================================== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
  gap: var(--space-4);

  h1 {
    margin-bottom: 0;
  }
}

.page-header-content {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.page-header-actions {
  display: flex;
  gap: var(--space-3);
}

.page-subtitle {
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  margin: 0;
}

/* ========================================
   Flash Messages
   ======================================== */
.flash-container {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: 100%;
  max-width: 500px;
  padding: 0 var(--space-4);
}

.flash {
  background: var(--color-primary);
  color: var(--color-white);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-lg);
  animation: slideDown 0.3s ease;
}

.flash-notice {
  background: #059669;
}

.flash-alert {
  background: #dc2626;
}

.flash-close {
  background: none;
  border: none;
  color: inherit;
  font-size: var(--text-xl);
  cursor: pointer;
  opacity: 0.7;

  &:hover {
    opacity: 1;
  }
}

.flash--dismissing {
  animation: slideUp 0.3s ease forwards;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* ========================================
   Auth Pages
   ======================================== */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.auth-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  width: 100%;
  max-width: 420px;

  h1 {
    text-align: center;
    margin-bottom: var(--space-2);
  }
}

.auth-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: var(--space-8);
}

.auth-form {
  .form-group {
    margin-bottom: var(--space-5);
  }

  label {
    display: block;
    font-weight: var(--font-medium);
    margin-bottom: var(--space-2);
    color: var(--color-primary);
  }
}

.form-errors {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);

  p {
    margin: 0;
    font-size: var(--text-sm);

    & + p {
      margin-top: var(--space-2);
    }
  }
}

.form-hint {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

.form-actions {
  margin-top: var(--space-6);
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);

  p {
    margin: 0;
    color: var(--color-text-muted);
  }
}

/* ========================================
   Crate Grid & Cards
   ======================================== */
.crate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-6);
}

.crate-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;

  &:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
  }
}

.crate-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.crate-card-cover {
  aspect-ratio: 1;
  background: var(--color-muted);
  overflow: hidden;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.crate-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: var(--color-text-muted);
  opacity: 0.3;
}

.crate-card-info {
  padding: var(--space-4);
}

.crate-card-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  margin: 0 0 var(--space-1);
  color: var(--color-primary);
}

.crate-card-author {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-2);
}

.crate-card-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
}

/* ========================================
   Crate Detail View
   ======================================== */
.crate-detail {
  max-width: 900px;
  margin: 0 auto;
}

.crate-header {
  display: flex;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}

.crate-cover {
  flex-shrink: 0;
  width: 250px;
  height: 250px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-muted);
}

.crate-cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.crate-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  color: var(--color-text-muted);
  opacity: 0.3;
}

.crate-info {
  flex: 1;
}

.crate-title {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-2);
}

.crate-author {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.crate-description {
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-4);
}

.crate-meta {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.crate-actions {
  margin-top: var(--space-6);
}

.btn-play-crate {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-lg);
}

.btn-play-icon {
  font-size: var(--text-base);
}

/* ========================================
   Share Modal
   ======================================== */
.share-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
}

.share-modal--open {
  opacity: 1;
  visibility: visible;
}

.share-modal-backdrop {
  position: absolute;
  inset: 0;
  background: oklch(0 0 0 / 0.5);
}

.share-modal-content {
  position: relative;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  margin: var(--space-4);
  box-shadow: var(--shadow-lg);
  transform: translateY(10px);
  transition: transform 0.2s ease;

  .share-modal--open & {
    transform: translateY(0);
  }
}

.share-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);

  h3 {
    margin: 0;
    font-size: var(--text-lg);
  }
}

.share-modal-close {
  background: none;
  border: none;
  font-size: var(--text-2xl);
  color: var(--color-text-muted);
  cursor: pointer;
  padding: var(--space-2);
  line-height: 1;

  &:hover {
    color: var(--color-text);
  }
}

.share-modal-body {
  padding: var(--space-6);
}

.share-section {
  margin-bottom: var(--space-6);

  &:last-child {
    margin-bottom: 0;
  }
}

.share-label {
  display: block;
  font-weight: var(--font-semibold);
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.share-hint {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-3);
}

.share-input-group {
  display: flex;
  gap: var(--space-2);
}

.share-input {
  flex: 1;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--color-background-alt);
  color: var(--color-text);
}

.share-textarea {
  resize: none;
  min-height: 80px;
}

.share-preview {
  background: var(--color-background-alt);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  margin-top: var(--space-4);

  .share-label {
    margin-bottom: var(--space-3);
  }

  iframe {
    border-radius: var(--radius-md);
  }
}

.crate-status {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  text-transform: uppercase;

  &.published {
    background: #dcfce7;
    color: #059669;
  }

  &.draft {
    background: #fef3c7;
    color: #d97706;
  }
}

/* ========================================
   Track List
   ======================================== */
.track-list {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.track-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.15s ease;

  &:last-child {
    border-bottom: none;
  }

  &:hover {
    background: var(--color-background-alt);
  }

  &.track-item--active {
    background: oklch(from var(--color-accent) l c h / 0.1);
  }
}

.track-number {
  width: 30px;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.track-artwork {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-muted);
  flex-shrink: 0;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.track-info {
  flex: 1;
  min-width: 0;
}

.track-title {
  display: block;
  font-weight: var(--font-medium);
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-duration {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.track-actions {
  display: flex;
  gap: var(--space-2);
}

/* ========================================
   My Crates Dashboard
   ======================================== */
.my-crates-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.my-crate-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.my-crate-cover {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-muted);
  flex-shrink: 0;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.my-crate-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--color-text-muted);
  opacity: 0.3;
}

.my-crate-info {
  flex: 1;

  h3 {
    margin: 0 0 var(--space-2);

    a {
      color: var(--color-primary);
    }
  }
}

.my-crate-meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.my-crate-status {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);

  &.published {
    background: #dcfce7;
    color: #059669;
  }

  &.draft {
    background: #fef3c7;
    color: #d97706;
  }
}

.my-crate-actions {
  display: flex;
  gap: var(--space-2);
}

/* ========================================
   Forms
   ======================================== */
.form-container {
  max-width: 600px;
}

.form-group {
  margin-bottom: var(--space-5);

  label {
    display: block;
    font-weight: var(--font-medium);
    margin-bottom: var(--space-2);
    color: var(--color-primary);
  }

  textarea.form-input {
    resize: vertical;
    min-height: 100px;
  }
}

.form-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;

  .form-input {
    flex: 1;
  }
}

.danger-zone {
  margin-top: var(--space-10);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);

  h3 {
    color: #dc2626;
    margin-bottom: var(--space-4);
  }
}

.btn-danger {
  background: #dc2626;
  color: var(--color-white);

  &:hover {
    background: #b91c1c;
  }
}

.btn-small {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

/* ========================================
   Manage Tracks
   ======================================== */
.manage-tracks {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-8);
}

.add-track-section,
.track-list-section {
  h2 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-4);
  }
}

.add-track-form {
  background: var(--color-background-alt);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
}

.editable-track-list {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.editable-track-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);

  &:last-child {
    border-bottom: none;
  }

  &.sortable-dragging {
    opacity: 0.5;
    background: var(--color-background-alt);
  }
}

.track-drag-handle {
  cursor: grab;
  color: var(--color-text-muted);
  padding: var(--space-2);

  &:active {
    cursor: grabbing;
  }
}

.track-artwork-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--color-text-muted);
  opacity: 0.3;
}

/* ========================================
   User Profile
   ======================================== */
.user-profile {
  max-width: 900px;
  margin: 0 auto;
}

.user-header {
  display: flex;
  gap: var(--space-6);
  margin-bottom: var(--space-10);
}

.user-avatar {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-avatar-placeholder {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
}

.user-info {
  flex: 1;
}

.user-display-name {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-1);
}

.user-username {
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.user-bio {
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-3);
}

.user-website {
  margin: 0;
}

.user-crates h2 {
  margin-bottom: var(--space-6);
}

/* ========================================
   Discover & Search
   ======================================== */
.discover-section {
  margin-bottom: var(--space-12);
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);

  h2 {
    margin: 0;
  }
}

.view-all-link {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

.search-form-container {
  max-width: 600px;
  margin: 0 auto var(--space-8);
}

.search-form {
  .search-input-row {
    display: flex;
    gap: var(--space-3);
  }

  .search-input {
    flex: 1;
    font-size: var(--text-lg);
    padding: var(--space-4) var(--space-5);
  }
}

.search-results-count {
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

/* ========================================
   Empty States
   ======================================== */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--color-text-muted);

  h2 {
    color: var(--color-primary);
    margin-bottom: var(--space-3);
  }

  p {
    margin-bottom: var(--space-6);
  }
}

/* ========================================
   Audio Player
   ======================================== */
.player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-primary);
  color: var(--color-white);
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  z-index: 1000;
  box-shadow: 0 -4px 20px oklch(0 0 0 / 0.2);
  transition: transform 0.3s ease;
}

.player--hidden {
  transform: translateY(100%);
}

.player-track-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 200px;
}

.player-artwork {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: oklch(from var(--color-white) l c h / 0.1);
  flex-shrink: 0;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.player-artwork-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  opacity: 0.5;
}

.player-text {
  min-width: 0;
}

.player-title {
  display: block;
  font-weight: var(--font-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-artist {
  display: block;
  font-size: var(--text-sm);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.player-btn {
  background: none;
  border: none;
  color: var(--color-white);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;

  &:hover {
    background: oklch(from var(--color-white) l c h / 0.1);
  }
}

.player-btn-play {
  width: 44px;
  height: 44px;
  background: var(--color-accent);
  color: var(--color-primary);
  border-radius: var(--radius-full);

  &:hover {
    background: oklch(from var(--color-accent) calc(l * 0.9) c h);
  }
}

.player-icon {
  font-size: var(--text-lg);
}

.player-progress-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.player-time {
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
  min-width: 40px;
}

.player-time-current {
  text-align: right;
}

.player-progress {
  flex: 1;
  height: 6px;
  background: oklch(from var(--color-white) l c h / 0.2);
  border-radius: var(--radius-full);
  cursor: pointer;
  position: relative;
}

.player-progress-bar {
  height: 100%;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.1s linear;
}

.player-volume {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.player-volume-slider {
  width: 80px;
  height: 4px;
  appearance: none;
  background: oklch(from var(--color-white) l c h / 0.2);
  border-radius: var(--radius-full);
  cursor: pointer;

  &::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--color-white);
    border-radius: var(--radius-full);
    cursor: pointer;
  }
}

.player-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.player-btn-buy {
  background: var(--color-accent);
  color: var(--color-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;

  &:hover {
    background: oklch(from var(--color-accent) calc(l * 0.9) c h);
    text-decoration: none;
  }
}

.player-btn-close {
  opacity: 0.7;

  &:hover {
    opacity: 1;
  }
}

/* Add padding to body when player is visible */
body.has-player {
  padding-bottom: 80px;
}

/* ========================================
   Form Validation
   ======================================== */
.form-input--invalid {
  border-color: #dc2626;

  &:focus {
    box-shadow: 0 0 0 3px oklch(from #dc2626 l c h / 0.2);
  }
}

/* ========================================
   Profile Edit
   ======================================== */
.profile-edit {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-4);
}

.profile-edit-header {
  margin-bottom: var(--space-8);

  h1 {
    margin-bottom: var(--space-2);
  }

  p {
    color: oklch(from var(--color-text) l c h / 0.6);
  }
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.profile-form-section {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);

  h2 {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
  }

  .form-group {
    margin-bottom: var(--space-5);

    &:last-child {
      margin-bottom: 0;
    }
  }
}

.form-static {
  padding: var(--space-3) var(--space-4);
  background: var(--color-background-alt);
  border-radius: var(--radius-md);
  color: oklch(from var(--color-text) l c h / 0.7);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-base);
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;

  &:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px oklch(from var(--color-accent) l c h / 0.15);
  }
}

.form-hint {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: oklch(from var(--color-text) l c h / 0.5);
}

.profile-form-actions {
  display: flex;
  gap: var(--space-4);
  padding-top: var(--space-4);
}

/* ========================================
   Responsive - Player
   ======================================== */
@media (max-width: 768px) {
  .player {
    flex-wrap: wrap;
    padding: var(--space-3) var(--space-4);
    gap: var(--space-3);
  }

  .player-track-info {
    min-width: auto;
    flex: 1;
  }

  .player-progress-container {
    order: 10;
    width: 100%;
    flex-basis: 100%;
  }

  .player-volume {
    display: none;
  }

  .manage-tracks {
    grid-template-columns: 1fr;
  }

  .crate-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .crate-meta {
    justify-content: center;
  }

  .user-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}
