/**
 * FamilyTable Design System - Base Styles
 * ========================================
 * Single source of truth for all design tokens, typography, and common components.
 * Include this file in all templates via: <link rel="stylesheet" href="/static/css/base.css">
 */

/* ==========================================================================
   Design Tokens (CSS Variables)
   ========================================================================== */

:root {
  /* Colors - Core Palette */
  --background: #fffbf5;
  --foreground: #3d2817;
  --card: #ffffff;
  --primary: #e8590c;
  --primary-foreground: #ffffff;
  --secondary: #fff4e6;
  --secondary-foreground: #3d2817;
  --muted: #fef3e8;
  --muted-foreground: #8b6f47;
  --border: rgba(232, 89, 12, 0.15);
  
  /* Extended Colors */
  --input-background: #fef9f3;
  --destructive: #dc2626;
  --destructive-foreground: #ffffff;
  --accent: #ffedd5;
  
  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-size-base: 1rem;
  --line-height-base: 1.5;
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

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

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  background-color: var(--background);
  color: var(--foreground);
}

/* ==========================================================================
   Typography Scale
   ========================================================================== */

/* Page Titles (h1) */
h1 {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.3;
}

@media (min-width: 768px) {
  h1 {
    font-size: 2.25rem;
  }
}

/* Section Headings (h2) */
h2 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
}

@media (min-width: 768px) {
  h2 {
    font-size: 1.5rem;
  }
}

/* Subheadings (h3) */
h3 {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
}

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

/* Body Text */
p {
  font-size: 1rem;
  line-height: 1.7;
}

/* Hero Typography (for landing/welcome pages) */
.text-hero {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.text-hero-sub {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   Form Elements
   ========================================================================== */

input, textarea, select {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  font-family: inherit;
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

label {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, #e8590c 0%, #f97316 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(232, 89, 12, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(232, 89, 12, 0.4);
}

/* Secondary Button */
.btn-secondary {
  background-color: var(--secondary);
  color: var(--foreground);
}

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

/* Outline Button */
.btn-outline {
  background-color: transparent;
  border: 2px solid var(--border);
  color: var(--foreground);
}

.btn-outline:hover {
  background-color: var(--muted);
}

/* Destructive Button */
.btn-destructive {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
}

.btn-destructive:hover {
  opacity: 0.9;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(61, 40, 23, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(61, 40, 23, 0.08);
}

@media (min-width: 768px) {
  .card {
    padding: 2rem;
  }
}

/* Feature Card (for landing/about pages) */
.feature-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid rgba(232, 89, 12, 0.1);
  box-shadow: 0 4px 20px rgba(61, 40, 23, 0.06);
  transition: all 0.5s ease;
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(232, 89, 12, 0.12);
}

@media (min-width: 768px) {
  .feature-card {
    padding: 2rem;
  }
}

/* Content Card (for support/about pages) */
.content-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(61, 40, 23, 0.04);
}

@media (min-width: 768px) {
  .content-card {
    padding: 2rem;
  }
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.badge-secondary {
  background-color: rgba(255, 244, 230, 0.5);
  color: var(--muted-foreground);
}

.badge-unified {
  background-color: rgba(255, 244, 230, 0.8);
  border: 1px solid var(--border);
  color: var(--secondary-foreground);
}

/* ==========================================================================
   Back Link
   ========================================================================== */

.back-link {
  color: var(--muted-foreground);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s ease;
  font-size: 0.875rem;
}

@media (min-width: 768px) {
  .back-link {
    font-size: 1rem;
  }
}

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

.back-link svg {
  transition: transform 0.2s ease;
}

.back-link:hover svg {
  transform: translateX(-4px);
}

/* ==========================================================================
   Animations
   ========================================================================== */

/* Fade In */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Keyframe Animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, #e8590c 0%, #f97316 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Text Colors */
.text-muted {
  color: var(--muted-foreground);
}

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

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

/* Background Colors */
.bg-muted {
  background-color: var(--muted);
}

.bg-secondary {
  background-color: var(--secondary);
}

/* ==========================================================================
   Recipe Card (Dashboard, Circle Detail, Favourites)
   ========================================================================== */

.recipe-card {
  transition: all 0.2s ease;
}

.recipe-card:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 25px -5px rgba(232, 89, 12, 0.1), 0 8px 10px -6px rgba(232, 89, 12, 0.1);
  border-color: rgba(232, 89, 12, 0.3);
}

.recipe-card:hover h3 {
  color: var(--primary);
}

.recipe-card img {
  transition: transform 0.3s ease;
}

.recipe-card:hover img {
  transform: scale(1.05);
}

/* ==========================================================================
   Circle Card (Circles List)
   ========================================================================== */

.circle-card {
  transition: all 0.2s ease;
}

.circle-card:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 25px -5px rgba(232, 89, 12, 0.1), 0 8px 10px -6px rgba(232, 89, 12, 0.1);
  border-color: rgba(232, 89, 12, 0.3);
}

.circle-card:hover h2 {
  color: var(--primary);
}

.circle-card .circle-icon {
  transition: background-color 0.2s ease;
}

.circle-card:hover .circle-icon {
  background-color: rgba(232, 89, 12, 0.2);
}

/* ==========================================================================
   Header Styles
   ========================================================================== */

.header-sticky {
  background-color: rgba(255, 251, 245, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

/* ==========================================================================
   Footer Link Styles (Landing page)
   ========================================================================== */

.footer-link {
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* ==========================================================================
   CTA Button (Landing page hero)
   ========================================================================== */

.cta-btn {
  background: linear-gradient(135deg, #e8590c 0%, #f97316 100%);
  color: white;
  font-weight: 600;
  padding: 1.25rem 2.5rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(232, 89, 12, 0.35);
  transition: all 0.3s ease;
  font-size: 1.125rem;
}

.cta-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 32px rgba(232, 89, 12, 0.45);
}

.cta-btn svg {
  transition: transform 0.3s ease;
}

.cta-btn:hover svg {
  transform: translateX(4px);
}

