/* ==========================================================================
   Design System & CSS Variables - AlimentosEquivalentes.com
   Clinical, Minimalist, Ultra-Fast, Mobile-First
   ========================================================================== */

:root {
    /* Brand & Clinical Color Palette */
    --primary: #059669;          /* Emerald Green */
    --primary-hover: #047857;
    --primary-light: #ecfdf5;
    --primary-glow: rgba(5, 150, 105, 0.15);

    --accent: #0284c7;           /* Medical Sky Blue */
    --accent-light: #f0f9ff;

    --dark: #0f172a;             /* Slate 900 */
    --text-primary: #1e293b;     /* Slate 800 */
    --text-secondary: #64748b;   /* Slate 500 */
    --text-muted: #94a3b8;       /* Slate 400 */

    --bg-main: #f8fafc;          /* Off-white clinical bg */
    --surface: #ffffff;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;

    /* Nutrient Colors */
    --color-calories: #ea580c;   /* Vibrant Orange */
    --color-protein: #4f46e5;    /* Deep Indigo */
    --color-fat: #d97706;        /* Warm Amber */
    --color-carbs: #0284c7;      /* Ocean Cyan */

    /* Typography */
    --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Shadows & Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(5, 150, 105, 0.18);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modo Oscuro Clínico (Dark Mode Theme) */
[data-theme="dark"] {
    --dark: #f8fafc;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;

    --bg-main: #0b1324;
    --surface: #152037;
    --border: #233252;
    --border-hover: #334468;

    --primary-light: rgba(5, 150, 105, 0.2);
    --accent-light: rgba(2, 132, 199, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
}

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

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.hidden {
    display: none !important;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    background: var(--primary);
    color: #ffffff;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    z-index: 9999;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 1rem;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1rem;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #0f172a;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Header Navbar */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.header-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0.9rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #ffffff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.25);
}

.brand-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--dark);
    letter-spacing: -0.02em;
}

.brand-dot {
    color: var(--primary);
}

.brand-subtitle {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-link-btn {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    border: 1px solid rgba(5, 150, 105, 0.2);
    transition: var(--transition);
}

.nav-link-btn:hover {
    background: var(--primary);
    color: #ffffff;
}

.badge-smae {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(5, 150, 105, 0.2);
    letter-spacing: 0.03em;
}

/* Main Layout Structure */
.main-content {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem 1.25rem;
    flex: 1;
}

/* Hero & Search Section */
.search-section {
    text-align: center;
    margin-bottom: 1.5rem;
}

.hero-text h1 {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.25;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.hero-text p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 650px;
    margin: 0 auto 1.75rem auto;
}

/* Search Input Box */
.search-box-container {
    position: relative;
    max-width: 720px;
    margin: 0 auto 1.25rem auto;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition);
}

.search-input-wrapper input {
    width: 100%;
    padding: 1.1rem 5.5rem 1.1rem 3.4rem;
    font-size: 1.1rem;
    font-family: var(--font-body);
    font-weight: 500;
    color: var(--text-primary);
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    outline: none;
    transition: var(--transition);
}

.search-input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow), var(--shadow-md);
}

.mic-search-btn {
    position: absolute;
    right: 2.8rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.mic-search-btn:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.mic-search-btn.recording {
    color: #ef4444;
    animation: micPulse 1.2s infinite alternate;
}

@keyframes micPulse {
    from { transform: scale(1); filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.4)); }
    to { transform: scale(1.2); filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.8)); }
}

.clear-search-btn {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.clear-search-btn:hover {
    color: var(--dark);
    background: var(--bg-main);
}

/* Suggestions Dropdown */
.suggestions-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 480px;
    overflow-y: auto;
    z-index: 50;
    list-style: none;
    padding: 0.5rem 0;
    text-align: left;
}

