/* ===================================
   CSS Custom Properties (Design Tokens)
   =================================== */
:root {
    /* Colors - Cool Modern Theme (matches blue header) */
    --color-primary: #5b8ec4;
    --color-primary-dark: #4a7ab3;
    --color-secondary: #6b7c93;
    --color-accent: #5a9e4a;
    --color-accent-dark: #4a8539;
    --color-warning: #f5a623;
    --color-warning-dark: #e09412;
    --color-danger: #d85a54;
    --color-danger-dark: #c04944;

    --color-bg-primary: #f8f9fb;
    --color-bg-secondary: #f0f2f5;
    --color-bg-tertiary: #e8eaed;
    --color-bg-notes: #eef4f9;

    --color-text-primary: #2c3e50;
    --color-text-secondary: #4a5f7f;
    --color-text-tertiary: #7a8b9c;
    --color-text-muted: #a0aab8;

    --color-header: #0f4476;
    --color-border: #d4dce6;

    /* 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;

    /* Typography */
    --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;

    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Borders & Radius */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    --border-radius-pill: 999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.2);

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 200ms ease-in-out;
    --transition-slow: 300ms ease-in-out;

    /* Layout */
    --container-max-width: 1200px;
    --container-padding: 1.25rem;
    --header-height: auto;
}

