@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
    --bg-app: #0a0a0f;
    --bg-side: #0f0f15;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c26;
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.15);
    --text-main: #f4f4f5;
    --text-dim: #a1a1aa;
    --text-mute: #52525b;
    --font-mono: 'JetBrains Mono', monospace;
    --radius: 8px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-app: #f1f5f9;
    --bg-side: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --border: rgba(15, 23, 42, 0.08);
    --border-hover: rgba(15, 23, 42, 0.15);
    --accent: #2563eb;
    --accent-glow: rgba(37, 99, 235, 0.1);
    --text-main: #0f172a;
    --text-dim: #475569;
    --text-mute: #94a3b8;
}

[data-theme="light"] .logo-wrapper {
    background: #f8fafc;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.2);
}

[data-theme="light"] .title-main h1 {
    color: #0f172a;
}

[data-theme="light"] .console-wrapper {
    background: #0f172a;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
}

[data-theme="light"] .info-grid {
    background: #f8fafc;
}

[data-theme="light"] .theme-switch { background: #f1f5f9; }
[data-theme="light"] .lang-switch { background: #f1f5f9; }

/* --- AUTH OVERLAY --- */
.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-app);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 40px;
    border-radius: 20px;
    width: 400px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.login-logo {
    width: 60px; height: 60px;
    background: var(--accent);
    color: #fff;
    font-size: 30px;
    font-weight: 900;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    margin: 0 auto 20px;
    box-shadow: 0 0 20px var(--accent-glow);
}

.login-box h2 {
    font-size: 18px;
    color: var(--text-main);
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.login-box p {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 30px;
}

.login-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-input-group input {
    height: 50px;
    background: rgba(0,0,0,0.1);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    padding: 0 15px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.login-input-group input:focus {
    border-color: var(--accent);
}

.login-input-group button {
    height: 50px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition);
}

.login-input-group button:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.login-error {
    margin-top: 20px;
    color: #ef4444;
    font-size: 10px;
    font-weight: 700;
    display: none;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg-app);
    color: var(--text-main);
    font-family: var(--font-mono);
    height: 100vh;
    overflow: hidden;
    transition: var(--transition);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* --- HEADER --- */
.app-header {
    height: 60px;
    background: var(--bg-side);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    z-index: 10;
}

.brand { display: flex; align-items: center; gap: 16px; position: relative; }

.logo-wrapper {
    position: relative;
    width: 36px;
    height: 36px;
    background: #000;
    border: 2px solid var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 0 15px var(--accent-glow);
    transition: var(--transition);
}

.logo {
    color: var(--accent);
    font-size: 20px;
    font-weight: 900;
    z-index: 2;
    text-shadow: 0 0 8px var(--accent);
}

.scan-line {
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--accent), transparent);
    opacity: 0.3;
    z-index: 1;
    animation: scan 3s linear infinite;
}

@keyframes scan {
    0% { top: -100%; }
    100% { top: 100%; }
}

.title-main {
    display: flex;
    align-items: center;
    gap: 4px;
}

.title-main h1 {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #fff;
    text-transform: uppercase;
}

.bracket {
    color: var(--accent);
    font-weight: 900;
    font-size: 18px;
    opacity: 0.7;
}

.cursor {
    color: var(--accent);
    font-weight: 900;
    animation: blink 1s steps(2) infinite;
}

@keyframes blink {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.brand:hover .logo-wrapper {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 25px var(--accent);
}

.brand:hover .title-main h1 {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
}

.title-group .sub { 
    display: block;
    font-size: 9px; 
    color: var(--text-mute); 
    font-weight: 600;
    margin-top: -2px;
}

.header-actions { display: flex; align-items: center; gap: 20px; }

.live-clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: var(--font-mono);
    margin-right: 5px;
    padding-right: 15px;
    border-right: 1px solid var(--border);
}

#current-date {
    font-size: 8px;
    color: var(--text-mute);
    font-weight: 800;
}

#current-time {
    font-size: 13px;
    color: var(--accent);
    font-weight: 800;
    letter-spacing: 1px;
}

/* --- TRUCK ANIMATION --- */
.app-header {
    position: relative;
    overflow: hidden;
}

.truck-lane {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: transparent;
    z-index: 100;
}

.truck-icon {
    position: absolute;
    bottom: -2px;
    left: -50px;
    font-size: 14px;
    /* Flip the emoji to face right and add vibration */
    animation: drive 25s linear infinite, engine-shake 0.3s infinite;
    z-index: 101;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}

