/* 
 * JoeBro Web Controller CSS
 * Redesigned for NextGenRedTeam Visual System
 */

:root {
    --bg-color: #060709;
    --card-bg: rgba(12, 14, 18, 0.75);
    --card-border: rgba(20, 25, 35, 0.7);
    --card-border-hover: rgba(0, 240, 255, 0.3);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --accent: #00f0ff;
    --accent-glow: rgba(0, 240, 255, 0.3);
    --accent-purple: #b14cff;
    --accent-purple-glow: rgba(177, 76, 255, 0.3);
    --accent-pink: #ff2d55;
    --accent-pink-glow: rgba(255, 45, 85, 0.3);
    
    --font-sans: 'Outfit', -apple-system, sans-serif;
    --font-mono: 'Fira Code', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(0, 240, 255, 0.12) 0px, transparent 55%),
        radial-gradient(at 100% 100%, rgba(177, 76, 255, 0.12) 0px, transparent 55%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    overflow-x: hidden;
    position: relative;
}

/* --- CYBERNETIC BACKGROUND OVERLAYS --- */
.scanlines {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    z-index: 100;
}

.noise-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.02'/%3E%3C/svg%3E");
    z-index: 101;
}

.grid-bg {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(to right, rgba(20, 25, 35, 0.45) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(20, 25, 35, 0.45) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: -2;
    pointer-events: none;
}

/* --- CARDS & GLASSMORPHISM --- */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.3s ease, 
                box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(0, 240, 255, 0.08);
}

.card-header {
    display: flex;
    align-items: center;
    width: 100%;
}

.card-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.8rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.card-content {
    flex-grow: 1;
}

.card-content h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
    letter-spacing: -0.02em;
}

.card-content p {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 300;
}

.card-body {
    margin-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* --- LOGIN SCREEN --- */
.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(4, 5, 7, 0.9);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-box {
    width: 440px;
    max-width: 90%;
    text-align: center;
    padding: 2.5rem;
    border-color: rgba(0, 240, 255, 0.15);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 240, 255, 0.05);
}

.login-logo {
    width: 72px;
    height: 72px;
    margin-bottom: 1.25rem;
    border-radius: 16px;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
}

.login-box h2 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #00f0ff, #b14cff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.login-box p.subtitle {
    margin-bottom: 2rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.login-box .input-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.login-box label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.login-box input {
    width: 100%;
    padding: 0.9rem 1.1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.login-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

.divider {
    margin: 1.25rem 0;
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    letter-spacing: 2px;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.divider::before { margin-right: .75em; }
.divider::after { margin-left: .75em; }

.fb-instructions {
    font-size: 0.82rem !important;
    color: var(--text-muted);
    margin-bottom: 1rem !important;
    text-align: left;
    line-height: 1.5;
}

/* --- BUTTONS --- */
.btn {
    display: block;
    width: 100%;
    padding: 0.9rem 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    border-radius: 12px;
    border: 1px solid var(--accent);
    cursor: pointer;
    background: rgba(0, 240, 255, 0.1);
    color: var(--text-main);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.1);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    background: var(--accent);
    color: #060709;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.35);
}

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--text-main);
    box-shadow: none;
}

.btn-facebook {
    background: rgba(24, 119, 242, 0.15);
    border-color: #1877f2;
    color: white;
    box-shadow: 0 0 15px rgba(24, 119, 242, 0.1);
}

.btn-facebook:hover {
    background: #1877f2;
    color: white;
    box-shadow: 0 0 20px rgba(24, 119, 242, 0.3);
}

/* --- DASHBOARD LAYOUT --- */
.dashboard-container {
    max-width: 900px;
    width: 100%;
    z-index: 10;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
    background: rgba(12, 14, 18, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 1.5rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.header-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 1.25rem;
}

.header-logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.25);
}

header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(to right, #00f0ff, #b14cff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.device-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 0.75rem;
}

select {
    padding: 0.7rem 1.2rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 200px;
}

select:focus {
    border-color: var(--accent);
}

.header-button-group {
    display: flex;
    gap: 8px;
}