/* Dark Mode Colors */
@media (prefers-color-scheme: dark) {
    :root {
        --color-bg-primary: #1a1d23;
        --color-bg-secondary: #0f1114;
        --color-bg-tertiary: #2a2e35;
        --color-bg-notes: #1e2a35;

        --color-text-primary: #e8ecf0;
        --color-text-secondary: #b8c5d0;
        --color-text-tertiary: #95a5b5;
        --color-text-muted: #6b7c8c;

        --color-header: #0f4476;
        --color-border: #3a4550;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.5);
        --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.6);
    }

    /* Welcome Banner: dark text on light background */
    .banner-title { color: #0f4476 !important; }
    .banner-content p { color: #1a1d23 !important; }
    .banner-signature { color: #2c3e50 !important; }
    .banner-close { color: #4a5f7f !important; }
    .banner-close:hover { color: #1a1d23 !important; }
}

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

html {
    scroll-behavior: smooth;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg-secondary);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(15, 68, 118, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(180, 200, 220, 0.05) 0%, transparent 50%);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Improve text rendering */
h1, h2, h3, h4, h5, h6 {
    line-height: var(--line-height-tight);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

/* ===================================
   Utility Classes
   =================================== */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* Skip to content link for accessibility */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-primary);
    color: white;
    padding: var(--space-sm) var(--space-md);
    text-decoration: none;
    z-index: 100;
    font-weight: var(--font-weight-semibold);
    border-radius: var(--border-radius-sm);
}

.skip-to-content:focus {
    top: 0;
    box-shadow: 0 2px 8px rgba(91, 142, 196, 0.3);
}

/* ===================================
   Header
   =================================== */
header {
    background: #0f4476;
    color: #ffffff;
    padding: 22px 0 var(--space-md) 0;
    text-align: center;
    margin-bottom: var(--space-xl);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border-bottom: 3px solid #0d3a63;
    position: relative;
    overflow: hidden;
}

header h1 {
    font-size: clamp(var(--font-size-3xl), 5vw, var(--font-size-5xl));
    margin-top: 80px;
    margin-bottom: var(--space-lg);
    color: #FFFACD;
    font-weight: normal;
    font-family: 'Fredoka One', sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    position: relative;
    z-index: 3;
    display: inline-block;
    padding: 1.2rem 2.5rem;
    border: 3px solid #FFFACD;
    border-radius: 12px;

    /* Minimal glow on text for sharp, readable font */
    text-shadow:
        0 0 2px rgba(255, 250, 205, 0.5),
        0 0 5px rgba(255, 250, 205, 0.3),
        0 0 10px rgba(255, 250, 205, 0.2);

    /* Soft glowing rectangular frame - single border with layered glow */
    box-shadow:
        /* Inner soft glow */
        inset 0 0 10px rgba(255, 250, 205, 0.3),
        inset 0 0 20px rgba(255, 250, 205, 0.2),
        /* Outer soft diffused glow */
        0 0 10px rgba(255, 250, 205, 0.6),
        0 0 20px rgba(255, 250, 205, 0.4),
        0 0 40px rgba(255, 250, 205, 0.3),
        0 0 60px rgba(255, 249, 196, 0.2);

    /* Gentle shimmer animation - subtle and peaceful */
    animation: gentleGlow 5s ease-in-out infinite;
}

.header-title-link {
    color: #FFFACD;
    text-decoration: none;
    transition: opacity var(--transition-base);
}

.header-title-link:hover {
    opacity: 0.9;
}

.header-title-link:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 4px;
    border-radius: var(--border-radius-sm);
}

/* Gentle glow animation - minimal text glow, border shimmer */
@keyframes gentleGlow {
    0%, 100% {
        text-shadow:
            0 0 2px rgba(255, 250, 205, 0.5),
            0 0 5px rgba(255, 250, 205, 0.3),
            0 0 10px rgba(255, 250, 205, 0.2);
        box-shadow:
            inset 0 0 10px rgba(255, 250, 205, 0.3),
            inset 0 0 20px rgba(255, 250, 205, 0.2),
            0 0 10px rgba(255, 250, 205, 0.6),
            0 0 20px rgba(255, 250, 205, 0.4),
            0 0 40px rgba(255, 250, 205, 0.3),
            0 0 60px rgba(255, 249, 196, 0.2);
    }
    50% {
        text-shadow:
            0 0 3px rgba(255, 250, 205, 0.6),
            0 0 6px rgba(255, 250, 205, 0.4),
            0 0 12px rgba(255, 250, 205, 0.25);
        box-shadow:
            inset 0 0 12px rgba(255, 250, 205, 0.35),
            inset 0 0 24px rgba(255, 250, 205, 0.25),
            0 0 12px rgba(255, 250, 205, 0.7),
            0 0 24px rgba(255, 250, 205, 0.5),
            0 0 48px rgba(255, 250, 205, 0.35),
            0 0 72px rgba(255, 249, 196, 0.25);
    }
}

.tagline {
    font-size: var(--font-size-lg);
    color: #e8f4ff;
    font-weight: var(--font-weight-normal);
    font-style: normal;
    font-family: 'Chewy', sans-serif;
    line-height: var(--line-height-relaxed);
    position: relative;
    z-index: 3;
}

.jump-to-recipe {
    display: inline-block;
    background: linear-gradient(135deg, rgba(255, 235, 59, 0.9) 0%, rgba(255, 193, 7, 0.9) 100%);
    color: #1a237e;
    padding: 0.2rem 0.7rem;
    border-radius: 12px;
    font-style: normal;
    font-weight: var(--font-weight-bold);
    font-family: 'Fredoka One', sans-serif;
    border: 2px solid rgba(255, 235, 59, 0.6);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: all var(--transition-base);
    animation: badgePulse 3s ease-in-out infinite;
}

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

/* Animated cat flying across header */
header::before {
    content: '';
    position: absolute;
    top: 20px;
    left: -150px;
    width: 105px;
    height: 105px;
    background-image: url('https://media3.giphy.com/media/v1.Y2lkPTc5MGI3NjExZTU3aDU5ZXZheHplejByaGwyamZpNWRpNzJqNWd6OW8xOGN0M2NraCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/7lsw8RenVcjCM/giphy.gif');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 2;
    animation: catFly 8s linear infinite;
}

@keyframes catFly {
    0% {
        left: -150px;
    }
    100% {
        left: calc(100% + 150px);
    }
}

/* ===================================
   Welcome Banner - Minimalist Left Accent Design
   =================================== */
.welcome-banner {
    background-color: #FFFEF7;
    border-left: 5px solid #FFFACD;
    border-radius: 8px;
    margin: 0 auto var(--space-xl) auto;
    max-width: var(--container-max-width);
    padding: 0 var(--container-padding);
    position: relative;
    transition: opacity var(--transition-slow);

    /* Soft left glow + subtle card shadow */
    box-shadow:
        -3px 0 10px rgba(255, 250, 205, 0.4),
        -6px 0 20px rgba(255, 250, 205, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.05);
}

.welcome-banner.hidden {
    display: none;
}

.welcome-banner .container {
    position: relative;
    padding: 0;
}

.banner-content {
    max-width: 100%;
    padding: 1.5rem 3rem 1.5rem 2rem;
}

.banner-title {
    font-size: var(--font-size-2xl);
    color: var(--color-header);
    font-weight: var(--font-weight-bold);
    margin: 0 0 var(--space-md) 0;
    font-family: 'Fredoka One', sans-serif;
}

.banner-content p {
    color: var(--color-text-primary);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--space-md);
    font-size: var(--font-size-base);
}

.banner-content p:last-of-type {
    margin-bottom: 0;
}

.banner-signature {
    font-style: italic;
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
    margin-top: var(--space-lg);
}

.banner-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: transparent;
    border: none;
    font-size: var(--font-size-3xl);
    line-height: 1;
    color: var(--color-text-tertiary);
    cursor: pointer;
    padding: var(--space-xs);
    transition: all var(--transition-fast);
    border-radius: var(--border-radius-sm);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-close:hover {
    color: var(--color-text-primary);
    background-color: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

.banner-close:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.banner-close:active {
    transform: scale(0.95);
}

/* Mobile Responsiveness for Banner */
@media (max-width: 768px) {
    .welcome-banner {
        border-left-width: 3px;
        border-radius: 6px;

        /* Softer glow for mobile */
        box-shadow:
            -2px 0 8px rgba(255, 250, 205, 0.3),
            -4px 0 15px rgba(255, 250, 205, 0.15),
            0 2px 6px rgba(0, 0, 0, 0.04);
    }

    .banner-content {
        padding: 1rem 2rem 1rem 1.2rem;
    }

    .banner-title {
        font-size: var(--font-size-xl);
    }

    .banner-content p {
        font-size: var(--font-size-sm);
    }

    .banner-close {
        top: var(--space-sm);
        right: var(--space-sm);
        font-size: var(--font-size-2xl);
        width: 32px;
        height: 32px;
    }
}

/* Responsive sizing for cat and neon header */
@media (max-width: 768px) {
    /* Adjust soft glow sign for mobile - rectangular frame */
    header h1 {
        padding: 0.8rem 1.5rem;
        border-radius: 10px;
        border-width: 2px;

        /* Minimal text glow for mobile - sharp and clear */
        text-shadow:
            0 0 2px rgba(255, 250, 205, 0.4),
            0 0 4px rgba(255, 250, 205, 0.25),
            0 0 8px rgba(255, 250, 205, 0.15);

        /* Soft border glow for mobile */
        box-shadow:
            inset 0 0 8px rgba(255, 250, 205, 0.25),
            inset 0 0 16px rgba(255, 250, 205, 0.15),
            0 0 8px rgba(255, 250, 205, 0.5),
            0 0 16px rgba(255, 250, 205, 0.35),
            0 0 32px rgba(255, 250, 205, 0.25),
            0 0 48px rgba(255, 249, 196, 0.15);
    }

    /* Mobile-optimized gentle glow - minimal text blur */
    @keyframes gentleGlow {
        0%, 100% {
            text-shadow:
                0 0 2px rgba(255, 250, 205, 0.4),
                0 0 4px rgba(255, 250, 205, 0.25),
                0 0 8px rgba(255, 250, 205, 0.15);
            box-shadow:
                inset 0 0 8px rgba(255, 250, 205, 0.25),
                inset 0 0 16px rgba(255, 250, 205, 0.15),
                0 0 8px rgba(255, 250, 205, 0.5),
                0 0 16px rgba(255, 250, 205, 0.35),
                0 0 32px rgba(255, 250, 205, 0.25),
                0 0 48px rgba(255, 249, 196, 0.15);
        }
        50% {
            text-shadow:
                0 0 3px rgba(255, 250, 205, 0.5),
                0 0 5px rgba(255, 250, 205, 0.3),
                0 0 10px rgba(255, 250, 205, 0.2);
            box-shadow:
                inset 0 0 10px rgba(255, 250, 205, 0.3),
                inset 0 0 20px rgba(255, 250, 205, 0.2),
                0 0 10px rgba(255, 250, 205, 0.6),
                0 0 20px rgba(255, 250, 205, 0.4),
                0 0 40px rgba(255, 250, 205, 0.3),
                0 0 60px rgba(255, 249, 196, 0.2);
        }
    }

    header::before {
        width: 75px;
        height: 75px;
        top: 15px;
        left: -100px;
    }

    @keyframes catFly {
        0% {
            left: -100px;
        }
        100% {
            left: calc(100% + 100px);
        }
    }
}

/* Animated stars and sparkles background */
header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background-image:
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(2px 2px at 60% 70%, white, transparent),
        radial-gradient(2px 2px at 50% 50%, white, transparent),
        radial-gradient(2px 2px at 80% 10%, white, transparent),
        radial-gradient(2px 2px at 90% 60%, white, transparent),
        radial-gradient(2px 2px at 33% 80%, white, transparent),
        radial-gradient(2px 2px at 15% 15%, white, transparent),
        radial-gradient(2px 2px at 70% 40%, white, transparent),
        radial-gradient(2px 2px at 25% 55%, white, transparent),
        radial-gradient(2px 2px at 45% 20%, white, transparent),
        radial-gradient(2px 2px at 85% 35%, white, transparent),
        radial-gradient(2px 2px at 10% 65%, white, transparent),
        radial-gradient(2px 2px at 95% 45%, white, transparent),
        radial-gradient(2px 2px at 40% 85%, white, transparent),
        radial-gradient(2px 2px at 55% 25%, white, transparent),
        radial-gradient(2px 2px at 75% 75%, white, transparent),
        radial-gradient(2px 2px at 30% 10%, white, transparent),
        radial-gradient(2px 2px at 65% 90%, white, transparent),
        radial-gradient(2px 2px at 5% 40%, white, transparent),
        radial-gradient(2px 2px at 88% 80%, white, transparent),
        radial-gradient(2px 2px at 42% 5%, white, transparent),
        radial-gradient(2px 2px at 72% 55%, white, transparent),
        radial-gradient(2px 2px at 18% 92%, white, transparent),
        radial-gradient(2px 2px at 52% 68%, white, transparent),
        radial-gradient(2px 2px at 35% 42%, white, transparent),
        radial-gradient(2px 2px at 92% 22%, white, transparent),
        radial-gradient(2px 2px at 8% 28%, white, transparent),
        radial-gradient(2px 2px at 62% 12%, white, transparent);
    background-size: 200% 200%;
    background-position: 0% 0%;
    animation: twinkle 15s linear infinite;
    opacity: 0.6;
}

@keyframes twinkle {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 0%;
    }
}

