/* =========================================
   1. VARIABLES & THEME CONFIG
   ========================================= */
   :root {
    /* --- Colors: Backgrounds --- */
    --bg-core: #0a0a0c;            /* สีพื้นหลังหลัก (เกือบดำ) */
    --bg-glass: rgba(20, 20, 25, 0.6); /* กระจกฝ้า */
    --bg-glass-hover: rgba(40, 40, 50, 0.7);
    --bg-panel: rgba(15, 15, 20, 0.85);

    /* --- Colors: Neon Accents --- */
    --neon-purple: #bc13fe;
    --neon-blue: #00f3ff;
    --neon-green: #0aff0a;
    --neon-red: #ff003c;
    --text-main: #ffffff;
    --text-muted: #8b8b9b;
    --neon-orange: #ff7b00;

    /* --- Effects --- */
    --blur-amt: 12px;
    --border-glass: 1px solid rgba(255, 255, 255, 0.08);
    --glow-purple: 0 0 15px rgba(188, 19, 254, 0.4);
    --glow-blue: 0 0 15px rgba(0, 243, 255, 0.4);
    
    /* --- Dimensions --- */
    --sidebar-width: 260px;
}

* { box-sizing: border-box; }

body {
    margin: 0; padding: 0;
    background-color: var(--bg-core);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    height: 100vh;
    display: flex;
    overflow: hidden; /* ห้าม Scroll Body หลัก */
}

/* Scrollbar สวยๆ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--neon-purple); }

/* =========================================
   2. BACKGROUND FX (Scanlines & Ambient)
   ========================================= */
.ambient-light {
    position: fixed; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at center, rgba(188, 19, 254, 0.08), transparent 60%);
    z-index: -2; pointer-events: none;
    animation: pulseLight 8s infinite alternate;
}

.scanlines {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(to bottom, transparent 0px, transparent 2px, rgba(0,0,0,0.2) 3px);
    z-index: -1; pointer-events: none; opacity: 0.4;
}

/* =========================================
   3. LAYOUT (Sidebar & Main)
   ========================================= */
.app-container {
    display: flex; width: 100%; height: 100%;
}

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-glass);
    backdrop-filter: blur(var(--blur-amt));
    border-right: var(--border-glass);
    display: flex; flex-direction: column; 
    padding: 25px;
    z-index: 10;
}

.logo {
    font-family: 'Rajdhani', sans-serif; font-size: 26px; font-weight: 700;
    color: var(--text-main); margin-bottom: 40px; text-transform: uppercase;
    text-shadow: var(--glow-purple); display: flex; align-items: center; gap: 12px;
}
.logo i { color: var(--neon-purple); }

.nav-item {
    padding: 12px 15px; margin-bottom: 8px; border-radius: 8px;
    color: var(--text-muted); cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; gap: 12px; font-weight: 500; font-size: 14px;
}
.nav-item:hover { 
    background: rgba(255,255,255,0.05); color: white; transform: translateX(5px); 
}
.nav-item.active {
    background: rgba(188, 19, 254, 0.15); color: var(--neon-purple);
    border-left: 3px solid var(--neon-purple);
    box-shadow: 0 0 15px rgba(188, 19, 254, 0.1);
}

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1; padding: 30px; overflow-y: auto; position: relative;
}

h2 { 
    font-family: 'Rajdhani'; font-weight: 700; color: var(--neon-blue); 
    margin-top: 0; margin-bottom: 25px; font-size: 22px;
    text-transform: uppercase; letter-spacing: 1px; display: flex; align-items: center; gap: 10px;
}

/* =========================================
   4. UI COMPONENTS
   ========================================= */

