/* 
 * Jello Recipe Management System - Core UI Design Stylesheet
 * Brand Theme: Obsidian Culinary Glass
 * A premium, high-fidelity glassmorphic framework built for mobile-first culinary experiences.
 */

/* Fonts are loaded via <link rel="preconnect"> + <link rel="stylesheet"> in index.html
   (a render-blocking CSS @import here would chain an extra request and delay first paint). */

:root {
    /* Color Palette - HSL Tailored */
    --color-obsidian-base: hsl(224, 25%, 8%);
    --color-surface: #0e141b;
    --color-surface-dim: #0e141b;
    --color-surface-bright: #333a42;
    --color-surface-lowest: #080f15;
    --color-surface-low: #161c23;
    --color-surface-container: #1a2027;
    --color-surface-container-high: #242b32;
    --color-surface-container-highest: #2f353d;

    --color-on-surface: #dde3ed;
    --color-on-surface-variant: #bacbbd;
    --color-inverse-surface: #dde3ed;
    --color-inverse-on-surface: #2b3139;

    --input-bg: rgba(8, 15, 21, 0.6);
    --input-bg-focus: rgba(8, 15, 21, 0.85);

    --color-outline: #859588;
    --color-outline-variant: #3c4a40;

    /* Primary (Vibrant Pink/Magenta Accent) */
    --color-primary: #ff0090;
    --color-on-primary: #ffffff;
    --color-primary-container: #cc0073;
    --color-on-primary-container: #ffffff;
    --color-inverse-primary: #ff4898;

    /* Secondary (Vibrant Cool Blue/Cyan Accent) */
    --color-secondary: #005780;
    --color-on-secondary: #ffffff;
    --color-secondary-container: #004566;
    --color-on-secondary-container: #ffffff;

    /* Tertiary (Warm Honey Accent) */
    --color-tertiary: #FAAD09;
    --color-on-tertiary: #4d2600;
    --color-tertiary-container: #c98a07;
    --color-on-tertiary-container: #ffffff;

    /* Error States */
    --color-error: #ffb4ab;
    --color-on-error: #690005;
    --color-error-container: #93000a;
    --color-on-error-container: #ffdad6;

    /* Glass and Glow Special tokens */
    --surface-glass: rgba(28, 35, 43, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-high: rgba(255, 255, 255, 0.15);
    --neon-glow: rgba(255, 0, 144, 0.45);
    --neon-glow-blue: rgba(0, 87, 128, 0.35);

    /* Rounded Radius Tokens */
    --radius-sm: 4px;
    --radius-default: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Spacing Grid (8px baseline) */
    --spacing-unit: 8px;
    --spacing-margin-mobile: 20px;
    --spacing-margin-desktop: 40px;
    --spacing-gutter: 16px;
    --spacing-stack-sm: 8px;
    --spacing-stack-md: 16px;
    --spacing-stack-lg: 32px;

    /* Performance Animations */
    --transition-spring: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Body Stylesheet */
body.jello-theme {
    background-color: var(--color-obsidian-base);
    color: var(--color-on-surface);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Glassmorphism Panels */
.jello-glass {
    background: var(--surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: var(--transition-spring);
}

.jello-glass-high {
    background: var(--surface-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border-high);
    border-radius: var(--radius-xl);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
    transition: var(--transition-spring);
}

/* Responsive Micro-Transitions */
.jello-spring {
    transition: var(--transition-spring);
}

.jello-spring:hover {
    transform: translateY(-2px);
}

.jello-spring:active {
    transform: scale(0.97);
}

/* Brand Text and Neon Effects */
.jello-brand-glow {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    color: var(--color-primary);
    text-shadow: 0 0 20px var(--neon-glow);
    letter-spacing: -0.02em;
}

.jello-text-gradient-pink {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-container) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.jello-text-gradient-blue {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-container) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Elevated Components: Buttons */
.jello-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    height: 52px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    transition: var(--transition-spring);
}

.jello-btn-primary {
    background-color: var(--color-primary);
    color: var(--color-on-primary);
    box-shadow: 0 0 20px var(--neon-glow);
}

.jello-btn-primary:hover {
    background-color: #5effb7;
    box-shadow: 0 0 30px var(--neon-glow);
    transform: translateY(-2px);
}

.jello-btn-primary:active {
    transform: scale(0.96);
}

.jello-btn-secondary {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--color-on-surface);
    border: 1px solid var(--glass-border);
}

.jello-btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--glass-border-high);
    transform: translateY(-2px);
}

.jello-btn-secondary:active {
    transform: scale(0.96);
}

/* Modern Form Input Controls */
.jello-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* IFTA Label Implementation */
.jello-input-group:has(> .jello-input) {
    position: relative;
    display: block; /* override flex */
}

.jello-input-group:has(> .jello-input) > .jello-input-label {
    position: absolute;
    top: 8px;
    left: 16px;
    font-size: 10px;
    font-weight: 700;
    color: var(--color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    pointer-events: none;
    z-index: 2;
    margin: 0;
}

.jello-input-group:has(> .jello-input) > .jello-input {
    padding: 24px 16px 8px 16px !important;
    height: 56px !important;
    width: 100%;
}

.jello-input-group:has(> textarea.jello-input) > .jello-input {
    padding-top: 28px !important;
    height: auto !important;
    min-height: 80px !important;
}

.jello-input-label {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.jello-input {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--color-on-surface);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    padding: 0 16px;
    height: 48px;
    outline: none;
    box-sizing: border-box;
    transition: var(--transition-spring);
}

.jello-input::placeholder {
    color: rgba(221, 227, 237, 0.35);
}

.jello-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 15px rgba(26, 217, 139, 0.2);
    background: var(--input-bg-focus);
}

