
/* --- DYNAMIC THEME VARIABLES --- */
:root {
--bg-color: #121212;
--card-bg: #1e1e1e;
--accent-gold: #d4af37;
--accent-gold-light: #f8dfa1;
--accent-red: #ed2939;
--accent-silver: #a0a0a0;
--accent-purple: #9b59b6;
--text-main: #e0e0e0;
--text-muted: #a0a0a0;
--glass-fill: #666666; /* Default for glass icon edges */

/* Input & Icons Matches Dark Theme */
--input-bg: rgba(255, 255, 255, 0.05);
--input-text: #ffffff;
--input-border: rgba(255, 255, 255, 0.1);
--icon-faint: rgba(255, 255, 255, 0.3);
--icon-hover: #ffffff;
--loader-glass-stem: rgba(255, 255, 255, 0.3);
}

/* Default (Dark): Show Sun to switch to Light */
#theme-toggle .icon-moon { display: none; }
#theme-toggle .icon-sun { display: block; }

/* Light Mode: Show Moon to switch to Dark */
[data-theme="light"] #theme-toggle .icon-moon { display: block; }
[data-theme="light"] #theme-toggle .icon-sun { display: none; }

/* Light Mode Overrides */
[data-theme="light"] {
--bg-color: #f4f1ea;
--card-bg: #f4f1ea; /* Match page background (Creamy) */
--text-main: #111111; /* Almost black */
--text-muted: #444444; /* Dark grey */
--glass-fill: #333333;

/* Light Mode Input */
--input-bg: #f4f1ea; /* Creamy */
--input-text: #000000;
--input-border: #999999;
--icon-faint: #444444; /* Very visible */
--icon-hover: #000000;
--loader-glass-stem: rgba(0, 0, 0, 0.5);
}

/* --- FONTS --- */
/* Using Google Fonts from index.php */

body {
background-color: var(--bg-color);
color: var(--text-main);
font-family: 'Lato', sans-serif;
margin: 0;
padding: 40px 20px 40px 20px; /* Reduced bottom padding */
display: flex;
flex-direction: column;
align-items: center;
min-height: 100vh;
overscroll-behavior-y: none;
}

/* --- THEME TOGGLE (Fixed Visibility) --- */
#theme-toggle {
position: fixed;
top: 20px;
left: 20px; /* Moved back to LEFT as requested */
right: auto;
background: none;
border: none;
color: var(--text-main); /* Stronger contrast */
cursor: pointer;
z-index: 2147483647; /* Max Z-Index */
padding: 8px;
border-radius: 50%;
transition: all 0.3s ease;
}

#theme-toggle svg {
width: 28px;
height: 28px;
display: block;
fill: none;
stroke: currentColor;
stroke-width: 2px;
}

/* Toggle Logic */
#theme-toggle .icon-moon { display: none !important; }
#theme-toggle .icon-sun { display: block !important; }

[data-theme="light"] #theme-toggle .icon-moon { display: block !important; }
[data-theme="light"] #theme-toggle .icon-sun { display: none !important; }