/* Glass Panel (Container) */
.glass-panel {
    background: var(--bg-panel); border: var(--border-glass); border-radius: 12px;
    padding: 25px; margin-bottom: 25px; box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

/* Forms (Input, Select, Textarea) */
input, select, textarea {
    width: 100%; padding: 12px; background: rgba(0,0,0,0.4);
    border: 1px solid #333; border-radius: 6px; color: white;
    font-family: 'Inter', sans-serif; outline: none; transition: 0.3s;
    font-size: 14px;
}
input:focus, select:focus, textarea:focus { 
    border-color: var(--neon-purple); 
    box-shadow: 0 0 10px rgba(188, 19, 254, 0.2); 
    background: rgba(0,0,0,0.6);
}
input::placeholder { color: #555; }

/* Buttons */
.btn {
    padding: 12px 20px; border: none; border-radius: 6px; cursor: pointer;
    font-family: 'Rajdhani', sans-serif; font-weight: 700; text-transform: uppercase; 
    transition: 0.3s; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    letter-spacing: 1px;
}
.btn-primary { 
    background: var(--neon-purple); color: white; 
    box-shadow: 0 0 15px rgba(188, 19, 254, 0.3); width: 100%; font-size: 14px;
}
.btn-primary:hover { 
    background: #d34dff; transform: translateY(-2px); 
    box-shadow: 0 0 25px rgba(188, 19, 254, 0.6); 
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* Stats Cards (Dashboard) */
.stats-grid { 
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 20px; margin-bottom: 30px; 
}
.stat-card { text-align: center; position: relative; overflow: hidden; }
.stat-val { 
    font-size: 42px; font-weight: 700; font-family: 'Rajdhani'; 
    color: white; text-shadow: 0 0 10px rgba(255,255,255,0.3); margin-bottom: 5px;
}
.stat-label { 
    font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; 
}

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { 
    text-align: left; padding: 15px; color: var(--text-muted); 
    font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
    border-bottom: 1px solid #333; 
}
td { 
    padding: 15px; border-bottom: 1px solid rgba(255,255,255,0.03); 
    color: white; font-size: 14px; 
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* Text Colors */
.text-neon-blue { color: var(--neon-blue); text-shadow: 0 0 8px rgba(0, 243, 255, 0.4); }
.text-neon-purple { color: var(--neon-purple); text-shadow: 0 0 8px rgba(188, 19, 254, 0.4); }
.text-neon-green { color: var(--neon-green); text-shadow: 0 0 8px rgba(10, 255, 10, 0.4); }

/* =========================================
   5. MODALS (Popups)
   ========================================= */
.modal-overlay {
    display: none; /* ซ่อนเป็นค่าเริ่มต้น */
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

/* =========================================
   6. ANIMATIONS
   ========================================= */
.tab-content { display: none; animation: slideUp 0.4s ease-out; }
.tab-content.active { display: block; }

@keyframes slideUp { 
    from { opacity: 0; transform: translateY(15px); } 
    to { opacity: 1; transform: translateY(0); } 
}

@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}

@keyframes pulseLight { 
    0% { opacity: 0.4; } 
    100% { opacity: 0.7; } 
}
/* =========================================
   7. USER MANAGER: edit-user modal + pager
   ========================================= */
.modal-box { width: 100%; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-header h3 { margin: 0; color: var(--neon-blue); text-shadow: 0 0 8px rgba(0, 243, 255, 0.4); }
.close-modal { cursor: pointer; color: #777; font-size: 18px; padding: 4px 8px; border-radius: 4px; }
.close-modal:hover { color: white; background: rgba(255,255,255,0.08); }
.form-group label { display: block; font-size: 12px; color: #aaa; margin: 14px 0 6px; }
.glow-border-blue { border: 1px solid var(--neon-blue); box-shadow: 0 0 20px rgba(0, 243, 255, 0.25); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 15px; padding-top: 15px; border-top: 1px solid #222; color: #888; font-size: 13px; }
.pager .btn { padding: 8px 12px; font-size: 12px; background: transparent; border: 1px solid #444; color: #ccc; }
.pager .btn:hover:not(:disabled) { border-color: var(--neon-blue); color: var(--neon-blue); }
.hwid-cell { font-family: monospace; font-size: 11px; color: #8b8b9b; cursor: pointer; white-space: nowrap; }
.hwid-cell:hover { color: var(--neon-blue); }