@keyframes drive {
    0% { left: -50px; transform: scaleX(-1); }
    100% { left: 100%; transform: scaleX(-1); }
}

@keyframes engine-shake {
    0%, 100% { margin-bottom: 0px; }
    50% { margin-bottom: 1px; }
}

.lang-switch {
    display: flex;
    background: rgba(0,0,0,0.1);
    border: 1px solid var(--border);
    padding: 3px;
    border-radius: 6px;
    gap: 2px;
}

.lang-switch button {
    background: transparent; border: none; color: var(--text-dim);
    font-size: 9px; font-family: var(--font-mono); padding: 4px 8px; 
    cursor: pointer; border-radius: 4px; transition: var(--transition);
    font-weight: 700;
}

.lang-switch button.active {
    background: var(--accent);
    color: #fff;
}

.theme-switch {
    display: flex; 
    background: rgba(0,0,0,0.1); 
    border: 1px solid var(--border); 
    padding: 3px;
    border-radius: 6px;
}

[data-theme="light"] .theme-switch { background: rgba(0,0,0,0.03); }

.theme-switch button {
    background: transparent; border: none; color: var(--text-dim);
    font-size: 9px; font-family: var(--font-mono); padding: 4px 10px; 
    cursor: pointer; border-radius: 4px; transition: var(--transition);
}
.theme-switch button.active { background: var(--bg-app); color: var(--accent); font-weight: 700; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }

.system-status { 
    font-size: 10px; 
    font-weight: 800; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    color: var(--text-main);
    background: rgba(16, 185, 129, 0.05);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    letter-spacing: 0.5px;
}

.logout-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.logout-btn:hover {
    background: #ef4444;
    color: #fff;
    transform: scale(1.05);
}

.logout-btn span {
    font-size: 12px;
}

.status-dot { 
    width: 8px; 
    height: 8px; 
    background: #10b981; 
    border-radius: 50%; 
    position: relative;
}

.status-dot::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    background: #10b981;
    animation: pulse-active 2s infinite;
}

@keyframes pulse-active {
    0% { transform: scale(1); opacity: 0.8; }
    70% { transform: scale(3); opacity: 0; }
    100% { transform: scale(3); opacity: 0; }
}