/* Dietary & Tag Chips */
.jello-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    height: 32px;
    border-radius: var(--radius-full);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition-spring);
}

.jello-chip-primary {
    background-color: rgba(255, 72, 152, 0.12);
    color: var(--color-primary);
    border: 1px solid rgba(255, 72, 152, 0.25);
}

.jello-chip-secondary {
    background-color: rgba(0, 176, 255, 0.12);
    color: var(--color-secondary);
    border: 1px solid rgba(0, 176, 255, 0.25);
}

/* Animated Glow States */
@keyframes jello-pulse {

    0%,
    100% {
        opacity: 0.55;
        filter: blur(24px);
    }

    50% {
        opacity: 0.75;
        filter: blur(36px);
    }
}

.jello-animate-glow {
    animation: jello-pulse 5s ease-in-out infinite;
}

/* Swipe Actions (Card Overlays) */
.jello-swipe-container {
    position: relative;
    overflow: hidden;
}

.jello-swipe-actions {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    z-index: 1;
}

.jello-swipe-action-btn {
    height: 100%;
    width: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ffffff;
    transition: var(--transition-spring);
}

.jello-swipe-btn-delete {
    background-color: var(--color-secondary-container);
}

.jello-swipe-btn-edit {
    background-color: var(--color-primary-container);
}
.jello-theme-light {
    --color-obsidian-base: #F5F7F9;
    --color-surface: #FFFFFF;
    --color-surface-dim: #f0f2f5;
    --color-surface-bright: #ffffff;
    --color-surface-lowest: #ffffff;
    --color-surface-low: #f8fafc;
    --color-surface-container: #FFFFFF;
    --color-surface-container-high: #f0f2f5;
    --color-surface-container-highest: #e2e8f0;

    --color-on-surface: #1A2229;
    --color-on-surface-variant: #6B7580;
    --color-inverse-surface: #1A2229;
    --color-inverse-on-surface: #F5F7F9;

    --color-outline: #E6E9ED;
    --color-outline-variant: #d1d5db;

    --color-primary: #F2007D;
    --color-on-primary: #ffffff;
    --color-primary-container: #FF4FA6;
    
    --color-secondary: #16303D;
    --color-on-secondary: #ffffff;
    --color-secondary-container: #1F4457;

    --input-bg: #ffffff;
    --input-bg-focus: #ffffff;

    --surface-glass: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-border-high: rgba(0, 0, 0, 0.15);
    --neon-glow: rgba(242, 0, 125, 0.25);
    --neon-glow-blue: rgba(22, 48, 61, 0.15);
}

.jello-app-container {
    background-color: var(--color-obsidian-base);
    color: var(--color-on-surface);
    min-height: 100vh;
    width: 100%;
}

.jello-btn-dashed {
    background: transparent;
    border: 1px dashed var(--color-primary);
    color: var(--color-primary);
}
.jello-btn-dashed:hover {
    background: rgba(255, 72, 152, 0.08);
}
.jello-btn-dashed:active {
    background: rgba(255, 72, 152, 0.15);
}

@keyframes spin { 100% { transform: rotate(360deg); } }

/* ── Voice dictation ─────────────────────────────────────────────────── */
.voice-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--color-surface-container);
    border: 1px solid var(--color-outline-variant);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 16px;
    transition: border-color 0.25s ease, background 0.25s ease;
}
.voice-bar.is-recording { border-color: var(--color-error); background: rgba(220, 38, 38, 0.08); }
.voice-bar.is-processing { border-color: var(--color-primary); }

.voice-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    border: none;
    border-radius: 10px;
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.05s ease;
}
.voice-btn:active { transform: scale(0.99); }
.voice-btn:disabled { opacity: 0.85; cursor: default; }
.voice-btn.is-recording { background: var(--color-error); color: var(--color-on-error); }

.voice-dot {
    width: 12px; height: 12px; border-radius: 50%;
    background: currentColor; animation: voiceBlink 1s infinite;
}
@keyframes voiceBlink { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

.voice-spinner {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid currentColor; border-top-color: transparent;
    animation: spin 0.7s linear infinite;
}

.voice-hint { font-size: 12px; color: var(--color-on-surface-variant); margin: 0; }
.voice-error { font-size: 12px; color: var(--color-error); margin: 0; }
.voice-summary { font-size: 12px; color: var(--color-on-surface-variant); margin: 0; }
.voice-summary b { color: var(--color-on-surface); }

/* Green pulse on a field freshly filled by voice. */
.field-voice-updated { animation: voiceFillPulse 1.8s ease-in-out; }
@keyframes voiceFillPulse {
    0%   { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.40); border-color: #10B981; }
    50%  { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.18); border-color: #10B981; }
    100% { box-shadow: none; }
}

/* Amber ring on a required field the dictation left empty. */
.field-missing-alert {
    border-color: #F59E0B !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25) !important;
}
