/* assets/css/templates/flash.css */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700;800&family=Inter:wght@400;600;700;800&display=swap');

:root {
    /* Solarized Light Palette - Deeply Calibrated */
    --base03: #002b36;  /* Background Dark */
    --base3: #fdf6e3;   /* Background Light (Main) */
    --base2: #eee8d5;   /* Background Accent */
    --base1: #93a1a1;   /* Tertiary Content */
    --base00: #657b83;  /* Primary Content */
    --base01: #586e75;  /* Headers/Emphasis */
    
    --sol-blue: #268bd2;
    --sol-cyan: #2aa198;
    --sol-magenta: #d33682;
    --sol-orange: #cb4b16;
    --sol-red: #dc322f;
    
    --accent: var(--sol-cyan);
    --font-mono: 'JetBrains Mono', monospace;
    --font-sans: 'Inter', sans-serif;
    
    --h-height: 75px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

.tpl-flash {
    background-color: var(--base3);
    color: var(--base01);
    font-family: var(--font-sans);
    line-height: 1.5;
    position: relative;
    overflow-x: hidden;
    width: 100%;
}

/* Solarized CRT Overlay */
.terminal-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2000;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.02) 50%), 
                linear-gradient(90deg, rgba(38, 139, 210, 0.02), rgba(211, 54, 130, 0.02), rgba(42, 161, 152, 0.02));
    background-size: 100% 3px, 3px 100%;
    opacity: 0.6;
}

.container {
    max-width: 950px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header - System Bar */
.flash-header {
    height: var(--h-height);
    background: var(--base2);
    border-bottom: 2px solid var(--base03);
    display: flex;
    align-items: center;
    position: relative;
    z-index: 100;
}

.flash-top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.system-status {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 800;
    color: #fff;
    background: var(--base03);
    padding: 0.3rem 0.6rem;
    letter-spacing: 0.1em;
}

.flash-title {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--base03);
    letter-spacing: -0.02em;
}

.flash-exit {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--sol-magenta);
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--sol-magenta);
    transition: all 0.2s;
    text-transform: uppercase;
}

.flash-exit:hover {
    background: var(--sol-magenta);
    color: #fff;
    box-shadow: 0 0 15px rgba(211, 54, 130, 0.3);
}

/* Category Navigation - Terminal Capsule */
.tpl-flash .category-nav {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 2.5rem 0;
    position: relative;
    z-index: 100;
}

.tpl-flash .category-nav-scroll-container {
    position: relative;
    max-width: fit-content;
    margin: 0 auto;
}

