/* ==========================================================================
   Hearth & Hygge — Design System
   A warm, family-oriented design system for a European cookbook PWA.
   ========================================================================== */

/* ==========================================================================
   CSS CUSTOM PROPERTIES
   ========================================================================== */

:root {
    /* Core Palette */
    --bg-page: #F5F0E8;
    --bg-card: #FAF6F0;
    --bg-card-hover: #FFFFFF;
    --bg-nav: #3E2723;
    --bg-footer: #3E2723;
    --bg-input: #FFFFFF;
    --bg-code: #F5F0E8;

    /* Text Colors */
    --text-primary: #3E2723;
    --text-secondary: #5D4037;
    --text-muted: #8D6E63;
    --text-inverse: #FAF6F0;
    --text-link: #C75B39;

    /* Accent Colors */
    --terracotta: #C75B39;
    --terracotta-dark: #A4472B;
    --terracotta-light: #E8845F;
    --gold: #D4A017;
    --gold-dark: #B8860B;
    --gold-light: #F0D060;
    --sage: #7C9A6E;
    --sage-dark: #5C7A4E;

    /* Borders */
    --border-light: #E0D5C5;
    --border-medium: #C9B99A;
    --border-dark: #8D6E63;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(62, 39, 35, 0.08);
    --shadow-md: 0 4px 12px rgba(62, 39, 35, 0.12);
    --shadow-lg: 0 8px 24px rgba(62, 39, 35, 0.16);
    --shadow-card: 0 2px 8px rgba(62, 39, 35, 0.1);

    /* Typography */
    --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-body: 'Lora', Georgia, serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

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

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;

    /* Layout */
    --max-width: 1280px;
    --nav-height: 64px;

    /* Region accent (overridden per region) */
    --region-primary: var(--terracotta);
    --region-secondary: var(--gold);
}


/* ==========================================================================
   RESET & BASE
   ========================================================================== */

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

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

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background-color: var(--bg-page);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

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

a:hover {
    color: var(--terracotta-dark);
}


/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: var(--space-md);
}

h1 { font-size: 2.5rem; font-weight: 700; }
h2 { font-size: 2rem; font-weight: 600; }
h3 { font-size: 1.5rem; font-weight: 600; }
h4 { font-size: 1.25rem; font-weight: 600; }

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

.mono, .measurement {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

@media (max-width: 768px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}


/* ==========================================================================
   NAVIGATION
   ========================================================================== */

.main-nav {
    background: var(--bg-nav);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--nav-height);
    display: flex;
    align-items: center;
}

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

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--text-inverse);
    flex-shrink: 0;
}

.nav-logo-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: inline-block;
    border-radius: var(--radius-sm);
}

.nav-logo-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.nav-logo-text {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-inverse);
}

.nav-logo:hover {
    color: var(--text-inverse);
    opacity: 0.9;
}

/* Hamburger Toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
    z-index: 1001;
}

.hamburger,
.hamburger::before,
.hamburger::after {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-inverse);
    border-radius: 2px;
    transition: all var(--transition-normal);
}

.hamburger {
    position: relative;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
}

.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }

/* Hamburger to X animation */
.nav-toggle[aria-expanded="true"] .hamburger {
    background: transparent;
}

.nav-toggle[aria-expanded="true"] .hamburger::before {
    top: 0;
    transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .hamburger::after {
    top: 0;
    transform: rotate(-45deg);
}

/* Nav Menu */
.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    height: 100%;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    height: 100%;
}

.nav-link {
    color: var(--text-inverse);
    font-size: 0.9rem;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast), color var(--transition-fast);
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-inverse);
}

.nav-link-admin {
    color: var(--gold-light);
}

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

/* Nav Auth Section */
.nav-auth {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.nav-user {
    color: var(--text-inverse);
    font-size: 0.85rem;
    opacity: 0.8;
    padding: var(--space-sm);
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--terracotta);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    padding: 0 4px;
    margin-left: 2px;
    line-height: 1;
}

.nav-logout-form {
    display: inline;
}