.suggestion-item {
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover, .suggestion-item.highlighted {
    background-color: var(--primary-light);
}

.suggestion-name mark {
    background-color: rgba(5, 150, 105, 0.2);
    color: var(--primary-hover);
    padding: 0 2px;
    border-radius: 2px;
}

.suggestion-group {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    background: var(--bg-main);
    color: var(--text-secondary);
}

/* Filter Chips */
.filter-chips-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.chip {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.chip.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

/* Smart Nutritional Filters */
.smart-filters-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.smart-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
}

.smart-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.smart-chip {
    background: var(--accent-light);
    border: 1px solid rgba(2, 132, 199, 0.25);
    color: var(--accent);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.smart-chip:hover, .smart-chip.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

/* Favorites Section ⭐ */
.favorites-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.favorites-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #d97706;
}

.favorites-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.fav-chip {
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.fav-chip:hover {
    background: #fde68a;
    transform: translateY(-1px);
}

/* Search Counter Badge */
.search-counter-wrapper {
    text-align: center;
    margin-bottom: 1.5rem;
}

.search-counter-badge {
    display: inline-block;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.3rem 0.85rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}

.search-counter-badge strong {
    color: var(--primary);
}

/* Results Section & Card */
.results-section {
    margin-bottom: 2.5rem;
}

.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    animation: fadeIn 0.3s ease-out;
}

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

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.header-actions-card {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.card-button-row {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.fav-toggle-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.fav-toggle-btn:hover {
    border-color: #d97706;
    color: #d97706;
}

.fav-toggle-btn.is-fav {
    background: #fef3c7;
    border-color: #fde68a;
    color: #b45309;
}

.whatsapp-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #25d366;
    color: #ffffff;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
}

.whatsapp-share-btn:hover {
    background: #128c7e;
}

.copy-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--primary-light);
    color: var(--primary-hover);
    border: 1px solid rgba(5, 150, 105, 0.25);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.copy-card-btn:hover {
    background: var(--primary);
    color: #ffffff;
}

.food-title-group h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.food-portion {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.food-group-tag {
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* Category Colors */
.tag-frutas { background: #ffedd5; color: #c2410c; }
.tag-verduras { background: #dcfce7; color: #15803d; }
.tag-cereales { background: #fef3c7; color: #b45309; }
.tag-aoa { background: #e0e7ff; color: #4338ca; }
.tag-leguminosas { background: #f3e8ff; color: #6b21a8; }
.tag-grasas { background: #ccfbf1; color: #0f766e; }
.tag-leche { background: #e0f2fe; color: #0369a1; }
.tag-azucares { background: #fce7f3; color: #be185d; }
.tag-libres { background: #ecfdf5; color: #047857; }
.tag-alcohol { background: #fae8ff; color: #86198f; }
.tag-default { background: #f1f5f9; color: #475569; }

/* Portion Multiplier Calculator & Grams */
.portion-calculator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.calc-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.calc-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.calc-buttons {
    display: flex;
    gap: 0.4rem;
}

.multiplier-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.multiplier-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.multiplier-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* Custom Grams Wrapper */
.custom-grams-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.grams-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.grams-input-box {
    display: inline-flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.2rem 0.5rem;
}

.grams-input-box input {
    width: 60px;
    border: none;
    outline: none;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-body);
    color: var(--text-primary);
    background: transparent;
    text-align: right;
}

.grams-unit {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-box {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    transition: var(--transition);
}

.metric-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.metric-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    display: block;
}

.metric-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
}

.metric-unit {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.calories-val { color: var(--color-calories); }
.protein-val { color: var(--color-protein); }
.fat-val { color: var(--color-fat); }
.carbs-val { color: var(--color-carbs); }

/* Macro Breakdown Bar */
.macro-breakdown-section {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.breakdown-legend {
    display: flex;
    gap: 0.75rem;
    font-size: 0.78rem;
}

.dot-prot { color: var(--color-protein); }
.dot-fat { color: var(--color-fat); }
.dot-carbs { color: var(--color-carbs); }

.macro-bar-container {
    height: 12px;
    width: 100%;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
    display: flex;
}

.macro-bar-seg {
    height: 100%;
    transition: width 0.4s ease;
}

.seg-prot { background-color: var(--color-protein); }
.seg-fat { background-color: var(--color-fat); }
.seg-carbs { background-color: var(--color-carbs); }

/* Dual Food Comparator Section */
.comparator-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-sm);
}

.comparator-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.comparator-box {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.compare-select {
    width: 100%;
    padding: 0.6rem;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-primary);
    outline: none;
}

.cmp-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cmp-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--dark);
}

.cmp-portion {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.cmp-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.cmp-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem;
    text-align: center;
}

.cmp-stat small {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.cmp-stat strong {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--dark);
}

/* Clinical Daily Equivalents Calculator Section */
.calculator-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-sm);
}

.calc-header h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.calc-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.eer-form {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.eer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.eer-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.eer-group.full-width {
    grid-column: span 4;
}

.eer-group label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
}

.eer-group input, .eer-group select {
    padding: 0.6rem 0.8rem;
    font-size: 0.92rem;
    font-family: var(--font-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    background: var(--surface);
    color: var(--text-primary);
}

.calculate-btn {
    width: 100%;
    background: var(--primary);
    color: #ffffff;
    padding: 0.85rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.calculate-btn:hover {
    background: var(--primary-hover);
}

.eer-result-card {
    background: var(--primary-light);
    border: 1.5px solid rgba(5, 150, 105, 0.3);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-top: 1.25rem;
}

.eer-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.print-plan-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--dark);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.print-plan-btn:hover {
    background: var(--primary);
    color: #ffffff;
}

.eer-summary-box h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.highlight-kcal {
    color: var(--primary);
}

.eq-table-responsive {
    overflow-x: auto;
    margin-top: 1rem;
}

.eq-result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.eq-result-table th {
    background: var(--surface);
    color: var(--dark);
    font-weight: 700;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border);
}

.eq-result-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

/* Alternatives Section */
.alternatives-section {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.alternatives-section h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.alternatives-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.alt-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.alt-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* Native Transition Banner */
.native-banner-container {
    margin-bottom: 3rem;
}

.native-banner {
    background: linear-gradient(135deg, #064e3b 0%, #0f172a 100%);
    border-radius: var(--radius-lg);
    padding: 1.75rem 2rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.banner-badge {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.banner-content h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.banner-content p {
    font-size: 0.95rem;
    color: #cbd5e1;
}

.banner-cta-btn {
    background: var(--primary);
    color: #ffffff;
    padding: 0.85rem 1.4rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.4);
}

.banner-cta-btn:hover {
    background: #047857;
    transform: translateY(-2px);
}

/* Summary Reference Table */
.summary-table-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-sm);
}

.summary-table-section h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.summary-table-sub {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.table-responsive {
    overflow-x: auto;
}

.smae-reference-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.smae-reference-table th {
    background: var(--bg-main);
    color: var(--dark);
    font-weight: 700;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border);
}

.smae-reference-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.smae-reference-table tr:hover td {
    background: var(--primary-light);
}

/* FAQ Accordion Section */
.faq-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-sm);
}

.faq-section h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 1.25rem;
}

.faq-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.faq-item[open] {
    border-color: var(--primary);
    background: var(--primary-light);
}

.faq-question {
    padding: 1rem 1.25rem;
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--dark);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
}

.faq-question::-webkit-details-marker {
    display: none;
}

.faq-answer {
    padding: 0 1.25rem 1rem 1.25rem;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* SEO Content Section */
.seo-content-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.25rem;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-sm);
}

.seo-article h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 1rem;
}

.seo-article h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dark);
    margin: 1.5rem 0 0.5rem 0;
}

.seo-article p {
    color: var(--text-secondary);
    font-size: 0.98rem;
    margin-bottom: 1rem;
    line-height: 1.7;
}

.seo-article a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: var(--transition);
}

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

