/* Quetzal Web - Main Stylesheet */
/* Following STYLEGUIDE.md specifications */

/* ============================================
   CSS Variables (Design Tokens)
   ============================================ */
:root {
  /* Primary Colors */
  --color-primary: #4CAF50;
  --color-primary-light: #7ED321;
  --color-primary-dark: #2ECC71;

  /* Secondary Colors */
  --color-secondary: #1ABC9C;
  --color-secondary-light: #00BCD4;
  --color-secondary-dark: #2980B9;

  /* Accent Colors */
  --color-accent-red: #E53935;
  --color-accent-red-dark: #C0392B;
  --color-accent-orange: #F39C12;

  /* Neutral Colors */
  --color-text-primary: #1A365D;
  --color-text-secondary: #475569;
  --color-text-muted: #94A3B8;
  --color-border: #E2E8F0;
  --color-background: #F8FAFC;
  --color-surface: #FFFFFF;

  /* Semantic Colors */
  --color-success: #4CAF50;
  --color-warning: #F39C12;
  --color-error: #E53935;
  --color-info: #2980B9;

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Poppins', var(--font-primary);
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Border Radius */
  --rounded-sm: 4px;
  --rounded: 8px;
  --rounded-lg: 12px;
  --rounded-xl: 16px;
  --rounded-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(26, 54, 93, 0.05);
  --shadow: 0 1px 3px 0 rgba(26, 54, 93, 0.1), 0 1px 2px -1px rgba(26, 54, 93, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(26, 54, 93, 0.1), 0 2px 4px -2px rgba(26, 54, 93, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(26, 54, 93, 0.1), 0 4px 6px -4px rgba(26, 54, 93, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(26, 54, 93, 0.1), 0 8px 10px -6px rgba(26, 54, 93, 0.1);

  /* Animation */
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;

  /* Layout */
  --max-width: 1280px;
  --header-height: 72px;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-primary);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text-primary);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color var(--duration-normal) var(--ease-in-out);
}

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

ul, ol {
  list-style: none;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text-primary);
}

h1 {
  font-size: 3rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 2.25rem;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: var(--space-4);
  color: var(--color-text-secondary);
}

.lead {
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--color-text-secondary);
}

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

.text-center {
  text-align: center;
}

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

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

/* ============================================
   Layout & Container
   ============================================ */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-8);
  }
}

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

.section-sm {
  padding: var(--space-12) 0;
}

.section-lg {
  padding: calc(var(--space-16) * 1.5) 0;
}

/* ============================================
   Header & Navigation
   ============================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  z-index: 1000;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

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

.logo img {
  height: 40px;
  width: auto;
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.nav {
  display: none;
  align-items: center;
  gap: var(--space-8);
}

@media (min-width: 768px) {
  .nav {
    display: flex;
  }
}

.nav-link {
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: color var(--duration-normal) var(--ease-in-out);
}

.nav-link:hover {
  color: var(--color-primary);
}

.nav-link.active {
  color: var(--color-primary);
}

.nav-cta {
  margin-left: var(--space-4);
}

/* Mobile Menu */
.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
}

@media (min-width: 768px) {
  .menu-toggle {
    display: none;
  }
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text-primary);
  transition: all var(--duration-normal) var(--ease-in-out);
}

.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-4);
  box-shadow: var(--shadow-lg);
}

.mobile-nav.active {
  display: block;
}

.mobile-nav-link {
  display: block;
  padding: var(--space-3) 0;
  font-weight: 500;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}

.mobile-nav-link:last-of-type {
  border-bottom: none;
}

.mobile-auth-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.nav-auth {
  margin-left: var(--space-2);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  border-radius: var(--rounded);
  border: none;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-in-out);
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--color-primary-dark);
  color: white;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--color-primary);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-primary);
}

.btn-ghost:hover {
  background: var(--color-border);
}

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

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: 0.875rem;
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--color-surface);
  border-radius: var(--rounded-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  transition: all var(--duration-normal) var(--ease-in-out);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-elevated {
  box-shadow: var(--shadow-lg);
  border: none;
}

.card-elevated:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}