.nav-logout-btn {
    background: none;
    border: none;
    font-family: var(--font-body);
    cursor: pointer;
}

/* Region Dropdown */
.nav-dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-dropdown-toggle {
    background: none;
    border: none;
    font-family: var(--font-body);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.caret {
    font-size: 0.7em;
    transition: transform var(--transition-fast);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1001;
}

.nav-dropdown-menu.nav-dropdown-open {
    display: block;
}

.nav-dropdown-item {
    display: block;
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: background var(--transition-fast);
}

.nav-dropdown-item:hover {
    background: var(--bg-page);
    color: var(--terracotta);
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: var(--bg-nav);
        flex-direction: column;
        align-items: stretch;
        padding: var(--space-md);
        gap: var(--space-sm);
        box-shadow: var(--shadow-lg);
        height: auto;
    }

    .nav-menu.nav-menu-open {
        display: flex;
    }

    .nav-links {
        flex-direction: column;
        align-items: stretch;
        height: auto;
    }

    .nav-link {
        padding: var(--space-md);
    }

    .nav-auth {
        flex-direction: column;
        align-items: stretch;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: var(--space-md);
    }

    .nav-user {
        padding: var(--space-sm) var(--space-md);
    }

    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        background: rgba(255, 255, 255, 0.05);
        border-radius: var(--radius-sm);
    }

    .nav-dropdown-item {
        color: var(--text-inverse);
        padding: var(--space-sm) var(--space-lg);
    }

    .nav-dropdown-item:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--text-inverse);
    }
}

/* Prevent scroll when nav is open on mobile */
body.nav-open {
    overflow: hidden;
}

@media (min-width: 769px) {
    body.nav-open {
        overflow: auto;
    }
}


/* ==========================================================================
   MAIN CONTENT
   ========================================================================== */

.main-content {
    flex: 1;
    padding: var(--space-lg) 0;
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}


/* ==========================================================================
   CARDS
   ========================================================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    overflow: hidden;
}

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


/* ==========================================================================
   RECIPE CARD
   ========================================================================== */

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

.recipe-card:hover {
    color: inherit;
}

.recipe-card-image {
    aspect-ratio: 16 / 10;
    object-fit: cover;
    width: 100%;
}

.recipe-card-image-placeholder {
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, var(--bg-page), var(--border-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.recipe-card-body {
    padding: var(--space-lg);
}

.recipe-card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.recipe-card-original-name {
    font-style: italic;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.recipe-card-meta {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.recipe-card-time {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.recipe-card-difficulty {
    letter-spacing: 0.1em;
}


/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    line-height: 1.4;
}

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

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

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

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

.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: white;
    font-weight: 600;
}

.btn-gold:hover {
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
}

.btn-danger {
    background: #C62828;
    color: white;
}

.btn-danger:hover {
    background: #A62020;
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1.1rem;
}


/* ==========================================================================
   BADGES / PILLS
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

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

.badge-category {
    background: var(--bg-page);
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
}

.badge-national {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: white;
    font-weight: 600;
    animation: national-shimmer 3s ease-in-out infinite;
}

@keyframes national-shimmer {
    0%, 100% { box-shadow: 0 0 0 rgba(212, 160, 23, 0); }
    50% { box-shadow: 0 0 12px rgba(212, 160, 23, 0.4); }
}

.badge-active {
    background: #E8F5E9;
    color: #2E7D32;
}

.badge-used {
    background: #ECEFF1;
    color: #607D8B;
}

.badge-expired {
    background: #FFF8E1;
    color: #F57F17;
}

/* RSVP badge colors */
.badge-rsvp-accepted {
    background: #E8F5E9;
    color: #2E7D32;
}

.badge-rsvp-declined {
    background: #FFEBEE;
    color: #C62828;
}

.badge-rsvp-maybe {
    background: #FFF8E1;
    color: #F57F17;
}

.badge-rsvp-invited {
    background: #ECEFF1;
    color: #607D8B;
}

.nav-badge-invite {
    background: #D4A017;
}

/* Breadcrumbs */
.breadcrumb {
    padding: var(--space-md) 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: var(--container-max-width, 1200px);
    margin: 0 auto;
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
}

.breadcrumb a {
    color: var(--terracotta);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 0.3rem;
    color: var(--text-muted);
}

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

/* Empty state component */
.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-xl);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.empty-state h2 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    max-width: 480px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    font-family: var(--font-heading);
    margin-bottom: var(--space-md);
}

.modal-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-top: var(--space-lg);
}