.status-text {
    color: #10b981;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

/* --- MAIN LAYOUT --- */
.main-layout { 
    flex: 1; 
    display: grid; 
    grid-template-columns: 320px 1fr; 
    overflow: hidden; 
    height: calc(100vh - 60px);
}

/* --- SIDEBAR --- */
.sidebar {
    background: var(--bg-side);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 24px;
    gap: 24px;
    height: 100%;
    overflow-y: auto;
}

.sc-link {
    background: linear-gradient(to right, rgba(59, 130, 246, 0.1), transparent);
    border-left: 3px solid var(--accent);
}

.sidebar-section { display: flex; flex-direction: column; gap: 12px; flex-shrink: 0; }
.sidebar-section:has(.console-wrapper) { flex: 1; display: flex; flex-direction: column; min-height: 200px; }

.sidebar-section label { 
    font-size: 10px; 
    color: var(--text-mute); 
    text-transform: uppercase; 
    font-weight: 700; 
    letter-spacing: 1px;
}

.info-grid {
    background: rgba(0,0,0,0.1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

[data-theme="light"] .info-grid { background: rgba(0,0,0,0.02); }

.info-item { display: flex; justify-content: space-between; font-size: 10px; }
.info-item span:first-child { color: var(--text-dim); }
.info-item span:last-child { color: var(--text-main); font-weight: 600; }

.utility-links { display: flex; flex-direction: column; gap: 6px; }
.util-link {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-main);
    text-decoration: none; font-size: 11px; transition: var(--transition);
    font-weight: 500;
}
.util-link:hover { 
    border-color: var(--accent); 
    background: var(--bg-card-hover);
    transform: translateX(4px);
    color: var(--accent);
}
.link-icon { font-size: 14px; opacity: 0.9; }

.console-wrapper {
    flex: 1;
    background: #020203; 
    border: 1px solid var(--border);
    border-radius: var(--radius); 
    padding: 14px; 
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    box-shadow: inset 0 4px 20px rgba(0,0,0,0.8);
}
.console { 
    font-size: 11px; 
    line-height: 1.6; 
    color: #10b981; 
    word-break: break-all;
    white-space: pre-wrap;
    text-shadow: 0 0 5px rgba(16, 185, 129, 0.2);
}

.sidebar-footer { 
    padding: 20px 0 30px 0; 
    flex-shrink: 0; 
    border-top: 1px solid var(--border);
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* --- SEARCH --- */
.search-container {
    margin-bottom: 24px;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    transition: var(--transition);
}

.search-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.search-icon {
    font-size: 14px;
    opacity: 0.5;
    margin-right: 12px;
}

#module-search {
    width: 100%;
    height: 48px;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    outline: none;
}

#module-search::placeholder {
    color: var(--text-mute);
    letter-spacing: 1px;
}

/* --- BUTTONS --- */
.text-link-btn {
    background: rgba(59, 130, 246, 0.08); 
    border: 1px solid rgba(59, 130, 246, 0.2); 
    color: var(--accent); 
    font-family: var(--font-mono);
    font-size: 9px; 
    cursor: pointer; 
    padding: 4px 12px; 
    border-radius: 4px;
    text-decoration: none; 
    transition: var(--transition);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.text-link-btn:hover { 
    background: var(--accent); 
    color: #fff; 
    border-color: var(--accent);
    box-shadow: 0 2px 8px var(--accent-glow);
}

.action-btn {
    width: 100%; 
    padding: 16px; 
    background: linear-gradient(135deg, var(--accent), #1e40af); 
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff; 
    font-family: var(--font-mono); 
    font-weight: 700; 
    font-size: 11px;
    cursor: pointer; 
    border-radius: var(--radius); 
    transition: var(--transition);
    text-transform: uppercase; 
    letter-spacing: 1.5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 8px 25px var(--accent-glow);
    filter: brightness(1.1);
}

.action-btn:active {
    transform: translateY(0);
}

/* --- CONTENT AREA --- */
.content-area { 
    height: 100%;
    overflow: hidden;
}

.scroll-container { 
    height: 100%; 
    padding: 40px; 
    overflow-y: auto; 
    scrollbar-gutter: stable;
}

.module-group { margin-bottom: 40px; }
.group-header {
    font-size: 11px; color: var(--accent); text-transform: uppercase;
    font-weight: 700; margin-bottom: 20px; letter-spacing: 1.5px;
    display: flex; align-items: center; gap: 12px;
}
.group-header::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.preset-bar { display: flex; gap: 8px; margin-bottom: 24px; }
.preset-btn {
    background: var(--bg-card); border: 1px solid var(--border); color: var(--text-dim);
    padding: 8px 14px; font-size: 10px; font-family: var(--font-mono); font-weight: 600;
    cursor: pointer; border-radius: 6px; transition: var(--transition);
}
.preset-btn:hover { border-color: var(--accent); color: var(--text-main); background: var(--bg-card-hover); }
.preset-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

.card { cursor: pointer; display: flex; }
.card input { display: none; }

.card-body {
    flex: 1; background: var(--bg-card); border: 1px solid var(--border);
    padding: 20px; border-radius: var(--radius); transition: var(--transition);
    display: flex; flex-direction: column; gap: 8px;
}
.card:hover .card-body { border-color: var(--border-hover); background: var(--bg-card-hover); transform: translateY(-2px); }

.card-meta { display: flex; justify-content: flex-end; }
.risk { font-size: 8px; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; font-weight: 700; }
.risk-low { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.risk-med { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.risk-high { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

.card-body h3 { 
    font-size: 13px; 
    font-weight: 800; 
    color: var(--text-main); 
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.card-body p { 
    font-size: 10px; 
    color: var(--text-dim); 
    line-height: 1.5; 
    margin-bottom: 12px;
}

.card-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.info-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-label {
    font-size: 8px;
    font-weight: 800;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-val {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    line-height: 1.3;
}

.cmd-preview {
    display: flex; align-items: center; background: rgba(0, 0, 0, 0.2);
    padding: 8px 10px; border-radius: 4px; font-size: 9px;
    color: var(--text-dim); border: 1px solid var(--border);
    margin-top: 8px; opacity: 0.7; transition: var(--transition);
}
[data-theme="light"] .cmd-preview { background: rgba(0, 0, 0, 0.03); }

.cmd-preview::before { content: '$'; margin-right: 8px; color: var(--text-mute); }

.card input:checked + .card-body {
    border-color: var(--accent);
    background: var(--accent-glow);
}
.card input:checked + .card-body h3 { color: var(--accent); }
.card input:checked + .card-body .cmd-preview { border-color: var(--accent); opacity: 1; color: var(--text-main); }

/* --- SCROLLBAR --- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }
