/* --- Variables & Reset --- */
:root {
    --bg-dark: #0f172a;
    --bg-black: #020617;
    --accent-purple: #8b5cf6;
    --text-gray: #94a3b8;
    --card-bg: #1e293b;
    --danger: #ef4444;
    --success: #10b981;
    --glass: rgba(15, 23, 42, 0.8);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-black);
    color: white;
    margin: 0;
    padding: 0;
    padding-top: 80px; /* Space for fixed nav */
    overflow-x: hidden;
}

/* --- Navigation --- */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    height: 65px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.logo {
    font-weight: 800;
    font-size: 1.2rem;
    color: #3b82f6;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.logo span {
    color: white;
}

.user-badge {
    font-size: 0.8rem;
    background: rgba(139, 92, 246, 0.1);
    padding: 8px 14px;
    border-radius: 12px;
    color: var(--accent-purple);
    border: 1px solid var(--accent-purple);
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s ease;
}

.user-badge:hover {
    background: var(--accent-purple);
    color: white;
}

/* --- Layout Container --- */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    min-height: 80vh;
}

/* --- Overlays (Locker & Inventory) --- */
.full-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    padding: 40px 0;
}

/* --- Authentication & Action Cards --- */
.auth-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 90%;
    max-width: 420px;
    box-sizing: border-box;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-card h2 {
    margin: 0 0 10px 0;
    font-size: 1.5rem;
    font-weight: 800;
}

.auth-card p {
    color: var(--text-gray);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 25px;
}

/* --- Form Elements --- */
.field {
    margin-bottom: 18px;
    text-align: left;
}

.field label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-gray);
    font-weight: 800;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid #334155;
    background: #0f172a;
    color: white;
    box-sizing: border-box;
    font-size: 1rem;
    font-family: inherit;
    transition: 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* --- Buttons --- */
.btn-action {
    background: var(--accent-purple);
    color: white;
    border: none;
    height: 52px;
    width: 100%;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.btn-action:active {
    transform: scale(0.97);
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-cancel {
    background: #475569;
    margin-top: 10px;
}

.btn-danger {
    background: var(--danger);
}

.secondary-link {
    display: block;
    margin-top: 20px;
    color: var(--accent-purple);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* --- Dashboard Content & Stats --- */
#hub-content {
    transition: filter 0.5s ease;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.2rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-card label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-gray);
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.stat-card .val {
    font-size: 1.25rem;
    font-weight: 800;
}

/* --- Barcode Scanner UI --- */
#reader {
    width: 100%;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 2px solid var(--accent-purple);
    position: relative;
    min-height: 200px;
}

/* Styling the video element injected by the library */
#reader video {
    width: 100% !important;
    height: auto !important;
    border-radius: 12px;
}

/* Library internal UI cleaning */
#reader__dashboard_section_csr button {
    padding: 10px 15px;
    border-radius: 10px;
    border: none;
    background: var(--accent-purple);
    color: white;
    font-weight: 600;
    margin: 5px;
}

/* --- Wallet Modal --- */
#wallet-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

#inventory-table-body tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* --- Utilities --- */
.hidden {
    display: none !important;
}

.error-text {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 10px;
    font-weight: 600;
    text-align: center;
}

/* --- Mobile Specific Optimization --- */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .auth-card {
        padding: 25px 20px;
    }

    .stats-grid {
        gap: 10px;
    }

    .stat-card .val {
        font-size: 1.1rem;
    }
}

/* Low Stock Styling */
.stock-normal { color: white; }

.stock-warning { 
    color: #fbbf24 !important; /* Amber/Orange */
    background: rgba(251, 191, 36, 0.05); 
}

.stock-danger { 
    color: #ef4444 !important; /* Red */
    background: rgba(239, 68, 68, 0.05); 
}

.qty-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    background: rgba(255,255,255,0.1);
}

/* Specific badge colors */
.stock-warning .qty-badge { background: rgba(251, 191, 36, 0.2); }
.stock-danger .qty-badge { background: rgba(239, 68, 68, 0.2); }