/* Recipe picker (shared planner) */
.recipe-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
}

.recipe-picker {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.recipe-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.recipe-picker-header h3 {
    font-family: var(--font-heading);
    margin: 0;
}

.recipe-picker-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
}

.picker-result-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: var(--space-sm) var(--space-md);
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
}

.picker-result-item:hover {
    background: var(--bg-page);
}

.picker-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: var(--space-md) 0;
}


/* ==========================================================================
   FORMS
   ========================================================================== */

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

.form-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-input);
    transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--terracotta);
    box-shadow: 0 0 0 3px rgba(199, 91, 57, 0.15);
}

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

.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

.form-error {
    font-size: 0.8rem;
    color: #C62828;
    margin-top: var(--space-xs);
}

/* Auth form card layout */
.auth-card {
    max-width: 480px;
    margin: var(--space-xl) auto;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-2xl);
}

.auth-card h1 {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.auth-card .form-footer {
    text-align: center;
    margin-top: var(--space-lg);
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Inline form layout */
.form-inline {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-inline .form-group {
    margin-bottom: 0;
}


/* ==========================================================================
   FLASH MESSAGES
   ========================================================================== */

.flash-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-sm) var(--space-md);
}

.flash {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.flash-info {
    background: #E3F2FD;
    color: #1565C0;
    border-left: 4px solid #1565C0;
}

.flash-success {
    background: #E8F5E9;
    color: #2E7D32;
    border-left: 4px solid #2E7D32;
}

.flash-error {
    background: #FFEBEE;
    color: #C62828;
    border-left: 4px solid #C62828;
}

.flash-warning {
    background: #FFF8E1;
    color: #F57F17;
    border-left: 4px solid #F57F17;
}

.flash-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
    color: inherit;
    padding: 0 var(--space-sm);
}

.flash-close:hover {
    opacity: 1;
}


/* ==========================================================================
   BREADCRUMBS
   ========================================================================== */

.breadcrumb {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-md) var(--space-md);
    font-size: 0.85rem;
    color: var(--text-muted);
}

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

.breadcrumb a:hover {
    color: var(--terracotta);
}

.breadcrumb .breadcrumb-separator {
    margin: 0 var(--space-sm);
}

.breadcrumb .breadcrumb-current {
    color: var(--text-secondary);
    font-weight: 500;
}


/* ==========================================================================
   PAGINATION
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-xl) 0;
    flex-wrap: wrap;
}

.pagination-link {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.pagination-link:hover {
    background: var(--terracotta);
    color: white;
    border-color: var(--terracotta);
}

.pagination-current {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--terracotta);
    border-radius: var(--radius-md);
    background: var(--terracotta);
    color: white;
    font-weight: 600;
}

.pagination-ellipsis {
    padding: 0.5rem 0.25rem;
    color: var(--text-muted);
}


/* ==========================================================================
   TABLES
   ========================================================================== */

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

.table th {
    text-align: left;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 2px solid var(--border-dark);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-weight: 600;
}

.table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tr:hover {
    background: rgba(245, 240, 232, 0.5);
}

.table .code {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    letter-spacing: 0.1em;
}


/* ==========================================================================
   RESPONSIVE GRID
   ========================================================================== */

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.grid {
    display: grid;
    gap: var(--space-lg);
    grid-template-columns: 1fr;
}

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

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

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


/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
    background: var(--bg-footer);
    color: var(--text-inverse);
    padding: var(--space-2xl) 0 var(--space-lg);
    margin-top: auto;
}

.footer-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
    text-align: center;
}