/* --- TWO-TONE ICONS --- */
.wine-icon-svg { width: 24px; height: 24px; vertical-align: middle; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.glass-path { fill: var(--glass-fill); opacity: 0.8; }
.liquid-path.red { fill: #b93d4f; }
.liquid-path.white { fill: #f2c94c; }
.liquid-path.rose { fill: #f29999; }
.liquid-path.sparkling { fill: #f2c94c; }
.liquid-path.dessert { fill: #d68910; }

/* --- BRANDING --- */
.brand-header {
text-align: center;
margin-bottom: 40px;
cursor: pointer;
padding-top: env(safe-area-inset-top);
}

h1 {
font-family: 'Playfair Display', serif;
font-size: 4rem;
margin: 0;
letter-spacing: -1px;
background: linear-gradient(to right, var(--accent-gold), var(--accent-gold-light), var(--accent-gold));
-webkit-background-clip: text;
background-clip: text;
color: transparent;
background-size: 200% auto;
animation: shine 6s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }

.subtitle-wrapper {
display: flex;
align-items: center;
justify-content: center;
gap: 15px;
margin-top: 5px;
}
.line { height: 1px; width: 30px; background: var(--text-muted); opacity: 0.3; }
.subtitle { color: var(--text-muted); font-style: italic; font-size: 1rem; font-weight: 300; letter-spacing: 1px; }

/* --- SEARCH BOX --- */
.search-container {
width: 100%;
max-width: 600px;
margin-bottom: 20px;
position: relative;
}

input[type="text"] {
width: 100%;
padding: 18px 160px 18px 25px;
background: var(--card-bg);
border: 1px solid #333;
color: white;
font-size: 1rem;
font-family: 'Playfair Display', serif;
border-radius: 50px;
box-sizing: border-box;
transition: all 0.3s ease;
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
-webkit-appearance: none;
}
input[type="text"]:focus {
outline: none;
border-color: var(--accent-gold);
box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

/* --- THEME TOGGLE --- */
#theme-toggle {
position: absolute;
top: 20px;
left: 20px;
right: auto;
background: none;
border: none;
color: var(--text-muted);
cursor: pointer;
z-index: 100;
padding: 8px;
border-radius: 50%;
transition: all 0.3s ease;
}

#camera-btn {
position: absolute;
right: 95px;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
color: var(--accent-gold);
cursor: pointer;
padding: 8px;
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.2s;
z-index: 3;
}
#camera-btn:hover { transform: translateY(-50%) scale(1.1); }
#camera-btn svg { width: 22px; height: 22px; fill: currentColor; }

#clear-btn {
position: absolute;
right: 130px;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
color: #fff;
font-size: 1.2rem;
cursor: pointer;
padding: 5px 10px;
display: none;
z-index: 2;
opacity: 0.6;
}
#clear-btn:hover { color: var(--accent-gold); opacity: 1; }

button.pair-btn {
position: absolute;
right: 6px;
top: 6px;
bottom: 6px;
background: var(--accent-gold);
color: #000;
border: none;
padding: 0 25px;
font-weight: bold;
cursor: pointer;
border-radius: 40px;
transition: all 0.3s;
font-family: 'Lato', sans-serif;
text-transform: uppercase;
font-size: 0.85rem;
letter-spacing: 1px;
z-index: 2;
}
button.pair-btn:hover {
background: var(--accent-gold-light);
transform: scale(1.02);
box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

/* --- TOGGLE SWITCH --- */
.toggle-container {
display: flex;
align-items: center;
justify-content: center;
gap: 12px;
margin-bottom: 50px;
color: var(--text-muted);
font-size: 0.9rem;
text-transform: uppercase;
letter-spacing: 1px;
}
.switch-toggle { position: relative; display: inline-block; width: 46px; height: 24px; }
.switch-toggle input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #333; transition:
.4s; border-radius: 34px; border: 1px solid #444; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 2px; background-color:
#888; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: rgba(212, 175, 55, 0.2); border-color: var(--accent-gold); }
input:checked + .slider:before { transform: translateX(20px); background-color: var(--accent-gold); }
.toggle-label.active { color: var(--accent-gold); font-weight: bold; }

/* --- RESULTS GRID --- */
#results { width: 100%; max-width: 1000px; display: grid; gap: 30px; grid-template-columns: 1fr; padding-bottom: 40px; }
@media (min-width: 768px) { #results { grid-template-columns: repeat(2, 1fr); } }

/* --- WINE CARD STYLES --- */
.wine-card {
background: var(--card-bg);
padding: 30px;
border-radius: 16px;
box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4); /* Pushed down to avoid tab overlap */
opacity: 1;
transform: translateY(0);
animation: slideUp 0.5s ease-out;
display: flex;
flex-direction: column;
border-top: 2px solid transparent;
position: relative;
overflow: hidden;
z-index: 5;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.wine-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background:
radial-gradient(circle at top right, rgba(255,255,255,0.03), transparent 60%); pointer-events: none; }

.card-primary { border-top-color: var(--accent-gold); background: linear-gradient(180deg, rgba(212, 175, 55, 0.08) 0%,
var(--card-bg) 100%); }
.card-local { border-top-color: var(--accent-red); background: linear-gradient(180deg, rgba(237, 41, 57, 0.08) 0%,
var(--card-bg) 100%); }
.card-alt { border-top-color: var(--accent-silver); }
.card-wild { border-top-color: var(--accent-purple); background: linear-gradient(180deg, rgba(155, 89, 182, 0.05) 0%,
var(--card-bg) 100%); }

.wine-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.wine-type { text-transform: uppercase; font-size: 0.75rem; letter-spacing: 2px; font-weight: 700; opacity: 0.9; }
.card-primary .wine-type { color: var(--accent-gold); }
.card-local .wine-type { color: var(--accent-red); }
.card-wild .wine-type { color: var(--accent-purple); }

.badge-container { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.05); padding: 4px 10px;
border-radius: 20px; border: 1px solid rgba(255,255,255,0.05); }
.temp-badge { color: var(--text-muted); font-size: 0.8rem; font-weight: bold; }

.wine-card h2 { font-family: 'Playfair Display', serif; margin: 0 0 8px 0; color: var(--text-main); font-size: 1.6rem;
line-height: 1.1; }
.region { font-style: italic; color: var(--text-muted); margin-bottom: 25px; display: block; font-size: 1rem; }
.chart-container { width: 100%; max-width: 280px; aspect-ratio: 1 / 1; min-height: 250px; margin: 0 auto 25px auto;
position: relative; }
.reasoning { line-height: 1.7; font-weight: 300; margin-bottom: 35px; flex-grow: 1; font-size: 0.95rem; color: #ccc; }

.card-footer { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid rgba(255,255,255,0.05);
padding-top: 20px; margin-top: auto; }

.shop-btn {
text-decoration: none;
padding: 8px 16px;
border-radius: 8px;
font-size: 0.7rem;
font-weight: bold;
transition: all 0.2s;
background: transparent;
border: 1px solid #444;
color: #aaa;
letter-spacing: 0.5px;
text-transform: uppercase;
cursor: pointer;
}
.shop-btn:hover { color: #fff; border-color: #fff; transform: translateY(-2px); }

#share-section { display: none; margin-top: 15px; margin-bottom: 50px; text-align: center; }
.share-btn { background: transparent; color: var(--accent-gold); border: 1px solid var(--accent-gold); padding: 6px
14px;
font-family: 'Lato', sans-serif; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; border-radius:
30px; cursor: pointer; transition: all 0.3s; display: inline-flex; align-items: center; gap: 6px; }
.share-btn:hover { background: rgba(212, 175, 55, 0.1); transform: translateY(-2px); }

#toast { visibility: hidden; min-width: 250px; background-color: #333; color: #fff; text-align: center; border-radius:
50px; padding: 16px; position: fixed; z-index: 1; left: 50%; bottom: 30px; transform: translateX(-50%); font-size: 1rem;
box-shadow: 0 5px 15px rgba(0,0,0,0.5); opacity: 0; transition: opacity 0.5s, bottom 0.5s; }
#toast.show { visibility: visible; opacity: 1; bottom: 50px; }

/* --- LOADER --- */
#loader-container {
display: none;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 40px auto;
height: 200px;
}


.loader-text {
font-size: 1.2rem;
font-weight: 400;
font-style: italic;
letter-spacing: 0.5px;
color: #888;
transition: color 0.5s ease, opacity 0.5s ease;
text-align: center;
min-height: 20px;
margin-top: 10px;
}

.loader-text.fading {
opacity: 0;
transform: translateY(5px);
}

/* --- MEAL PREP LOADER (Pan Flip) --- */
/* --- MEAL PREP LOADER (Steaming Pot - V3) --- */
.meal-prep-loader {
display: none;
position: relative;
width: 120px;
height: 120px;
margin: 0 auto 10px auto;
}

.pot {
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
width: 70px;
height: 50px;
background: #222;
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
/* No Border, Sleek Look */
z-index: 10;
box-shadow: inset 0 -5px 10px rgba(0, 0, 0, 0.8), 0 5px 15px rgba(0, 0, 0, 0.5);
}

/* Pot Handles */
.pot::after {
content: '';
position: absolute;
top: 5px;
left: -10px;
width: 90px;
height: 6px;
background: #222;
border-radius: 4px;
z-index: -1;
}

/* Swirling Steam */
.steam {
position: absolute;
bottom: 75px;
width: 8px;
height: 20px;
background: rgba(255, 255, 255, 0.4);
border-radius: 10px;
filter: blur(3px);
animation: swirl 2.5s infinite linear;
opacity: 0;
transform-origin: center bottom;
}

.steam:nth-child(1) {
left: 45px;
animation-delay: 0s;
}

.steam:nth-child(2) {
left: 60px;
animation-delay: 0.8s;
height: 28px;
}

.steam:nth-child(3) {
left: 75px;
animation-delay: 1.6s;
}

@keyframes swirl {
0% {
transform: translateY(0) translateX(0) scaleY(1) rotate(0deg);
opacity: 0;
}

20% {
opacity: 0.6;
}

50% {
transform: translateY(-20px) translateX(-5px) scaleY(1.5) rotate(-10deg);
}

80% {
opacity: 0.4;
}

100% {
transform: translateY(-50px) translateX(5px) scaleY(2) rotate(10deg);
opacity: 0;
}
}

/* Falling Ingredients */
.ingredient {
position: absolute;
top: -20px;
/* Start higher */
left: 50%;
font-size: 1.2rem;
animation: fall 1.5s infinite ease-in;
opacity: 0;
z-index: 5;
}

.ingredient:nth-child(4) {
animation-delay: 0s;
margin-left: -15px;
}

.ingredient:nth-child(5) {
animation-delay: 0.5s;
margin-left: 5px;
}

.ingredient:nth-child(6) {
animation-delay: 1.0s;
margin-left: -5px;
}

@keyframes fall {
0% {
transform: translateY(0) rotate(0deg);
opacity: 1;
}

60% {
transform: translateY(80px) rotate(180deg);
opacity: 1;
}

100% {
transform: translateY(90px) rotate(220deg);
opacity: 0;
}
}

/* --- UNIFIED CARD LAYOUT --- */
#results {
display: block;
margin-top: 0;
max-width: 800px;
margin-left: auto;
margin-right: auto;
}

.wine-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 12px;
border-bottom-right-radius: 12px;
border-top: none;
padding: 25px;
transition: transform 0.2s;
display: none;
flex-direction: column;
height: auto;
position: relative;
min-height: 400px;
animation: fadeIn 0.3s ease;
}

.wine-card.active {
display: flex;
}

.wine-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 5px;
font-size: 0.8rem;
letter-spacing: 1px;
text-transform: uppercase;
font-weight: 700;
}

.card-primary {
border-top: none;
}

.card-local {
border-top: none;
}

.card-alt {
border-top: none;
}

.card-wild {
border-top: none;
}

.wine-body h2 {
font-size: 1.8rem;
margin: 0 0 5px 0;
line-height: 1.2;
color: var(--text-main);
font-weight: 700;
}

.region {
color: #888;
font-style: italic;
margin-bottom: 20px;
display: block;
}

.reasoning {
font-size: 1rem;
line-height: 1.6;
color: var(--text-muted);
margin-top: 20px;
flex-grow: 1;
}

.card-footer {
margin-top: 20px;
padding-top: 20px;
border-top: 1px solid var(--input-border);
text-align: center;
}

.chart-container {
max-height: 220px;
margin-bottom: 10px;
}

/* --- UNIFIED TABS --- */
#tabs-nav {
display: flex;
width: 100%;
max-width: 800px;
margin: 0 auto;
gap: 4px; /* Small gap for folder effect */
position: relative;
z-index: 50;
margin-bottom: -1px;
/* padding: 0 4px; REMOVED to align flush */
/* The continuous line runs ALONG THE BOTTOM of the container */
/* But we want it to go UP around the active tab. */
/* Actually, easier: Container has accent border. Active Tab has Card-BG border-bottom. */
/* AND Active Tab has accent border-top/sides. */
border-bottom: 1px solid var(--active-tab-color, #d4af37);
}

#tabs-nav:empty { display: none; }

.tab-btn {
flex: 1;
background: var(--card-bg);
color: var(--text-muted);
padding: 12px 2px;
text-align: center;
border-radius: 6px 6px 0 0;
font-size: 0.65rem;
font-weight: 800;
text-transform: uppercase;
cursor: pointer;
transition: all 0.2s;

/* Folder Tab Defaults: Thick Top, Thin Sides, No Bottom */
border-style: solid;
border-width: 3px 1px 0 1px;
border-color: transparent; /* Overridden by specific classes */

position: relative;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
opacity: 0.7;
margin-bottom: 0;
}

.tab-btn:hover:not(.active) { opacity: 0.95; }

/* Specific Tab Colors */
.tab-btn[data-target="primary"], .tab-btn[data-target="canon"] {
border-color: #d4af37;
color: #d4af37;
}

.tab-btn[data-target="local"], .tab-btn[data-target="local_tradition"] {
border-color: #ed2939;
color: #ed2939;
}

.tab-btn[data-target="alt"], .tab-btn[data-target="weeknight"] {
border-color: #a0a0a0;
color: #a0a0a0;
}

.tab-btn[data-target="wild"], .tab-btn[data-target="project"] {
border-color: #9b59b6;
color: #9b59b6;
}

.tab-btn[data-target="platter"] {
border-color: #4ecdc4;
color: #4ecdc4;
}

.tab-btn.active {
background: var(--card-bg);
color: var(--active-tab-color, #d4af37);

/* Active: Inherit specific border colors, adds bottom merge */
border-bottom: 1px solid var(--card-bg);

opacity: 1;
z-index: 20;
margin-bottom: -1px;
padding-bottom: 13px;
box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

/* --- TOUR OVERLAY (V27.4 Crystal Clear) --- */
#tour-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: transparent;
z-index: 999;
display: none;
}

.tour-spotlight {
position: absolute;
border: 2px solid var(--accent-gold);
border-radius: 12px;
box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85);
/* Dark focus area */
pointer-events: none;
transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
z-index: 1000;
}

.tour-tooltip {
position: absolute;
width: 200px;
background: #1a1a1a;
border: 1px solid var(--accent-gold);
border-radius: 8px;
padding: 12px;
color: #fff;
z-index: 1001;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
transition: all 0.4s ease;
}

.tour-title {
color: var(--accent-gold);
margin: 0 0 8px 0;
font-size: 1rem;
font-family: 'Playfair Display', serif;
}

.tour-text {
font-family: 'Lato', sans-serif;
font-size: 0.85rem;
line-height: 1.4;
color: #ccc;
margin-bottom: 12px;
}

.tour-actions {
display: flex;
justify-content: space-between;
align-items: center;
}

.tour-btn {
background: var(--accent-gold);
color: #000;
border: none;
padding: 6px 14px;
border-radius: 4px;
font-weight: bold;
cursor: pointer;
font-size: 0.8rem;
font-family: 'Lato', sans-serif;
}

.tour-skip {
background: transparent;
border: none;
color: #666;
cursor: pointer;
font-size: 0.8rem;
text-decoration: underline;
font-family: 'Lato', sans-serif;
}

#recall-tour-btn {
background: none;
border: 1px solid #444;
color: #666;
width: 24px;
height: 24px;
border-radius: 50%;
font-size: 14px;
cursor: pointer;
margin-left: 10px;
display: inline-flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
}

