@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    /* Base HSL Color Tokens */
    --fizz-lime: hsl(82, 90%, 60%);
    --fizz-cyan: hsl(180, 95%, 55%);
    --fizz-mocha: hsl(28, 60%, 45%);
    --fizz-amber: hsl(38, 90%, 60%);
    
    --berry-punch: hsl(330, 95%, 65%);
    --fizz-orange: hsl(30, 100%, 60%);
    --citrus-yellow: hsl(50, 100%, 50%);
    --herbal-green: hsl(140, 70%, 50%);
    --spice-red: hsl(0, 85%, 55%);
    --sweet-lavender: hsl(270, 85%, 75%);
    --sour-lime: hsl(65, 100%, 50%);
    
    /* Dark Mode Deep Slate Palette */
    --bg-deep: hsl(225, 30%, 7%);
    --bg-base: hsl(225, 25%, 12%);
    --glass-surface: hsla(225, 25%, 18%, 0.7);
    --glass-border: hsla(0, 0%, 100%, 0.12);
    --glass-highlight: hsla(0, 0%, 100%, 0.05);
    
    --text-primary: hsl(0, 0%, 98%);
    --text-muted: hsl(225, 20%, 90%);
    --text-dim: hsl(225, 15%, 70%);
    
    --lab-accent-rgb: 164, 230, 76; /* Default Lime RGB for opacity usage */

    /* Defaults - Soda Theme */
    --lab-accent: var(--fizz-lime);
    --lab-accent-secondary: var(--fizz-cyan);
    --lab-accent-glow: hsla(82, 90%, 60%, 0.4);
    --lab-gradient: linear-gradient(135deg, var(--fizz-lime), var(--fizz-cyan));
}

/* Theme Overrides */
.theme-coffee {
    --lab-accent: var(--fizz-amber);
    --lab-accent-secondary: var(--fizz-mocha);
    --lab-accent-glow: hsla(38, 90%, 60%, 0.4);
    --lab-gradient: linear-gradient(135deg, var(--fizz-amber), var(--fizz-mocha));
}

.theme-slushie {
    --lab-accent: hsl(200, 95%, 65%);
    --lab-accent-secondary: hsl(185, 80%, 45%);
    --lab-accent-glow: hsla(200, 95%, 65%, 0.4);
    --lab-gradient: linear-gradient(135deg, hsl(200, 95%, 65%), hsl(185, 80%, 45%));
}