.footer-logo {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.footer-logo-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.footer-tagline {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: var(--space-xs);
    margin-bottom: var(--space-lg);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
}

.footer-links a {
    color: var(--text-inverse);
    opacity: 0.8;
    font-size: 0.9rem;
    transition: opacity var(--transition-fast);
}

.footer-links a:hover {
    opacity: 1;
    color: var(--text-inverse);
}

.footer-copyright {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-bottom: 0;
}


/* ==========================================================================
   PROFILE
   ========================================================================== */

.profile-card {
    max-width: 600px;
    margin: var(--space-xl) auto;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-2xl);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-medium);
}

.profile-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--terracotta-light), var(--terracotta));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
}

.profile-info dt {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-xs);
}

.profile-info dd {
    margin-bottom: var(--space-md);
    margin-left: 0;
}


/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

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

.mt-1 { margin-top: var(--space-md); }
.mt-2 { margin-top: var(--space-xl); }
.mt-3 { margin-top: var(--space-2xl); }
.mb-1 { margin-bottom: var(--space-md); }
.mb-2 { margin-bottom: var(--space-xl); }
.mb-3 { margin-bottom: var(--space-2xl); }

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


/* ==========================================================================
   HOME PAGE
   ========================================================================== */

.home-hero {
    text-align: center;
    padding: var(--space-3xl) var(--space-md) var(--space-2xl);
}

.home-hero-logo {
    width: 180px;
    height: auto;
    margin: 0 auto var(--space-lg);
    display: block;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.home-hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.home-hero-subtitle {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.home-hero-description {
    max-width: 640px;
    margin: 0 auto;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Region Cards on Home Page */
.region-card { text-decoration: none; color: inherit; }
.region-card:hover { color: inherit; }

.region-card-header {
    padding: var(--space-xl);
    text-align: center;
    color: white;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.region-card-flag {
    font-size: 3rem;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.region-card-body {
    padding: var(--space-lg);
    text-align: center;
}

.region-card-name {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: var(--space-xs);
}

.region-card-native {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
}

.region-card-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.section-title {
    text-align: center;
    margin-bottom: var(--space-xl);
    font-size: 1.75rem;
}

.home-empty-state {
    padding: var(--space-3xl) var(--space-md);
}

@media (max-width: 768px) {
    .home-hero-logo { width: 120px; }
    .home-hero-title { font-size: 2.25rem; }
    .home-hero-subtitle { font-size: 1.1rem; }
    .region-header-hero { min-height: 200px; }
}


/* ==========================================================================
   REGION DETAIL PAGE
   ========================================================================== */

.region-header {
    text-align: center;
    padding: var(--space-2xl) var(--space-md) var(--space-xl);
    background: linear-gradient(135deg, var(--region-primary), color-mix(in srgb, var(--region-primary), black 20%));
    color: white;
}

.region-header-hero {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 0;
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.region-header-hero .region-header-overlay {
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.6));
    width: 100%;
    padding: var(--space-3xl) var(--space-md) var(--space-xl);
    text-align: center;
}

.region-header h1 {
    color: white;
    margin-bottom: var(--space-xs);
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.region-header-flag {
    font-size: 4rem;
    display: block;
    margin-bottom: var(--space-md);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.region-header-overlay {
    /* For non-hero headers, overlay is transparent */
}

.region-native-name {
    font-style: italic;
    opacity: 0.9;
    font-size: 1.1rem;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.region-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    padding: var(--space-xl) 0;
}

@media (min-width: 1024px) {
    .region-layout {
        grid-template-columns: 1fr 280px;
    }
}

.region-intro { margin-bottom: var(--space-xl); }

.region-description {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.region-cultural-notes {
    background: var(--bg-card);
    border-left: 4px solid var(--region-primary);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-style: italic;
    color: var(--text-secondary);
}

/* Category Cards */
.category-card {
    text-align: center;
    padding: var(--space-lg);
    text-decoration: none;
    color: inherit;
}

.category-card:hover { color: inherit; }

.category-card-empty {
    opacity: 0.5;
}

.category-card-img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin: 0 auto var(--space-sm);
    display: block;
}

.category-header-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    margin: 0 auto var(--space-md);
    display: block;
}

.category-card-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
}

.category-card-name {
    font-size: 1rem;
    margin-bottom: var(--space-xs);
}

.category-card-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* Region Sidebar */
.region-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    height: fit-content;
    position: sticky;
    top: calc(var(--nav-height) + var(--space-lg));
}

.sidebar-title {
    font-size: 1.1rem;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-light);
}

.region-sidebar-list {
    list-style: none;
}

.region-sidebar-list li {
    margin-bottom: var(--space-xs);
}

.region-sidebar-list a {
    display: block;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: background var(--transition-fast);
}

.region-sidebar-list a:hover {
    background: var(--bg-page);
    color: var(--terracotta);
}

.region-sidebar-list .active a {
    background: var(--terracotta);
    color: white;
    font-weight: 500;
}

@media (max-width: 1023px) {
    .region-sidebar { display: none; }
}

.region-categories { margin-bottom: var(--space-xl); }
.region-latest { margin-bottom: var(--space-xl); }


/* ==========================================================================
   CATEGORY PAGE
   ========================================================================== */

.category-header {
    text-align: center;
    padding: var(--space-xl) 0;
}

.category-header-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--space-sm);
}