/* Mobile Capsule Styles */
@media (max-width: 768px) {
    .tpl-flash .category-nav {
        position: fixed;
        bottom: 2rem;
        top: auto;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        max-width: 480px;
        padding: 0;
        z-index: 1100;
    }

    .tpl-flash .category-nav-scroll-container {
        background: var(--base2);
        border: 2px solid var(--base03);
        border-radius: 4px;
        box-shadow: 8px 8px 0 var(--base03);
        padding: 6px;
        overflow: hidden;
    }

    .tpl-flash .category-nav-inner {
        padding: 0 2.5rem;
        gap: 0.25rem;
    }

    .tpl-flash .category-nav-link {
        padding: 0.6rem 1.2rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        border-radius: 2px;
        transition: all 0.2s;
    }

    .tpl-flash .nav-code {
        font-family: var(--font-mono);
        font-size: 0.6rem;
        color: var(--sol-cyan);
        font-weight: 800;
    }

    .tpl-flash .nav-label {
        font-size: 0.8rem;
        font-weight: 800;
        color: var(--base01);
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .tpl-flash .category-nav-link.is-active {
        background: var(--base03);
    }
    
    .tpl-flash .category-nav-link.is-active .nav-label { color: #fff; }

    /* Terminal Arrow Buttons */
    .tpl-flash .nav-arrow {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        background: var(--base03);
        border: none;
        color: #fff;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0, 43, 54, 0.2);
        transition: all 0.2s ease;
    }

    .tpl-flash .nav-arrow:active {
        transform: translateY(-50%) scale(0.9);
        background: var(--sol-cyan);
    }

    .tpl-flash .nav-arrow svg {
        width: 18px;
        height: 18px;
    }

    .tpl-flash .nav-arrow-left { left: 4px; }
    .tpl-flash .nav-arrow-right { right: 4px; }

    .tpl-flash .nav-mask-left,
    .tpl-flash .nav-mask-right {
        position: absolute;
        top: 0;
        bottom: 0;
        width: 40px;
        pointer-events: none;
        z-index: 2;
    }

    .tpl-flash .nav-mask-left { left: 0; background: linear-gradient(to right, var(--base2), transparent); }
    .tpl-flash .nav-mask-right { right: 0; background: linear-gradient(to left, var(--base2), transparent); }
}

/* Desktop Polish */
@media (min-width: 769px) {
    .tpl-flash .category-nav {
        background: var(--base3);
        border-bottom: 2px solid var(--base2);
        padding: 0;
    }
    .tpl-flash .category-nav-link {
        display: inline-flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1.5rem;
        text-decoration: none;
        color: var(--base01);
        font-weight: 800;
        font-size: 0.85rem;
        text-transform: uppercase;
        border-bottom: 3px solid transparent;
        transition: all 0.2s;
    }
    .tpl-flash .nav-code { font-family: var(--font-mono); color: var(--sol-cyan); font-size: 0.65rem; }
    
    .tpl-flash .category-nav-link.is-active,
    .tpl-flash .category-nav-link:hover {
        background: var(--base2);
        border-bottom-color: var(--sol-cyan);
        color: var(--base03);
    }
    .tpl-flash .nav-arrow { display: none; }
}

/* Main Terminal Feed */
.flash-main { padding: 4rem 0; }

.flash-section { margin-bottom: 6rem; }

.section-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.sec-prefix { color: var(--sol-magenta); font-family: var(--font-mono); font-weight: 900; font-size: 1.5rem; }

.flash-cat-name {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--base03);
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.sec-line {
    flex-grow: 1;
    height: 2px;
    background: repeating-linear-gradient(90deg, var(--base2), var(--base2) 4px, transparent 4px, transparent 8px);
}

/* Item Card - System Entry */
.flash-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.flash-item-card {
    background: #fff;
    border: 2px solid var(--base2);
    border-radius: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.flash-item-card:hover {
    border-color: var(--base03);
    box-shadow: 4px 4px 0 var(--base01);
}

.flash-item-summary {
    list-style: none;
    cursor: pointer;
    padding: 1.5rem;
}

.flash-item-summary::-webkit-details-marker { display: none; }

.summary-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.item-name {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--base03);
    text-transform: uppercase;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.compact-statuses {
    display: flex;
    gap: 0.5rem;
}

.mini-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--base2);
    background: var(--base3);
    color: var(--base01);
    font-size: 0.65rem;
    font-weight: 800;
    font-family: var(--font-mono);
}

.mini-status.status-vegan { color: var(--sol-cyan); border-color: var(--sol-cyan); }
.mini-status.status-spicy { color: var(--sol-orange); border-color: var(--sol-orange); }

.item-price {
    font-family: var(--font-mono);
    font-weight: 900;
    font-size: 1.25rem;
    color: var(--sol-blue);
}

/* Expanded Content - Terminal Detail */
.flash-expanded-content {
    padding: 0 1.5rem 1.5rem;
    animation: flashSlide 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes flashSlide {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.expanded-grid {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 3rem;
    border-top: 1px dashed var(--base1);
    padding-top: 2rem;
}

.expanded-text {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.expanded-desc {
    font-family: var(--font-sans);
    font-size: 1.05rem;
    color: var(--base00);
    line-height: 1.7;
}

.expanded-ingredients {
    padding: 1rem;
    background: var(--base3);
    border-left: 4px solid var(--sol-magenta);
}

.expanded-ingredients .label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 900;
    color: var(--sol-magenta);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.expanded-ingredients .val {
    font-size: 0.95rem;
    color: var(--base01);
    font-style: italic;
}

/* Macro Readout - Optimized */
.macro-readout {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--base03);
    padding: 1.25rem;
    gap: 0.5rem;
}

.m-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid rgba(255,255,255,0.1);
}

.m-box:last-child { border-right: none; }

.m-val {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--sol-cyan);
}

.m-lbl {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--base1);
    letter-spacing: 0.1em;
}

/* Visuals */
.expanded-visual {
    position: relative;
    height: 180px;
    border: 2px solid var(--base03);
    padding: 4px;
}

.expanded-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.2) contrast(1.1);
}

.img-frame {
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(0,0,0,0.1);
    pointer-events: none;
}

/* Footer Control */
.flash-footer { padding-bottom: 8rem; }

.footer-inner {
    padding: 4rem 0;
    border-top: 2px solid var(--base03);
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--base1);
    text-transform: uppercase;
}

/* Final Responsiveness Polish */
@media (max-width: 640px) {
    .container { width: 100%; padding: 0 1rem; }
    .flash-main { padding: 2rem 0; }
    .flash-section { margin-bottom: 4rem; }
    .section-header { margin-bottom: 2rem; gap: 1rem; }
    .flash-cat-name { font-size: 1.25rem; }
    
    .flash-item-summary { padding: 1.25rem 1rem; }
    .summary-content { flex-direction: column; align-items: stretch; gap: 0.75rem; }
    .item-name { font-size: 1.1rem; line-height: 1.3; }
    .item-meta { width: 100%; justify-content: space-between; align-items: center; gap: 1rem; }
    
    .flash-expanded-content { padding: 0 1rem 1.25rem; }
    .expanded-grid { grid-template-columns: 1fr; gap: 1.5rem; padding-top: 1.5rem; }
    .expanded-visual { order: -1; height: 200px; }
    
    .macro-readout { grid-template-columns: repeat(2, 1fr); gap: 1rem; padding: 1rem; }
    .m-box { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 0.5rem; }
    .m-box:nth-child(even) { border-left: 1px solid rgba(255,255,255,0.1); padding-left: 0.5rem; }
    .m-box:nth-child(n+3) { border-bottom: none; padding-top: 0.5rem; }
    
    .flash-exit { border-width: 1px; padding: 0.4rem 0.8rem; font-size: 0.6rem; }
    .system-status { font-size: 0.55rem; padding: 0.2rem 0.4rem; }
    .header-left { gap: 0.75rem; }
    .flash-title { font-size: 0.95rem; }
}

@media (max-width: 380px) {
    .item-meta { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .item-price { font-size: 1.1rem; }
    .compact-statuses { width: 100%; overflow-x: auto; padding-bottom: 4px; }
}