#recall-tour-btn:hover {
border-color: var(--accent-gold);
color: var(--accent-gold);
}


/* --- SWIPE HINT --- */
.swipe-hint-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.4);
z-index: 50;
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
pointer-events: none;
transition: opacity 0.5s ease;
border-radius: 12px;
}

.swipe-icon-box {
background: rgba(0, 0, 0, 0.8);
padding: 15px 25px;
border-radius: 30px;
display: flex;
align-items: center;
gap: 10px;
border: 1px solid rgba(255, 255, 255, 0.2);
}

.swipe-text {
color: #fff;
font-size: 0.9rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 1px;
}

.swipe-arrows {
font-size: 1.2rem;
color: var(--accent-gold);
animation: pulseSwipe 1.5s infinite;
}

@keyframes pulseSwipe {

0%,
100% {
transform: translateX(0);
opacity: 0.5;
}

50% {
transform: translateX(5px);
opacity: 1;
}
}

/* Responsive adjustments */
@media (max-width: 768px) {
.brand-header {
padding: 15px 0 10px;
}

.brand-header h1 {
font-size: 2.5rem;
margin-bottom: 5px;
}

.search-container {
margin: 10px auto;
max-width: 95%;
}

.toggle-container {
margin: 5px auto 15px;
}
}

@media (min-width: 769px) {
.swipe-hint-overlay {
display: none !important;
}
}

@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(5px);
}

to {
opacity: 1;
transform: translateY(0);
}
}

/* --- REVERSE UI FIXES (Grid Layout) --- */
.search-container {
display: grid;
grid-template-columns: 1fr auto;
gap: 10px;
align-items: center;
height: 54px;
position: relative;
/* Safe to keep, but Grid enforces structure */
width: 100%;
}

/* Wrapper for Input + Icons */
.input-wrapper {
position: relative;
width: 100%;
height: 100%;
display: flex;
align-items: center;
}

/* Input - relative to wrapper */
.search-container input {
height: 54px;
width: 100%;
padding: 0 150px 0 50px !important;
/* L: Swap, R: Clear+Cam+Pair */
font-size: 1.1rem;
border: 1px solid var(--input-border);
border-radius: 12px;
background: var(--input-bg);
color: var(--input-text);
outline: none;
box-sizing: border-box;
transition: border-color 0.3s, box-shadow 0.3s, background 0.3s, color 0.3s;
line-height: normal;
/* Reset line-height for correct text centering */
}

.search-container input:focus {
border-color: rgba(255, 255, 255, 0.3);
box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* Absolute positioning relative to .input-wrapper */
#swap-btn {
position: absolute;
left: 5px;
top: 50%;
transform: translateY(-50%);
background: transparent;
border: none;
color: var(--icon-faint);
cursor: pointer;
z-index: 20;
width: 44px;
height: 44px;
display: flex;
align-items: center;
justify-content: center;
transition: color 0.3s, transform 0.3s ease;
}

#swap-btn:hover {
color: #d4af37;
}

/* Reverse Mode: Container-based Styling */
.search-container.reverse-mode input {
border-color: #d4af37;
box-shadow: 0 0 12px rgba(212, 175, 55, 0.25);
}

.search-container.reverse-mode #swap-btn {
color: #d4af37;
transform: translateY(-50%) rotate(180deg);
}

#camera-btn {
position: absolute;
right: 100px;
/* Left of Pair Button */
top: 50%;
transform: translateY(-50%);
background: transparent;
border: none;
color: #666;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
z-index: 21;
}

#clear-btn {
position: absolute;
right: 100px;
/* Same as Camera (Smart Toggle) */
top: 50%;
transform: translateY(-50%);
background: transparent;
border: none;
color: #666;
width: 30px;
height: 30px;
display: none;
align-items: center;
justify-content: center;
font-size: 1.2rem;
z-index: 21;
cursor: pointer;
}

/* Pair button - embedded absolute */
.pair-btn {
position: absolute !important;
right: 6px !important;
top: 6px !important;
bottom: 6px !important;
height: auto !important;
margin: 0 !important;
padding: 0 25px !important;
border-radius: 50px !important;
background: var(--accent-gold);
color: #000;
font-weight: 900;
cursor: pointer;
z-index: 20;
display: flex;
align-items: center;
white-space: nowrap;
transition: transform 0.1s;
}