/* Sort Controls */
.sort-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-light);
}

.sort-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.sort-option {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.sort-option:hover {
    background: var(--bg-card);
    color: var(--terracotta);
}

.sort-active {
    background: var(--terracotta);
    color: white;
    font-weight: 500;
}

.sort-active:hover {
    background: var(--terracotta-dark);
    color: white;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-md);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.empty-state h2 {
    margin-bottom: var(--space-sm);
}

.empty-state .btn {
    margin-top: var(--space-lg);
}


/* ==========================================================================
   RECIPE DETAIL PAGE
   ========================================================================== */

.recipe-detail { max-width: 900px; }

.recipe-header { margin-bottom: var(--space-xl); }
.recipe-header-badges {
    display: flex; gap: var(--space-sm); flex-wrap: wrap;
    margin-bottom: var(--space-md);
}
.recipe-title {
    font-size: 2.5rem;
    margin-bottom: var(--space-xs);
}
.recipe-original-name {
    font-style: italic;
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: var(--space-md);
}
.recipe-pending-notice {
    background: #FFF8E1;
    border: 1px solid #FFE082;
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin: var(--space-md) 0;
}
.recipe-actions {
    display: flex; gap: var(--space-sm); flex-wrap: wrap;
    margin-top: var(--space-md);
}

.recipe-image-container {
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-xl);
}
.recipe-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
}

/* Meta Bar */
.recipe-meta-bar {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
}
.recipe-meta-item { text-align: center; }
.recipe-meta-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-xs);
}
.recipe-meta-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Cultural Context */
.recipe-cultural-context {
    margin-bottom: var(--space-xl);
}
.recipe-cultural-context blockquote {
    background: var(--bg-card);
    border-left: 4px solid var(--region-primary, var(--terracotta));
    padding: var(--space-lg);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.7;
}
.recipe-cultural-context blockquote p { margin: 0; }

/* Recipe Description */
.recipe-description {
    margin-bottom: var(--space-xl);
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Recipe Body: Ingredients + Instructions */
.recipe-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}
@media (min-width: 768px) {
    .recipe-body {
        grid-template-columns: 1fr 1.5fr;
    }
}

/* Ingredients */
.recipe-ingredients h2 { font-size: 1.5rem; }
.ingredients-list {
    list-style: none;
}
.ingredient-item {
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-light);
    line-height: 1.5;
}
.ingredient-item:last-child { border-bottom: none; }
.ingredient-amount {
    font-weight: 600;
    margin-right: 0.25rem;
}
.ingredient-unit {
    color: var(--text-secondary);
    margin-right: 0.25rem;
}
.ingredient-notes {
    color: var(--text-muted);
    font-size: 0.9em;
    font-style: italic;
}

/* Instructions */
.recipe-instructions h2 { font-size: 1.5rem; }
.instructions-list {
    list-style: none;
    counter-reset: none;
}
.instruction-step {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}
.step-number {
    flex-shrink: 0;
    width: 32px; height: 32px;
    border-radius: var(--radius-full);
    background: var(--region-primary, var(--terracotta));
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
}
.step-text {
    line-height: 1.6;
    padding-top: 0.25rem;
}

