@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&display=swap');

/* ==========================================================================
   1. VARIABLES & RESET
   ========================================================================== */
:root {
    --bg-body: #08090A;
    --bg-panel: rgba(21, 25, 30, 0.65);
    --bg-sidebar: rgba(13, 15, 16, 0.85);
    --primary: #00E0FF;
    --primary-glow: rgba(0, 224, 255, 0.3);
    --accent-pink: #D500F9;
    --accent-green: #00E676;
    --red-accent: #ff3b30;
    --text-main: #FFFFFF;
    --text-muted: #8A94A6;
    --border-color: rgba(255, 255, 255, 0.08);
    --input-bg: rgba(0, 0, 0, 0.4);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --font-main: 'Inter', sans-serif;
    --font-title: 'Space Grotesk', sans-serif;
    --sidebar-width: 260px;
    --warning: #FFC107;
    --danger: #FF3B30;
    --success: #00E676;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0; padding: 0;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

h1, h2, h3, h4, h5, h6, .brand-text h2, .waiting-title, .page-title, .btn-primary, .btn-secondary, .tab-item {
    font-family: var(--font-title);
    letter-spacing: -0.02em;
}

/* Custom Cursors */
@media (hover: hover) and (pointer: fine) {
    body, a, button, .nav-item, input, select, .ts-control, .card-item {
        cursor: none;
    }
}

.cursor-dot {
    width: 6px;
    height: 6px;
    background-color: var(--primary);
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 10000;
    pointer-events: none;
}

.cursor-outline {
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--primary);
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
    transition: transform 0.1s ease-out, border-color 0.15s ease, background-color 0.15s ease;
}

#background-glow {
    position: fixed;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0, 224, 255, 0.12) 0%, rgba(213, 0, 249, 0.04) 50%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
    filter: blur(80px);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ==========================================================================
   2. SIDEBAR & NAVIGATION
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    height: 100vh;
    display: flex; flex-direction: column;
    padding: 25px 15px;
    border-right: 1px solid var(--border-color);
    position: fixed; left: 0; top: 0; z-index: 1000;
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; padding: 0 10px; }
.brand-logo { width: 36px; height: 36px; background-color: #FFE5A0; color: #000; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; }
.brand-text h2 { font-size: 16px; color: #FFF; margin: 0; }
.brand-text p { font-size: 12px; color: #6B7280; margin: 0; }

.nav-links { display: flex; flex-direction: column; gap: 8px; }
a.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    border-radius: 12px; text-decoration: none !important;
    color: #9CA3AF !important; font-weight: 500; font-size: 14px;
    transition: all 0.3s ease; border-left: 3px solid transparent;
}
a.nav-item i { width: 20px; text-align: center; font-size: 1.2em; }
a.nav-item:hover { background-color: rgba(255, 255, 255, 0.05); color: #FFFFFF !important; }
a.nav-item.active {
    background: linear-gradient(90deg, rgba(0, 224, 255, 0.1) 0%, rgba(0, 224, 255, 0) 100%);
    color: var(--primary) !important; border-left: 3px solid var(--primary);
}
a.nav-item.active i { color: var(--primary); filter: drop-shadow(0 0 8px rgba(0, 224, 255, 0.6)); }

.sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 5px; }

/* Admin Only */
.admin-only { display: none !important; }
body.is-admin .admin-only { display: flex !important; }
body.is-admin a.nav-item.admin-only { color: #ffcc00 !important; border-left-color: #ffcc00; }

/* ==========================================================================
   3. MAIN CONTENT
   ========================================================================== */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    flex-grow: 1; overflow-y: auto;
    padding: 30px 40px; background-color: var(--bg-body);
    min-height: 100vh;
}
.top-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.page-title { font-size: 2rem; font-weight: 800; margin: 0; }
.user-profile { display: flex; align-items: center; gap: 15px; }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--primary); padding: 2px; background: var(--bg-panel); }

/* ==========================================================================
   4. UI COMPONENTS (Buttons, Inputs, Cards)
   ========================================================================== */