.card-header {
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.card-description {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  padding-top: var(--header-height);
  background: linear-gradient(135deg, var(--color-background) 0%, #E8F5E9 100%);
  overflow: hidden;
}

.hero-content {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero-logo {
  width: 120px;
  height: auto;
  margin: 0 auto var(--space-8);
}

@media (min-width: 768px) {
  .hero-logo {
    width: 160px;
  }
}

.hero-title {
  font-size: 2.5rem;
  margin-bottom: var(--space-6);
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 3.5rem;
  }
}

@media (min-width: 1024px) {
  .hero-title {
    font-size: 4rem;
  }
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-8);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 768px) {
  .hero-subtitle {
    font-size: 1.25rem;
  }
}

.hero-cta {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  justify-content: center;
  align-items: center;
}

@media (min-width: 640px) {
  .hero-cta {
    flex-direction: row;
  }
}

/* ============================================
   Code Blocks
   ============================================ */
.code-block {
  background: var(--color-text-primary);
  border-radius: var(--rounded-lg);
  padding: var(--space-4);
  overflow-x: auto;
  margin: var(--space-4) 0;
}

.code-block pre {
  margin: 0;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: #E2E8F0;
  line-height: 1.6;
}

.code-inline {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: rgba(76, 175, 80, 0.1);
  color: var(--color-primary);
  padding: 2px 6px;
  border-radius: var(--rounded-sm);
}

/* Syntax Highlighting */
.code-block .comment { color: #718096; }
.code-block .string { color: #68D391; }
.code-block .keyword { color: #63B3ED; }
.code-block .function { color: #F6E05E; }
.code-block .number { color: #FC8181; }

/* ============================================
   Grid & Flexbox Utilities
   ============================================ */
.grid {
  display: grid;
  gap: var(--space-6);
}

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

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

@media (min-width: 640px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

@media (min-width: 640px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.flex {
  display: flex;
}

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

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  flex-direction: column;
}

.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ============================================
   Tables
   ============================================ */
.table-wrapper {
  overflow-x: auto;
  margin: var(--space-6) 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.table th {
  font-weight: 600;
  color: var(--color-text-primary);
  background: var(--color-background);
}

.table tbody tr:hover {
  background: var(--color-background);
}

.table-striped tbody tr:nth-child(even) {
  background: var(--color-background);
}

/* ============================================
   Forms
   ============================================ */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-primary);
  font-size: 1rem;
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--rounded);
  transition: all var(--duration-normal) var(--ease-in-out);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

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

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

/* ============================================
   Badges & Tags
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--rounded-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background: rgba(76, 175, 80, 0.1);
  color: var(--color-primary);
}

.badge-secondary {
  background: rgba(26, 188, 156, 0.1);
  color: var(--color-secondary);
}

.badge-success {
  background: rgba(76, 175, 80, 0.1);
  color: var(--color-success);
}

.badge-warning {
  background: rgba(243, 156, 18, 0.1);
  color: var(--color-warning);
}

.badge-error {
  background: rgba(229, 57, 53, 0.1);
  color: var(--color-error);
}

/* ============================================
   Feature Icons
   ============================================ */
.feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
  border-radius: var(--rounded-lg);
  margin-bottom: var(--space-4);
  color: white;
  font-size: 1.5rem;
}

.feature-icon-lg {
  width: 64px;
  height: 64px;
  font-size: 2rem;
}

/* ============================================
   Pricing Cards
   ============================================ */
.pricing-card {
  text-align: center;
  padding: var(--space-8);
}

.pricing-card.featured {
  border: 2px solid var(--color-primary);
  position: relative;
}

.pricing-card.featured::before {
  content: 'Popular';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--color-primary);
  color: white;
  padding: var(--space-1) var(--space-4);
  border-radius: var(--rounded-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.pricing-amount {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.pricing-period {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.pricing-features {
  margin: var(--space-6) 0;
  text-align: left;
}

.pricing-features li {
  padding: var(--space-2) 0;
  color: var(--color-text-secondary);
}

.pricing-features li::before {
  content: '✓';
  color: var(--color-primary);
  font-weight: 700;
  margin-right: var(--space-2);
}

/* ============================================
   Comparison Table
   ============================================ */
.comparison-table th,
.comparison-table td {
  text-align: center;
}

.comparison-table td:first-child {
  text-align: left;
  font-weight: 500;
}

.comparison-highlight {
  background: rgba(76, 175, 80, 0.05);
}

.comparison-savings {
  color: var(--color-primary);
  font-weight: 700;
}

/* ============================================
   FAQ Section
   ============================================ */
.faq-item {
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-4) 0;
}

.faq-question {
  font-weight: 600;
  color: var(--color-text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-question::after {
  content: '+';
  font-size: 1.5rem;
  color: var(--color-text-muted);
  transition: transform var(--duration-normal) var(--ease-in-out);
}

.faq-item.active .faq-question::after {
  transform: rotate(45deg);
}

.faq-answer {
  display: none;
  padding-top: var(--space-4);
  color: var(--color-text-secondary);
}

.faq-item.active .faq-answer {
  display: block;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  background: var(--color-text-primary);
  color: white;
  padding: var(--space-12) 0 var(--space-6);
}

.footer-grid {
  display: grid;
  gap: var(--space-8);
  grid-template-columns: 1fr;
  margin-bottom: var(--space-8);
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.footer-brand {
  max-width: 300px;
}

.footer-brand .logo {
  margin-bottom: var(--space-4);
}

.footer-brand .logo img {
  height: 32px;
  filter: brightness(0) invert(1);
}

.footer-brand p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  margin-bottom: 0;
}

.footer-heading {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-4);
  color: rgba(255, 255, 255, 0.5);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-link {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  transition: color var(--duration-normal) var(--ease-in-out);
}

.footer-link:hover {
  color: white;
}

.footer-bottom {
  padding-top: var(--space-6);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: center;
  text-align: center;
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.footer-bottom p {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.875rem;
  margin: 0;
}

/* ============================================
   CTA Section
   ============================================ */
.cta-section {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: white;
  text-align: center;
  padding: var(--space-16) 0;
}

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

.cta-section p {
  color: rgba(255, 255, 255, 0.9);
  max-width: 600px;
  margin: 0 auto var(--space-8);
}

.cta-section .btn-primary {
  background: white;
  color: var(--color-primary);
}

.cta-section .btn-primary:hover {
  background: var(--color-background);
  transform: translateY(-2px);
}

.cta-section .btn-secondary {
  border-color: white;
  color: white;
}

.cta-section .btn-secondary:hover {
  background: white;
  color: var(--color-primary);
}

/* ============================================
   Product Cards
   ============================================ */
.product-card {
  position: relative;
  padding: var(--space-8);
}

.product-card .badge {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
}

.product-card h3 {
  margin-bottom: var(--space-2);
}

.product-card .description {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
}

.product-card ul {
  margin-bottom: var(--space-6);
}

.product-card li {
  padding: var(--space-2) 0;
  color: var(--color-text-secondary);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.product-card li::before {
  content: '✓';
  color: var(--color-primary);
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================
   Diagram / Flow
   ============================================ */
.flow-diagram {
  background: var(--color-text-primary);
  border-radius: var(--rounded-lg);
  padding: var(--space-6);
  margin: var(--space-6) 0;
  overflow-x: auto;
}

.flow-diagram pre {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #E2E8F0;
  line-height: 1.5;
  margin: 0;
  white-space: pre;
}

@media (min-width: 768px) {
  .flow-diagram pre {
    font-size: 0.875rem;
  }
}

/* ============================================
   Page Headers
   ============================================ */
.page-header {
  padding-top: calc(var(--header-height) + var(--space-12));
  padding-bottom: var(--space-12);
  text-align: center;
  background: linear-gradient(135deg, var(--color-background) 0%, #E8F5E9 100%);
}

.page-header h1 {
  margin-bottom: var(--space-4);
}

.page-header .lead {
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn var(--duration-slow) var(--ease-out) forwards;
}

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

.slide-up {
  animation: slideUp var(--duration-slow) var(--ease-out) forwards;
}

/* ============================================
   Utility Classes
   ============================================ */
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }

.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }

.pt-header { padding-top: var(--header-height); }

.hidden { display: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