/* Dynamically generated twinkling stars */
.twinkling-star {
    position: absolute;
    background: white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.8);
    animation: starTwinkle infinite linear;
    opacity: 0;
}

@keyframes starTwinkle {
    0% {
        opacity: 0;
        transform: translateX(100vw);
    }
    10% {
        opacity: 1;
        transform: translateX(90vw);
    }
    90% {
        opacity: 1;
        transform: translateX(10vw);
    }
    100% {
        opacity: 0;
        transform: translateX(-100px);
    }
}

/* ===================================
   Search & Filter Section
   =================================== */
.search-filter-section {
    background: var(--color-bg-primary);
    border-radius: var(--border-radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-2xl);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--color-border);
}

.search-bar {
    margin-bottom: var(--space-lg);
}

.search-bar input {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    font-size: var(--font-size-lg);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-md);
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    transition: border-color var(--transition-base);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(91, 142, 196, 0.2);
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: center;
}

.filter-controls label {
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

.filter-controls select {
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: border-color var(--transition-base);
}

.filter-controls select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(91, 142, 196, 0.15);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.recipe-count {
    margin-left: auto;
    color: var(--color-text-tertiary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

/* ===================================
   Add Recipe Banner
   =================================== */
.add-recipe-banner {
    text-align: right;
    margin-bottom: var(--space-lg);
    padding: 0;
}

.add-recipe-content {
    display: inline-block;
}

.add-recipe-content h2,
.add-recipe-content > p:first-of-type {
    display: none;
}

.add-recipe-btn {
    display: inline-block;
    background: linear-gradient(135deg, rgba(91, 142, 196, 0.1) 0%, rgba(74, 122, 179, 0.08) 100%);
    color: var(--color-primary);
    padding: 0.625rem 1.25rem;
    border-radius: var(--border-radius-md);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    transition: all var(--transition-base);
    border: 2px solid var(--color-primary);
}

.add-recipe-btn:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(91, 142, 196, 0.3);
}

.add-recipe-btn:active {
    transform: translateY(0);
}

.add-recipe-btn:focus {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

.add-recipe-content .instructions {
    display: none;
}

/* ===================================
   Recipe Grid
   =================================== */
#recipes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: var(--space-xl);
    margin: var(--space-xl) 0;
}

/* Empty state */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    color: var(--color-text-tertiary);
}

.empty-state h2 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-md);
    color: var(--color-text-secondary);
}