.pair-btn:active {
transform: scale(0.98);
}

/* --- FOOD CARD DETAILS LAYOUT --- */
.food-details-container {
display: flex;
flex-direction: column;
gap: 20px;
margin-top: 15px;
}

.food-info-col h2 {
margin-top: 0;
line-height: 1.2;
}

.food-ingr-col {
font-size: 0.95rem;
color: var(--text-muted);
background: var(--input-bg);
padding: 20px;
border-radius: 12px;
}

.food-ingr-col strong {
display: block;
margin-bottom: 8px;
color: var(--text-main);
text-transform: uppercase;
font-size: 0.8rem;
letter-spacing: 1px;
}

.prep-stats {
display: inline-flex;
align-items: center;
gap: 12px;
background: var(--input-bg);
padding: 6px 14px;
border-radius: 50px;
font-size: 0.8rem;
border: 1px solid var(--input-border);
margin: 10px 0 20px 0;
/* Mobile spacing: Below text, above ingredients */
}

.food-details-container {
display: flex;
flex-direction: column;
gap: 15px;
/* Mobile gap */
margin-top: 15px;
}

.food-ingr-col {
font-size: 0.95rem;
color: #ccc;
background: rgba(255, 255, 255, 0.03);
padding: 20px;
border-radius: 12px;
margin-top: 0;
/* Reset mobile margin */
}
/* --- INGREDIENT PILLS (Reverse Mode) --- */
.ingredient-pill {
display: inline-block;
padding: 4px 12px;
margin: 3px;
background: rgba(255, 255, 255, 0.1);
border-radius: 20px;
font-size: 0.85rem;
color: #ddd;
}