/* Buttons */
.btn-primary, .btn-secondary, .btn-neon {
    font-weight: 700; padding: 12px 24px; border-radius: 30px; border: none;
    cursor: pointer; display: flex; align-items: center; gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary { background-color: var(--primary); color: #000; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 15px var(--primary-glow); }
.btn-secondary { background-color: var(--red-accent); color: #000; }
.btn-secondary:hover { transform: translateY(-2px); box-shadow: 0 0 15px var(--red-accent); }

.icon-btn { background: none; border: none; cursor: pointer; font-size: 1.2rem; transition: transform 0.2s; }
.icon-btn:hover { transform: scale(1.2); }

/* Inputs */
input[type="text"], input[type="number"], select, input[type="email"], input[type="tel"], input[type="password"] {
    background-color: var(--input-bg); border: 1px solid var(--border-color);
    color: white; padding: 12px; border-radius: var(--radius-sm); outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 224, 255, 0.15), 0 0 8px rgba(0, 224, 255, 0.1) !important;
}
.search-input { width: 100%; border-radius: 30px; padding-left: 45px; }

/* Cards */
.inventory-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 20px; overflow: hidden; margin-bottom: 30px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Tabular figures for comparisons & prices */
.etiquette-price, .vs-table, .data-cell, #inv-timer, #invCountScanned, #invCountTheoretical, #invProgress {
    font-variant-numeric: tabular-nums;
}

/* Transitions between tabs */
.app-content {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.app-content.active-section {
    opacity: 1;
    transform: translateY(0);
}

/* Tom Select Override (Global) */
.ts-wrapper .ts-control { background-color: #1A1D21 !important; border: 1px solid var(--border-color) !important; color: #fff !important; border-radius: 8px !important; }
.ts-dropdown { background-color: #1A1D21 !important; border: 1px solid var(--border-color) !important; color: #fff !important; }
.ts-dropdown .option.active, .ts-dropdown .option:hover { background-color: rgba(0, 224, 255, 0.1) !important; }
.ts-control input { color: #fff !important; }

/* Responsive Global */
@media (max-width: 768px) {
    body { flex-direction: column; overflow: auto; }
    .sidebar { width: 100%; height: auto; padding: 10px; position: relative; }
    .nav-links { flex-direction: row; overflow-x: auto; }
    .main-content { margin-left: 0 !important; width: 100% !important; padding: 15px; }
}

/* ==========================================================================
   TESTEUR MANETTE - ÉCRAN SONAR
   ========================================================================== */
.tester-waiting-room {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    height: 100%;
}

/* --- Animation Sonar --- */
.sonar-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
}

.sonar-emitter {
    position: relative;
    z-index: 2;
    width: 70px;
    height: 70px;
    background: var(--bg-panel);
    border: 2px solid var(--primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 224, 255, 0.4), inset 0 0 10px rgba(0, 224, 255, 0.2);
}

.sonar-wave {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--primary);
    opacity: 0;
    animation: sonarPulse 2s cubic-bezier(0.1, 0.4, 0.8, 1) infinite;
}

@keyframes sonarPulse {
    0% {
        transform: scale(0.35);
        opacity: 1;
        border-width: 3px;
    }

    100% {
        transform: scale(1.2);
        opacity: 0;
        border-width: 1px;
    }
}

/* --- Textes --- */
.waiting-title {
    color: white;
    margin: 0 0 10px 0;
    font-size: 1.5rem;
    font-weight: 800;
}

.waiting-subtitle {
    color: var(--text-muted);
    margin: 0 0 30px 0;
}

.waiting-hint {
    margin-top: 30px;
    font-size: 0.85rem;
    color: #888;
    background: rgba(0,0,0,0.2);
    padding: 10px 20px;
    border-radius: 20px;
}

/* --- Boutons Sonar --- */
.tester-connection-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-sonar-blue, .btn-sonar-green {
    padding: 12px 25px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    border: none;
    color: black;
}

.btn-sonar-blue {
    background: var(--primary);
}

    .btn-sonar-blue:hover {
        box-shadow: 0 0 15px rgba(0, 224, 255, 0.5);
        transform: translateY(-2px);
    }

.btn-sonar-green {
    background: var(--accent-green);
}

    .btn-sonar-green:hover {
        box-shadow: 0 0 15px rgba(0, 230, 118, 0.5);
        transform: translateY(-2px);
    }