/* ===================================
   Recipe Cards
   =================================== */
.recipe-card {
    background: var(--color-bg-primary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--color-border);
}

.recipe-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: var(--color-primary);
}

.recipe-card:focus-within {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

.recipe-card-image-link {
    display: block;
    overflow: hidden;
}

.recipe-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    background: var(--color-bg-tertiary);
    transition: transform var(--transition-slow);
}

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

/* Lazy loading image placeholder */
.recipe-card img[data-src] {
    background: linear-gradient(90deg, var(--color-bg-tertiary) 25%, var(--color-bg-secondary) 50%, var(--color-bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.recipe-content {
    padding: var(--space-lg);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.recipe-card-title-link {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-base);
}

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

.recipe-card-title-link:focus {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--border-radius-sm);
}

.recipe-content h2 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-sm);
    color: var(--color-text-primary);
    line-height: var(--line-height-tight);
    font-family: Georgia, 'Times New Roman', serif;
}

.recipe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin: var(--space-md) 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
}

.recipe-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.recipe-description {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-md);
    line-height: var(--line-height-relaxed);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.view-recipe-btn {
    display: inline-block;
    margin-top: var(--space-md);
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-base);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base);
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.view-recipe-btn:hover {
    background: linear-gradient(135deg, var(--color-accent-dark) 0%, var(--color-accent) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.view-recipe-btn:active {
    transform: translateY(0);
}

.view-recipe-btn:focus {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

/* ===================================
   Recipe Detail Page
   =================================== */
.recipe-detail {
    max-width: 900px;
    margin: var(--space-xl) auto;
    background: var(--color-bg-primary);
    padding: var(--space-2xl);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
}

.recipe-detail h1 {
    color: var(--color-text-primary);
    margin-bottom: var(--space-md);
    font-size: clamp(var(--font-size-2xl), 5vw, var(--font-size-4xl));
}

.recipe-detail img {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: var(--border-radius-md);
    margin: var(--space-md) 0 var(--space-xl);
    box-shadow: var(--shadow-lg);
}

.recipe-detail > p {
    color: var(--color-text-secondary);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--space-lg);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    color: var(--color-primary);
    text-decoration: none;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base);
    transition: all var(--transition-base);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius-sm);
}

.back-link:hover {
    gap: var(--space-md);
    background: rgba(91, 142, 196, 0.1);
    color: var(--color-primary-dark);
}

.back-link:focus {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--border-radius-sm);
}

/* Ingredients & Instructions */
.ingredients,
.instructions {
    margin: var(--space-2xl) 0;
}

.ingredients h2,
.instructions h2 {
    color: var(--color-text-primary);
    margin-bottom: var(--space-lg);
    border-bottom: 3px solid var(--color-accent);
    padding-bottom: var(--space-sm);
    font-size: var(--font-size-2xl);
}

.ingredients ul {
    list-style: none;
    padding-left: 0;
}

.ingredients li {
    padding: var(--space-md) 0;
    padding-left: var(--space-2xl);
    position: relative;
    color: var(--color-text-primary);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
    border-bottom: 1px solid var(--color-border);
}

.ingredients li:last-child {
    border-bottom: none;
}

.ingredients li:before {
    content: "✓";
    color: var(--color-accent);
    font-weight: var(--font-weight-bold);
    position: absolute;
    left: 0;
    font-size: var(--font-size-xl);
}

.instructions ol {
    padding-left: var(--space-2xl);
    counter-reset: instruction-counter;
    list-style: none;
}

.instructions li {
    padding: var(--space-lg) 0;
    padding-left: var(--space-lg);
    color: var(--color-text-primary);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
    position: relative;
    counter-increment: instruction-counter;
    border-bottom: 1px solid var(--color-border);
}