.header-button-group .btn {
    padding: 0.7rem 1.2rem;
    width: auto;
    font-size: 0.8rem;
}

.status {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.82rem;
    font-family: var(--font-mono);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* --- INTERACTIVE CONTROLS --- */
.slider-container label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.slider-container label span {
    font-family: var(--font-mono);
    color: var(--accent);
    font-weight: 600;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    transition: transform 0.1s, background-color 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.25);
    background: white;
}

/* Color Picker Styling */
.color-picker-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 50px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
    cursor: pointer;
}

input[type="color"] {
    position: absolute;
    left: 0; top: 0; width: 100%; height: 100%;
    border: none;
    opacity: 0;
    cursor: pointer;
}

.color-indicator {
    width: 100%;
    height: 100%;
    background: var(--accent);
    transition: background-color 0.2s, box-shadow 0.2s;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.6);
}

/* Custom Toggle Switch */
.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch label {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 34px;
}

.toggle-switch label:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: #64748b;
    transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
}

.toggle-switch input:checked + label {
    background-color: rgba(0, 240, 255, 0.1);
    border-color: var(--accent);
}

.toggle-switch input:checked + label:before {
    transform: translateX(24px);
    background-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* --- TABLE VISUALIZER --- */
.visualizer-card {
    grid-column: 1 / -1;
}

.visualizer-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 240px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 14px;
    padding: 1rem 0;
}

.table-mockup-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.table-svg {
    width: 100%;
    height: 100%;
    z-index: 5;
}

.backlight-glow {
    position: absolute;
    top: 25px;
    left: 60px;
    width: 280px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.15);
    filter: blur(28px);
    z-index: 1;
    opacity: 0;
    transition: opacity 0.4s ease, background-color 0.4s ease;
}

/* Animations for Visualizer */
.fridge-mist {
    animation: mistBreathe 2s ease-in-out infinite;
    mix-blend-mode: screen;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

@keyframes mistBreathe {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.45; }
}

.ble-waves {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.ble-waves .wave {
    fill: none;
    stroke: var(--accent-purple);
    stroke-width: 1.5;
    transform-origin: 200px 110px;
    opacity: 0;
}

.ble-waves.active {
    opacity: 1;
}

.ble-waves.active .wave-1 { animation: wavePulse 3s infinite 0s; }
.ble-waves.active .wave-2 { animation: wavePulse 3s infinite 1s; }
.ble-waves.active .wave-3 { animation: wavePulse 3s infinite 2s; }

@keyframes wavePulse {
    0% {
        transform: scale(0.6);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.1);
        opacity: 0;
    }
}

.lock-indicator {
    transition: opacity 0.3s ease;
}

.front-light-beam {
    transition: opacity 0.4s ease, fill 0.4s ease;
}

.front-light-led {
    transition: opacity 0.4s ease, stroke 0.4s ease;
}

.drawer {
    transition: fill 0.3s ease;
}

/* --- ACCORDION HELP --- */
.help-accordion {
    width: 100%;
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 0.4rem;
}

.accordion-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

.accordion-header {
    width: 100%;
    text-align: left;
    padding: 0.75rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s ease;
}

.accordion-header:hover {
    color: var(--accent);
}

.accordion-header::after {
    content: '▼';
    font-size: 0.6rem;
    transition: transform 0.2s ease;
    opacity: 0.5;
}

.accordion-header.active::after {
    transform: rotate(180deg);
    color: var(--accent);
    opacity: 1;
}

.accordion-content {
    padding: 0.5rem;
    padding-bottom: 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.02);
}

.accordion-content code {
    background: rgba(0, 0, 0, 0.5);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    color: var(--accent-pink);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

/* Responsiveness adjustments */
@media (max-width: 600px) {
    body {
        padding: 1rem 0.5rem;
    }
    header {
        padding: 1rem;
    }
    .grid {
        grid-template-columns: 1fr;
    }
    .header-brand h1 {
        font-size: 1.4rem;
    }
    .device-selector {
        flex-direction: column;
    }
    .header-button-group {
        width: 100%;
        justify-content: center;
    }
}
