/* =========================================================================
   MI-KA-DO EXTRACTED BASE & RACK UI STYLES (v.9965)
   ========================================================================= */
html, body {
    /* 1. Ubija onaj "gumeni" bounce efekt kad dođeš do dna ili vrha */
    overscroll-behavior-y: none; 
    
    /* 2. Osigurava da je i "iza" aplikacije crna boja, pa ako i trzne, ne vidi se razlika */
    background-color: var(--bg-main, #020617); 
    
    /* 3. Magija za mobilne browsere (rješava problem URL trake koja nestaje) */
    min-height: 100vh;
    min-height: -webkit-fill-available; 
    
    margin: 0;
    padding: 0;
}

/* 4. Tvoj glavni kontejner (ili body) mora imati ovaj padding na dnu zbog iPhonea i PWA */
body {
    padding-bottom: env(safe-area-inset-bottom, 20px); 
}



/* ========================================== */
/* DESKTOP OPTIMIZACIJA (PROFI IZGLED)        */
/* ========================================== */
@media (min-width: 768px) {
    /* 1. Ograničavamo širinu My Sound QR modula i centriramo ga */
    #my-sound-success-area {
        max-width: 450px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* 2. Svi gumbi dobivaju glatku animaciju */
    .help-jump-btn {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    /* 3. Efekt podizanja i sjaja kad prijeđeš mišem */
    .help-jump-btn:hover {
        transform: translateY(-2px);
        filter: brightness(1.3);
    }

    /* 4. Specifični neonski odsjaji za naše specifične gumbe */
    button[onclick="window.enterMikadoSystem(event)"]:hover {
        box-shadow: 0 8px 20px rgba(6, 182, 212, 0.25) !important;
        background: rgba(6, 182, 212, 0.1) !important;
    }

    button[onclick="window.openQRModal(event)"]:hover {
        box-shadow: 0 8px 20px rgba(34, 197, 94, 0.25) !important;
        background: rgba(34, 197, 94, 0.1) !important;
    }

    button[onclick="window.copyUserLink(event)"]:hover {
        box-shadow: 0 8px 20px rgba(56, 189, 248, 0.25) !important;
        background: rgba(56, 189, 248, 0.1) !important;
    }
}

    @keyframes rgb-glow {
        0% { background-position: 0% 50%; }
        50% { background-position: 100% 50%; }
        100% { background-position: 0% 50%; }
    }
    
    /* Kontejner na dnu ekrana */
    .floating-bottom-bar {
        position: fixed;
        bottom: 20px;
        left: 0;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 9998;
        pointer-events: none;
    }

    /* Glavna RGB pilula koja drži oba gumba */
    .rgb-pill {
        pointer-events: auto;
        position: relative;
        display: flex;
        align-items: center;
        padding: 5px 6px 5px 6px !important;
        background: #020617;
        border-radius: 40px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.6);
        gap: 15px; /* Razmak između kruga i teksta */
    }

    /* Animirani RGB rub pilule */
    .rgb-pill::before {
        content: '';
        position: absolute;
        top: -2px; left: -2px; right: -2px; bottom: -2px;
        background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
        background-size: 400%;
        z-index: -1;
        border-radius: 42px;
        animation: rgb-glow 15s linear infinite;
        opacity: 0.85;
    }

    /* Unutarnja tamna pozadina pilule */
    .rgb-pill::after {
        content: '';
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
        background: #020617; 
        border-radius: 40px;
        z-index: -1;
    }

    /* 🚨 PRILAGODBA TVOG POSTOJEĆEG GUMBA 🚨 */
    .rgb-pill .help-btn {
        position: relative !important; 
        top: auto !important; left: auto !important; right: auto !important; bottom: auto !important;
        width: 34px !important;
        height: 34px !important;
        border-radius: 50% !important;
        background: rgba(56, 189, 248, 0.15) !important;
        color: #38bdf8 !important;
        border: 1px solid #38bdf8 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        font-family: 'Orbitron', sans-serif !important;
        font-weight: 900 !important; /* Malo deblji font da bude čitljiviji */
        font-size: 16px !important;
        line-height: 1 !important; /* Centriranje bez odstupanja */
        cursor: pointer;
        transition: 0.2s;
        margin: 0 !important;
        padding: 0 !important;
        
        /* OVO GA ČISTI OD MUTNOĆE: */
        text-shadow: none !important; /* Ubija staru mutnu sjenu teksta */
        box-shadow: none !important; /* Ubija vanjski glow */
        backdrop-filter: none !important; /* Skida mutnoću stakla */
        -webkit-font-smoothing: antialiased !important; /* Forsira maksimalnu oštrinu slova na mobitelima */
    }

    .rgb-pill .help-btn:active {
        transform: scale(0.9) !important;
        background: #38bdf8 !important;
        color: #020617 !important;
    }

    /* Tekst "MY SOUND" unutar pilule */
    .pill-sound-text {
        color: #ffffff;
        font-family: 'Orbitron', sans-serif;
        font-size: 14px;
        font-weight: bold;
        letter-spacing: 2px;
        cursor: pointer;
        text-shadow: 0 0 5px rgba(255,255,255,0.3);
        transition: 0.2s;
        padding: 8px 0;
    }

    .pill-sound-text:active {
        transform: scale(0.95);
        color: #38bdf8;
    }


    /* ==========================================
   🚀 PRO RACK UI - SPEAKER ROWS
   ========================================== */
.spk-row {
    display: flex;
    flex-direction: row;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    gap: 12px;
    align-items: stretch;
}

/* LIJEVA KOLONA (Količina) */
.spk-col-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 75px;
    flex-shrink: 0;
}
.spk-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    font-weight: 900;
    text-align: center;
    margin-bottom: 0px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.spk-qty-box {
    width: 100%;
    height: 60px;
    background: #020617;
    border: 1px solid #334155;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}
.num-large {
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Rajdhani', sans-serif;
    font-size: 28px;
    font-weight: 900;
    text-align: center;
    width: 100%;
    padding: 0;
    margin: 0;
}

/* SREDNJA KOLONA (Engine: Hz, W, Slider) */
.spk-col-mid {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.mid-header {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.info-box {
    background: #020617;
    border: 1px solid #1e293b;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 6px 8px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}
.hz-box {
    flex: 1.5;
    align-items: center;
}
.rms-box {
    flex: 1;
    align-items: center;
}
.box-lbl {
    font-family: 'Orbitron', sans-serif;
    font-size: 7px;
    color: #64748b;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.box-val {
    font-family: 'Rajdhani', sans-serif;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.1;
}
.rms-input-wrap {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
}
.unit {
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    font-weight: bold;
}
.slope-wrap {
    display: flex;
    gap: 6px;
}

/* DESNA KOLONA (Size & Total) */
.spk-col-right {
    display: flex;
    flex-direction: column;
    width: 85px;
    flex-shrink: 0;
    gap: 8px;
}
.side-box {
    flex: 1;
    align-items: center;
    text-align: center;
    padding: 6px 4px;
}
.size-sel-pro {
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Rajdhani', sans-serif;
    font-size: 16px;
    font-weight: 900;
    text-align: center;
    width: 100%;
    cursor: pointer;
}
.total-val {
    font-size: 18px;
}

/* 🏎️ NFS STYLE BACKGROUND WATERMARK (ミカド) - AGRESIVNIJA VERZIJA */
.nfs-bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none; /* Propustit će sve tvoje klikove na UI ispod */
    z-index: 9999; /* 🔝 Tjeramo ga skroz na vrh, preko svih panela! */
    overflow: hidden;
    user-select: none;
}

.nfs-bg-overlay span {
    font-family: 'Orbitron', 'Gothic A1', sans-serif;
    font-weight: 900;
    font-size: 40vw; /* Još veće */
    color: #94a3b8; /* Svjetlija siva */
    opacity: 0.15; /* 👁️ Puno vidljivije u startu! (Bilo je 0.03) */
    transform: rotate(-15deg); 
    letter-spacing: -20px; 
    white-space: nowrap;
    transition: all 0.5s ease;
    text-shadow: 0 0 10px rgba(148, 163, 184, 0.2);
}

/* 🚀 EXTREME MODE AKTIVACIJA */
body.extreme-mode-active #nfs-watermark span {
    color: #f472b6; /* Rosa */
    opacity: 0.4; /* 👁️ Brutalno vidljivo u Extreme modu! (Bilo je 0.08) */
    text-shadow: 0 0 30px rgba(244, 114, 182, 0.8);
    transform: rotate(-15deg) scale(1.05); /* Lagano se približi (zoom) */
    
    /* Glitch animacija */
    animation: nfs-glitch-flicker 2s ease-out;
}

/* 💥 NFX GLITCH FLICKER ANIMACIJA */
@keyframes nfs-glitch-flicker {
    0%   { opacity: 0.1; transform: rotate(-15deg) scale(1); filter: blur(0px); }
    10%  { opacity: 0.7; transform: rotate(-13deg) scale(1.1); filter: blur(4px); color: #fff; }
    20%  { opacity: 0.2; transform: rotate(-16deg) scale(1.05); filter: blur(0px); }
    30%  { opacity: 0.8; transform: rotate(-14deg) scale(1.08); filter: blur(2px); color: #0ea5e9; }
    40%  { opacity: 0.2; transform: rotate(-15deg) scale(1.02); filter: blur(0px); }
    100% { opacity: 0.4; transform: rotate(-15deg) scale(1.05); }
}

input.manual-hz::-webkit-outer-spin-button,
input.manual-hz::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input.manual-hz {
  -moz-appearance: textfield;
}

/* ========================================== */
/* INTEGRATED USB / BT SWITCH IN STATUS PANEL */
/* ========================================== */
.status-panel-pro {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 4px 8px !important;
}

.status-main-ind {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.status-divider {
    width: 1px;
    height: 15px;
    background: rgba(148, 163, 184, 0.28);
    flex-shrink: 0;
}

.audio-out-switch-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0px;
    flex-shrink: 0;
}

.audio-out-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.25s ease, filter 0.25s ease, opacity 0.25s ease;
}

/* Default: USB Active */
.audio-out-switch-wrap .usb-icon {
    color: #38bdf8;
    filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.7));
    opacity: 1;
}
.audio-out-switch-wrap .bt-icon {
    color: #64748b;
    filter: none;
    opacity: 0.65;
}

/* BT Active */
.audio-out-switch-wrap.is-bt .usb-icon {
    color: #64748b;
    filter: none;
    opacity: 0.65;
}
.audio-out-switch-wrap.is-bt .bt-icon {
    color: #38bdf8;
    filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.8));
    opacity: 1;
}

.audio-out-toggle {
    transform: scale(0.82);
    transform-origin: center;
    margin: 0 -2px !important;
}

@media (max-width: 520px) {
    .status-panel-pro {
        gap: 4px !important;
        padding: 3px 6px !important;
    }
    .audio-out-toggle {
        transform: scale(0.75);
        margin: 0 -3px !important;
    }
}