/* Global Reset & Theme */
body {
    background: radial-gradient(circle at top left, var(--bg-base), var(--bg-deep));
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background 1s ease;
    animation: neuralFadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes neuralFadeIn {
    from { opacity: 0; transform: translateY(10px); filter: blur(10px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* 🧬 Laboratory Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { 
    background: var(--glass-border); 
    border-radius: 10px;
    border: 1px solid transparent;
}
::-webkit-scrollbar-thumb:hover { background: var(--lab-accent); box-shadow: 0 0 10px var(--lab-accent-glow); }

/* Firefox */
* { scrollbar-width: thin; scrollbar-color: var(--glass-border) var(--bg-deep); }

/* Glassmorphism Classes */
.glass-surface {
    background: var(--glass-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 12px 40px hsla(0, 0%, 0%, 0.4);
}

.glass-card {
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    background: hsla(0, 0%, 100%, 0.08);
    transform: translateY(-4px);
    border-color: hsla(0, 0%, 100%, 0.25);
    box-shadow: 0 8px 24px hsla(0, 0%, 0%, 0.5);
}

/* Typography Enhancements */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.text-gradient-lab {
    background: var(--lab-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Mode Selectors & Buttons */
.btn-accent {
    background: var(--lab-gradient);
    border: none;
    color: var(--bg-deep) !important;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    box-shadow: 0 0 15px var(--lab-accent-glow);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn-accent:hover {
    transform: scale(1.02) translateY(-1px);
    box-shadow: 0 0 25px var(--lab-accent-glow);
    filter: brightness(1.1);
}

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

.glow-pulse {
    animation: glowPulse 2s infinite ease-in-out;
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 5px var(--lab-accent-glow); }
    50% { box-shadow: 0 0 15px var(--lab-accent-glow); }
}

.resonance-fringe {
    border-left: 3px solid var(--lab-accent) !important;
    background: linear-gradient(90deg, var(--lab-accent-glow) 0%, transparent 100%) !important;
}

.btn-glass-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 14px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.btn-glass-toggle:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.btn-glass-toggle.active {
    background: var(--lab-gradient);
    border-color: transparent;
    color: var(--bg-deep);
    box-shadow: 0 8px 25px var(--lab-accent-glow);
    transform: scale(1.05);
}

.active-lab-mode {
    background: hsla(0, 0%, 100%, 0.15) !important;
    color: var(--text-primary) !important;
    font-weight: 700;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}

/* Mixer Components */
.fizz-pill {
    border-radius: 100px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.fizz-pill.active {
    background: var(--lab-accent);
    color: var(--bg-deep);
    box-shadow: 0 0 20px var(--lab-accent-glow);
}

/* Custom Checkbox as Neon Toggle */
.neon-check {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--glass-border);
    appearance: none;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.neon-check:checked {
    background: var(--lab-accent);
    box-shadow: 0 0 10px var(--lab-accent);
}

/* =============================================
   🧪 Experimental / Accent Utility Classes
   ============================================= */
:root {
    --experimental: hsl(285, 90%, 65%);
    --experimental-glow: hsla(285, 90%, 65%, 0.4);
    --experimental-dark: hsl(285, 70%, 20%);
}

.text-experimental { color: var(--experimental) !important; }
.text-accent        { color: var(--lab-accent) !important; }
.border-experimental { border-color: var(--experimental) !important; }

.glow-experimental {
    box-shadow: 0 0 20px var(--experimental-glow);
}

.btn-outline-experimental {
    color: var(--experimental);
    border: 1px solid var(--experimental);
    background: transparent;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.25s ease;
}
.btn-outline-experimental:hover,
.btn-outline-experimental:focus {
    background: var(--experimental);
    color: white;
    box-shadow: 0 0 14px var(--experimental-glow);
}

/* Solid accent button — used for primary lab actions */
.btn-accent {
    background: var(--lab-gradient);
    color: var(--bg-deep);
    border: none;
    border-radius: 8px;
    font-weight: 700;
    letter-spacing: 0.03em;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px var(--lab-accent-glow);
}
.btn-accent:hover,
.btn-accent:focus {
    filter: brightness(1.1);
    box-shadow: 0 6px 20px var(--lab-accent-glow);
    color: var(--bg-deep);
}

/* btn-outline-accent: visible accent outline variant */
.btn-outline-accent {
    color: var(--lab-accent);
    border: 1px solid var(--lab-accent);
    background: transparent;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.25s ease;
}
.btn-outline-accent:hover,
.btn-outline-accent:focus {
    background: var(--lab-accent);
    color: var(--bg-deep);
    box-shadow: 0 0 14px var(--lab-accent-glow);
}

/* AI quick-action buttons active state */
.btn-quick-ai {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: 8px;
    padding: 0.3rem 0.6rem;
    transition: all 0.25s ease;
}
.btn-quick-ai.active-safe {
    background: var(--fizz-cyan);
    color: var(--bg-deep);
    border-color: transparent;
    box-shadow: 0 0 12px hsla(180, 95%, 55%, 0.4);
}
.btn-quick-ai.active-experimental {
    background: var(--experimental);
    color: white;
    border-color: transparent;
    box-shadow: 0 0 12px var(--experimental-glow);
}

/* Sub-compact utility buttons — used for undo/reset */
.btn-xs {
    padding: 0.15rem 0.4rem;
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    border-radius: 4px;
}

.hover-opacity-100:hover {
    opacity: 1 !important;
}

/* Hall of Fame Readouts */
.readout-card {
    background: hsla(0, 0%, 0%, 0.2);
    border-left: 3px solid var(--lab-accent);
    padding: 1rem;
    border-radius: 0 12px 12px 0;
}

.readout-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-dim) !important;
    opacity: 1 !important;
}

.border-lab {
    border: 1px solid var(--lab-accent) !important;
}

/* Category Badges (Premium) */
.badge-fizz {
    padding: 0.4em 0.8em;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
}

/* Bootstrap Overrides (Glass Style) */
.card {
    background: var(--glass-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: var(--text-primary);
}

.card-header {
    background: hsla(0, 0%, 100%, 0.05);
    border-bottom: 1px solid var(--glass-border);
    font-weight: 700;
}

.btn-primary {
    background: var(--lab-gradient);
    border: none;
    color: var(--bg-deep);
    font-weight: 700;
    border-radius: 12px;
    padding: 0.8rem 1.5rem;
}

.btn-outline-primary {
    border: 2px solid var(--lab-accent);
    color: var(--lab-accent);
    border-radius: 12px;
}

.btn-outline-primary:hover {
    background: var(--lab-accent);
    color: var(--bg-deep);
    box-shadow: 0 0 15px var(--lab-accent-glow);
}

.navbar {
    background: hsla(225, 30%, 7%, 0.9) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
}

.navbar-dark .navbar-nav .nav-link {
    color: var(--text-dim);
    font-weight: 500;
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: var(--text-primary);
}

.navbar-dark .navbar-nav .nav-link.active {
    color: var(--lab-accent) !important;
}

/* Sidebar Nav Pills (Settings) */
.nav-pills .nav-link {
    color: var(--text-dim);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.nav-pills .nav-link:hover {
    background: hsla(0, 0%, 100%, 0.05);
    color: var(--text-primary);
}

.nav-pills .nav-link.active {
    background: var(--lab-gradient) !important;
    color: var(--bg-deep) !important;
    box-shadow: 0 4px 15px var(--lab-accent-glow);
}

/* Category Colors */
.bg-citrus { background-color: var(--citrus-yellow) !important; color: #000; }
.bg-berry { background-color: var(--berry-punch) !important; }
.bg-tropical { background-color: var(--fizz-orange) !important; }
.bg-herbal { background-color: var(--herbal-green) !important; }
.bg-spice { background-color: var(--spice-red) !important; }
.bg-sweet { background-color: var(--sweet-lavender) !important; color: #000; }
.bg-sour { background-color: var(--sour-lime) !important; color: #000; }
.bg-artificial { background-color: var(--fizz-cyan) !important; color: #000; }
.bg-coffee { background-color: var(--fizz-mocha) !important; }

@media (max-width: 768px) {
    .glass-surface { border-radius: 0; }
}

/* Animations */
@keyframes bubble-fizz {
    0% { transform: translateY(0); opacity: 0.7; }
    50% { transform: translateY(-10px); opacity: 1; }
    100% { transform: translateY(0); opacity: 0.7; }
}

.fizzing {
    animation: bubble-fizz 3s infinite ease-in-out;
}

/* Form Accessibility & Contrast */
::placeholder {
    color: hsla(0, 0%, 100%, 0.65) !important;
    font-weight: 300;
}

.form-control, .form-select {
    background-color: hsla(0, 0%, 0%, 0.3) !important;
    border: 1px solid hsla(0, 0%, 100%, 0.1) !important;
    color: var(--text-primary) !important;
    border-radius: 12px;
}

.form-control:focus, .form-select:focus {
    background-color: hsla(0, 0%, 0%, 0.4) !important;
    border-color: var(--lab-accent) !important;
    box-shadow: 0 0 12px var(--lab-accent-glow) !important;
}

.text-dim-bright {
    color: var(--text-muted);
}

.modal-content .list-group-item {
    border-color: hsla(0, 0%, 100%, 0.05) !important;
}

.modal-content .text-dim {
    color: var(--text-muted);
}

/* Global Visibility Mapping */
.text-dim {
    color: var(--text-dim) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-secondary {
    color: var(--text-dim) !important;
}

.form-text {
    color: var(--text-muted) !important;
}

/* Experimental & Bridge Styling */
.active-lab-mode {
    background: var(--lab-gradient) !important;
    color: var(--bg-deep) !important;
    box-shadow: 0 4px 15px var(--lab-accent-glow);
    font-weight: 700;
}

.text-experimental {
    color: #ff00ff !important; /* Neon Magenta */
    text-shadow: 0 0 10px rgba(255, 0, 255, 0.4);
}

.border-experimental {
    border: 2px solid rgba(255, 0, 255, 0.5) !important;
}

.glow-experimental {
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.2);
}

.glow-experimental:hover {
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.4);
    border-color: rgba(255, 0, 255, 0.8) !important;
}

.glow-text {
    text-shadow: 0 0 8px currentColor;
}

.hover-lime:hover {
    color: var(--fizz-lime) !important;
}

/* AI Assistant Components */
#ai-assistant-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-bubble-btn {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: var(--lab-gradient);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-deep);
    font-size: 1.8rem;
    box-shadow: 0 10px 30px var(--lab-accent-glow), 0 0 0 6px rgba(255, 255, 255, 0.05);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.ai-bubble-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 40px var(--lab-accent-glow), 0 0 0 8px rgba(255, 255, 255, 0.1);
}

.pulse-ring {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    border: 2px solid var(--lab-accent);
    animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
}

#ai-chat-panel {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 550px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

#ai-chat-panel.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.ai-chat-header {
    background: var(--lab-gradient);
    padding: 1rem 1.5rem;
    color: var(--bg-deep);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: hsla(225, 30%, 5%, 0.4);
}

/* Chat Bubbles */
.chat-msg {
    max-width: 85%;
    padding: 0.8rem 1rem;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.msg-assistant {
    align-self: flex-start;
    background: var(--glass-surface);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--glass-border);
}

.msg-user {
    align-self: flex-end;
    background: var(--lab-accent);
    color: var(--bg-deep);
    font-weight: 600;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px var(--lab-accent-glow);
}

.ai-chat-footer {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
    background: var(--glass-highlight);
}

.ai-input-group {
    display: flex;
    gap: 0.5rem;
}

.ai-input {
    flex: 1;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid var(--glass-border) !important;
    color: white !important;
    padding: 0.6rem 1rem;
}

.warming-indicator {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(0, 255, 255, 0.1);
    color: var(--fizz-cyan);
    font-size: 0.65rem;
    text-align: center;
    padding: 2px 0;
    font-weight: 700;
    letter-spacing: 0.1em;
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    backdrop-filter: blur(4px);
}

@media (max-width: 500px) {
    #ai-chat-panel {
        width: calc(100% - 40px);
        right: 20px;
    }
}

/* 🧪 LOGIN MODAL & AUTH UI */
.glass-modal .modal-content {
    background: rgba(10, 15, 25, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 255, 255, 0.1);
}

.border-lab-cyan {
    border: 1px solid var(--fizz-cyan) !important;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
}

.text-gradient-lab {
    background: linear-gradient(135deg, var(--fizz-cyan) 0%, #00d2ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.1em; }
.extra-small { font-size: 0.65rem; }

.modal-backdrop.show {
    backdrop-filter: blur(8px);
    background-color: rgba(0, 0, 0, 0.7);
}

#lab-login-form .form-control:focus {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--fizz-cyan);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
    color: white;
}