/* Modal Lead Capture & OTP Inputs */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.25rem;
}

.modal-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    max-width: 480px;
    width: 100%;
    padding: 2.25rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.modal-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem auto;
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.modal-header p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.modal-form {
    text-align: left;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.form-group input[type="email"] {
    width: 100%;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition);
    background: var(--bg-main);
    color: var(--text-primary);
}

.form-group input[type="email"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* OTP 6-Digit Container */
.otp-inputs-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.otp-box {
    width: 46px;
    height: 54px;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    color: var(--text-primary);
    background: var(--bg-main);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition);
}

.otp-box:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.otp-actions-row {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.text-link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    font-size: 0.82rem;
    text-decoration: underline;
    transition: var(--transition);
}

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

.submit-btn {
    width: 100%;
    background: var(--primary);
    color: #ffffff;
    padding: 0.9rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.submit-btn:hover {
    background: var(--primary-hover);
}

.privacy-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.85rem;
}

.modal-success {
    text-align: center;
    padding: 0.5rem 0;
}

.success-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem auto;
}

.modal-success h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.modal-success p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.app-redirect-box {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.app-redirect-box p {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.85rem;
}

.playstore-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: #000000;
    color: #ffffff;
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    transition: var(--transition);
}

.playstore-btn:hover {
    background: #1e293b;
}

.close-modal-btn {
    background: none;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: var(--transition);
}

.close-modal-btn:hover {
    border-color: var(--text-secondary);
    color: var(--dark);
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: auto;
}

.footer-container {
    max-width: 900px;
    margin: 0 auto;
}

.disclaimer {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 0.5rem;
}

/* Print Stylesheet for Clinical PDF Export with Professional Header */
@media print {
    .header, .search-section, .search-counter-wrapper, .native-banner-container,
    .faq-section, .seo-content-section, .summary-table-section, .modal-overlay, .footer,
    .copy-card-btn, .whatsapp-share-btn, .alternatives-section, .card-button-row, .eer-form, .print-plan-btn, .comparator-section, .skip-link {
        display: none !important;
    }

    body {
        background: #ffffff;
        color: #000000;
    }

    body::before {
        content: "AlimentosEquivalentes.com — Plan Clínico de Equivalentes SMAE | Generado para Paciente";
        display: block;
        font-family: sans-serif;
        font-size: 1rem;
        font-weight: bold;
        text-align: center;
        padding-bottom: 1rem;
        border-bottom: 2px solid #000000;
        margin-bottom: 1.5rem;
    }

    .main-content {
        padding: 0;
        max-width: 100%;
    }

    .result-card, .eer-result-card {
        box-shadow: none;
        border: 2px solid #000000;
        background: #ffffff !important;
    }
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    .hero-text h1 {
        font-size: 1.5rem;
    }

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

    .comparator-grid {
        grid-template-columns: 1fr;
    }

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

    .eer-group.full-width {
        grid-column: span 2;
    }

    .native-banner {
        flex-direction: column;
        text-align: center;
        padding: 1.75rem 1.25rem;
    }

    .banner-badge {
        position: static;
        display: inline-block;
        margin-bottom: 0.5rem;
    }

    .banner-cta-btn {
        width: 100%;
        justify-content: center;
    }

    .card-header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .header-actions-card {
        align-items: flex-start;
    }

    .portion-calculator {
        flex-direction: column;
        align-items: flex-start;
    }

    .otp-box {
        width: 38px;
        height: 46px;
        font-size: 1.25rem;
    }
}