/* Tags */
.recipe-tags-section { margin-bottom: var(--space-xl); }
.recipe-tags {
    display: flex; gap: var(--space-sm); flex-wrap: wrap;
}

/* Future sections (placeholder) */
.recipe-stories-section,
.recipe-comments-section,
.recipe-made-it-section {
    margin-bottom: var(--space-xl);
    padding: var(--space-xl);
    background: var(--bg-card);
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-lg);
}

/* Recipe Footer */
.recipe-footer {
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-light);
    margin-top: var(--space-xl);
}

/* Pending Cards (Admin) */
.pending-list { display: flex; flex-direction: column; gap: var(--space-md); }
.pending-card-body {
    padding: var(--space-lg);
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: var(--space-lg); flex-wrap: wrap;
}
.pending-card-actions {
    display: flex; gap: var(--space-sm); flex-shrink: 0;
}

/* Servings Adjuster */
.recipe-meta-servings {
    min-width: auto;
}

.servings-adjuster {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.btn-adjust {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: 2px solid var(--terracotta);
    background: transparent;
    color: var(--terracotta);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    padding: 0;
    line-height: 1;
    font-family: var(--font-body);
}

.btn-adjust:hover {
    background: var(--terracotta);
    color: white;
}

.btn-adjust:active {
    transform: scale(0.95);
}

.servings-count {
    font-size: 1.25rem;
    font-weight: 700;
    min-width: 2ch;
    text-align: center;
    color: var(--text-primary);
}

.btn-reset {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.8rem;
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.btn-reset:hover {
    color: var(--terracotta);
}

/* Unit Toggle */
.unit-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
}

.unit-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: color var(--transition-fast);
    user-select: none;
}

.unit-label-active {
    color: var(--text-primary);
    font-weight: 600;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-medium);
    border-radius: var(--radius-full);
    transition: background-color var(--transition-normal);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--terracotta);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.toggle-switch input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(199, 91, 57, 0.25);
}

/* Shopping button success state */
.btn-shopping-added {
    background: #E8F5E9;
    border-color: #4CAF50;
    color: #2E7D32;
    cursor: default;
}

/* Highlight animation for scaled amounts */
.amount-changed {
    animation: highlight-flash 0.6s ease;
}

@keyframes highlight-flash {
    0% { background-color: rgba(212, 175, 55, 0.3); }
    100% { background-color: transparent; }
}

/* Print styles for recipe */
@media print {
    .main-nav, .site-footer, .recipe-actions, .breadcrumb,
    .recipe-stories-section, .recipe-comments-section, .recipe-made-it-section,
    .servings-adjuster .btn-adjust, .servings-adjuster .btn-reset,
    .unit-toggle { display: none; }
    .recipe-detail { max-width: 100%; }
    .recipe-body { grid-template-columns: 1fr 1.5fr; }
}

@media (max-width: 768px) {
    .recipe-title { font-size: 1.75rem; }
    .recipe-meta-bar {
        justify-content: center;
        flex-direction: column;
        align-items: center;
    }
    .unit-toggle {
        margin-bottom: var(--space-lg);
    }
}


/* ==========================================================================
   NAV SEARCH
   ========================================================================== */

.nav-search-form {
    display: flex;
    align-items: center;
}

.nav-search-input {
    width: 180px;
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-inverse);
    font-family: var(--font-body);
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.nav-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.nav-search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    width: 220px;
}

.nav-search-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: var(--space-sm);
}

@media (max-width: 768px) {
    .nav-search-form {
        display: none;
        width: 100%;
    }

    .nav-search-form.nav-search-expanded {
        display: flex;
    }

    .nav-search-form .nav-search-input {
        width: 100%;
        background: rgba(255, 255, 255, 0.1);
        color: var(--text-inverse);
    }

    .nav-search-toggle {
        display: block;
    }

    .nav-search-toggle.search-active {
        display: none;
    }
}