.instructions li:last-child {
    border-bottom: none;
}

.instructions li::before {
    content: counter(instruction-counter);
    position: absolute;
    left: calc(-1 * var(--space-2xl));
    top: var(--space-lg);
    background: var(--color-accent);
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-base);
}

/* Serving size calculator */
.serving-calculator {
    background: var(--color-bg-tertiary);
    padding: var(--space-lg);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
    border: 2px solid var(--color-border);
}

.serving-calculator label {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    font-size: var(--font-size-base);
}

.serving-calculator input {
    width: 80px;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    text-align: center;
    transition: border-color var(--transition-base);
}

.serving-calculator input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(90, 158, 74, 0.2);
}

.serving-calculator button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base);
    transition: all var(--transition-base);
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.serving-calculator button:hover {
    background: linear-gradient(135deg, var(--color-accent-dark) 0%, var(--color-accent) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.serving-calculator button:active {
    transform: translateY(0);
}

.serving-calculator button:focus {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

.serving-calculator button:last-of-type {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-text-secondary) 100%);
}

.serving-calculator button:last-of-type:hover {
    background: linear-gradient(135deg, var(--color-text-secondary) 0%, var(--color-secondary) 100%);
}

@media (max-width: 768px) {
    .serving-calculator {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-sm);
    }

    .serving-calculator label {
        text-align: center;
    }

    .serving-calculator input {
        width: 100%;
    }

    .serving-calculator button {
        width: 100%;
    }
}

/* My Notes Section */
.my-notes-section {
    margin: var(--space-2xl) 0;
    padding: var(--space-2xl);
    background-color: var(--color-bg-notes);
    border-left: 4px solid var(--color-warning);
    border-radius: var(--border-radius-md);
}

.my-notes-section h2 {
    color: var(--color-text-primary);
    margin-bottom: var(--space-md);
    font-size: var(--font-size-2xl);
}

.notes-content {
    color: var(--color-text-secondary);
    line-height: var(--line-height-relaxed);
    font-size: var(--font-size-lg);
}