[data-theme="light"] .ingredient-pill {
background: rgba(0, 0, 0, 0.05); /* Light grey background */
color: var(--text-main); /* Dark text */
border: 1px solid rgba(0,0,0,0.1);
}

/* --- DIETARY TOGGLES (Reinforced) --- */
.dietary-option {
/* Base styles implied */
}

[data-theme="light"] .dietary-option,
[data-theme="light"] .dietary-option.active {
background: transparent !important;
opacity: 1;
}

[data-theme="light"] .dietary-option span {
color: #333 !important;
}

[data-theme="light"] .dietary-option > div {
border-color: #999 !important;
}

[data-theme="light"] .dietary-option.active span {
color: var(--accent-gold) !important;
}

[data-theme="light"] .dietary-option.active > div {
border-color: var(--accent-gold) !important;
}

[data-theme="light"] .dietary-option.active {
color: #d4af37 !important;
border-color: #d4af37 !important;
background: var(--bg-color) !important;
opacity: 1 !important;
font-weight: bold;
}
@media (min-width: 768px) {
.input-wrapper {
height: 54px;
}

.prep-stats {
position: absolute;
top: 20px;
right: 20px;
margin: 0;
pointer-events: none;
}

.food-details-container {
flex-direction: row;
align-items: flex-start;
gap: 60px;
/* Desktop gap */
}

.food-info-col {
flex: 1 1 60%;
margin-bottom: 35px;
/* Desktop spacing */
}

.food-ingr-col {
flex: 0 0 300px;
background: transparent;
padding: 0 0 0 40px;
border-radius: 0;
border: none;
border: none;
margin-top: 80px !important;
/* Specific Desktop vertical shift */
}
}
/* --- MODALS (Shared Styles) --- */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); z-index: 1000;
display: none; align-items: flex-end; justify-content: center; backdrop-filter: blur(5px); animation: fadeIn 0.2s
ease-out; }

.modal-content { background: var(--card-bg); width: 100%; max-width: 500px; border-radius: 20px 20px 0 0; padding: 30px;
display: flex; flex-direction: column; gap: 15px; border-top: 2px solid var(--accent-gold); transform: translateY(100%);
animation: slideUpModal 0.3s ease-out forwards; }
@keyframes slideUpModal { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-btn { background: transparent; border: 1px solid #444; color: #fff; padding: 15px; font-size: 1.1rem;
border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
font-family: 'Lato', sans-serif; transition: all 0.2s; text-decoration: none; }

/* Light Mode Override for Modal Buttons */
[data-theme="light"] .modal-btn {
color: #333;
border-color: #ccc;
background: rgba(0,0,0,0.05);
}
[data-theme="light"] .modal-btn:hover {
background: rgba(0,0,0,0.1);
border-color: #999;
}
.modal-btn:hover { background: rgba(255,255,255,0.05); border-color: #fff; }
@media (min-width: 768px) { .modal-overlay { align-items: center; } .modal-content { border-radius: 20px; } }

@media (max-width: 480px) {
input[type="text"] {
font-size: 0.85rem;
padding-left: 20px;
padding-right: 140px; /* Squeeze buttons slightly if needed, but mainly shrink text */
}
::placeholder {
font-size: 0.85rem;
}
}

/* --- APP FOOTER --- */
.app-footer { margin-top: auto; padding: 20px; text-align: center; font-size: 0.8rem; color: var(--text-muted); width:
100%; border-top: 1px solid rgba(255,255,255,0.05); }
.app-footer a { color: var(--text-muted); text-decoration: none; margin: 0 10px; transition: color 0.3s; }
.app-footer a:hover { color: var(--accent-gold); }

/* --- UPDATED WINE LOADER (V25.5) --- */
.wine-glass-loader {
position: relative;
width: 60px;
height: 94px;
margin-bottom: 20px;
display: flex;
flex-direction: column;
align-items: center;
}

.glass-bowl {
width: 60px;
height: 60px;
border: 2px solid rgba(255, 255, 255, 0.4);
border-top: none;
border-radius: 0 0 30px 30px;
position: relative;
overflow: hidden;
box-sizing: border-box;
/* Glass Reflection */
background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 50%, rgba(255,255,255,0.05) 100%);
box-shadow: 0 0 15px rgba(255,255,255,0.1), inset 0 0 10px rgba(255,255,255,0.05);
}

.glass-stem {
width: 4px;
height: 30px;
background: rgba(255, 255, 255, 0.4);
margin: 0 auto;
position: relative;
z-index: -1;
}

.glass-base {
width: 40px;
height: 3px;
background: rgba(255, 255, 255, 0.4);
margin: 0 auto;
border-radius: 2px;
box-shadow: 0 5px 10px rgba(0,0,0,0.5);
}

.liquid {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 0%; /* JS controls this */
background: linear-gradient(to bottom, #d42a3a, #7a0c16); /* Richer Red Gradient */
transition: height 0.5s ease;
box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

/* Meniscus / Surface */
.liquid::after {
content: '';
position: absolute;
top: -4px;
left: 0;
width: 100%;
height: 8px;
background: rgba(255, 255, 255, 0.3);
border-radius: 50%;
transform: scaleX(0.8);
opacity: 0.7;
}