.notes-content p {
    margin: var(--space-sm) 0;
    white-space: pre-wrap;
}

.no-notes {
    color: var(--color-text-muted);
    font-style: italic;
}

/* Recipe Actions */
.recipe-actions {
    margin-top: var(--space-2xl);
    padding-top: var(--space-2xl);
    border-top: 2px solid var(--color-border);
    text-align: center;
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

.edit-notes-btn,
.delete-recipe-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius-md);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base);
    transition: all var(--transition-base);
    min-width: 160px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.edit-notes-btn {
    background: linear-gradient(135deg, var(--color-warning) 0%, var(--color-warning-dark) 100%);
}

.edit-notes-btn:hover {
    background: linear-gradient(135deg, var(--color-warning-dark) 0%, var(--color-warning) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.edit-notes-btn:active {
    transform: translateY(0);
}

.edit-notes-btn:focus {
    outline: 3px solid var(--color-warning);
    outline-offset: 2px;
}

.delete-recipe-btn {
    background: linear-gradient(135deg, var(--color-danger) 0%, var(--color-danger-dark) 100%);
}

.delete-recipe-btn:hover {
    background: linear-gradient(135deg, var(--color-danger-dark) 0%, var(--color-danger) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.delete-recipe-btn:active {
    transform: translateY(0);
}

.delete-recipe-btn:focus {
    outline: 3px solid var(--color-danger);
    outline-offset: 2px;
}

/* ===================================
   Footer
   =================================== */
footer {
    background: linear-gradient(135deg, #e8ecf0 0%, #dde3e9 100%);
    color: var(--color-text-secondary);
    text-align: center;
    padding: var(--space-2xl) 0;
    margin-top: var(--space-3xl);
    border-top: 2px solid var(--color-border);
}

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

footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
}

footer a:hover {
    text-decoration: underline;
    color: var(--color-primary-dark);
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    :root {
        --container-padding: var(--space-md);
    }

    header {
        padding: var(--space-xl) 0;
    }

    .add-recipe-banner {
        padding: var(--space-xl);
    }

    .search-filter-section {
        padding: var(--space-md);
    }

    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .recipe-count {
        margin-left: 0;
        text-align: center;
    }

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

    .recipe-card img {
        height: 200px;
    }

    .recipe-detail {
        padding: var(--space-lg);
        margin: var(--space-md);
    }

    .recipe-actions {
        flex-direction: column;
    }

    .edit-notes-btn,
    .delete-recipe-btn {
        width: 100%;
    }

    .instructions li::before {
        position: static;
        display: inline-block;
        margin-right: var(--space-sm);
    }

    .instructions ol {
        padding-left: 0;
    }

    .instructions li {
        padding-left: 0;
    }
}

@media (min-width: 1400px) {
    :root {
        --container-max-width: 1400px;
    }

    #recipes {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

/* ===================================
   Print Styles
   =================================== */
@media print {
    body {
        background: white;
        color: black;
    }

    header,
    footer,
    .add-recipe-banner,
    .search-filter-section,
    .recipe-actions,
    .back-link {
        display: none !important;
    }

    .recipe-detail {
        max-width: 100%;
        box-shadow: none;
        padding: 0;
    }

    .recipe-detail img {
        max-height: 300px;
        page-break-inside: avoid;
    }

    .ingredients,
    .instructions {
        page-break-inside: avoid;
    }

    .my-notes-section {
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    h1, h2 {
        page-break-after: avoid;
    }
}

/* ===================================
   Accessibility Enhancements
   =================================== */

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --color-border: #000;
    }

    .recipe-card {
        border: 2px solid var(--color-border);
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* Screen reader only text */
.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;
}

/* Loading state */
.loading {
    text-align: center;
    padding: var(--space-3xl);
    color: var(--color-text-tertiary);
    font-size: var(--font-size-lg);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse-opacity {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
