/*
============================================================
 [ TAG: OS_STYLES ] 
 DESCRIPTION: CSS styles for the Antal OS desktop, taskbar, windows, and dark theme.
 TARGET AUDIENCE: Frontend & Backend Developers
============================================================

*/

/* ═══════════════════════════════════════════
   ANTAL DESKTOP — Dark Theme
   ═══════════════════════════════════════════ */

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

:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a2e;
    --bg-surface: #16213e;
    --bg-window: #1a1a2eee;
    --bg-taskbar: #16213eee;
    --bg-input: #0f3460;
    --accent: #00d4aa;
    --accent-hover: #00f0c0;
    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --text-dim: #555;
    --border: #2a2a4a;
    --danger: #e74c3c;
    --warning: #f39c12;
    --success: #27ae60;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 8px 32px rgba(0,0,0,0.6);
    --blur: blur(20px);
}

body {
    font-family: 'Segoe UI', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    user-select: none;
}

/* ── Desktop ── */
#desktop {
    position: absolute;
    top: 0; left: 0; right: 0;
    bottom: 48px;
    background: linear-gradient(135deg, #0d0d0d 0%, #1a1a2e 50%, #16213e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

#desktop-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0.15;
}

#desktop-logo span {
    font-size: 14px;
    letter-spacing: 4px;
    text-transform: uppercase;
}

/* ── Taskbar ── */
#taskbar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 48px;
    background: var(--bg-taskbar);
    backdrop-filter: var(--blur);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 9999;
}

#taskbar-left, #taskbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

#taskbar-right { justify-content: flex-end; }

#taskbar-center {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

#btn-launcher {
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

#btn-launcher:hover { background: rgba(255,255,255,0.1); }

.taskbar-btn {
    padding: 4px 14px;
    height: 34px;
    border: none;
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: background 0.15s;
}

.taskbar-btn:hover { background: rgba(255,255,255,0.12); }
.taskbar-btn.active { background: var(--accent); color: #000; font-weight: 600; }

#clock {
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.status-dot { font-size: 10px; }
.status-dot.green { color: var(--success); }
.status-dot.red { color: var(--danger); }

#os-version {
    font-size: 10px;
    color: var(--text-dim);
}

#system-status {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Windows ── */
.window {
    position: absolute;
    min-width: 480px;
    min-height: 320px;
    background: var(--bg-window);
    backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                height 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                border-radius 0.25s ease;
}

.window.focused {
    border: 1px solid rgba (255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.window.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: calc(100vh - 48px) !important;
    border-radius: 0;
}

.window.minimized { display: none; }

.window-titlebar {
    height: 40px;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    cursor: grab;
    flex-shrink: 0;
}

.window-titlebar:active { cursor: grabbing; }

.window-title {
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.window-controls {
    display: flex;
    gap: 8px;
}

.window-controls button {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 0;
    transition: opacity 0.15s;
    opacity: 0.7;
}

.window-controls button:hover { opacity: 1; }

.btn-minimize { background: var(--warning); }
.btn-maximize { background: var(--success); }
.btn-close { background: var(--danger); }

.window-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.window-body::-webkit-scrollbar { width: 6px; }
.window-body::-webkit-scrollbar-track { background: transparent; }
.window-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── App Launcher ── */
#app-launcher {
    position: fixed;
    top: 0; left: 0; right: 0;
    bottom: 48px;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(30px);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 60px;
}

#app-launcher.hidden { display: none; }

#launcher-header {
    text-align: center;
    margin-bottom: 40px;
}

#launcher-header h2 {
    font-size: 24px;
    font-weight: 300;
    margin-bottom: 16px;
}

#app-search {
    width: 320px;
    padding: 10px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

#app-search:focus { border-color: var(--accent); }

#launcher-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 120px);
    gap: 24px;
    justify-content: center;
    max-width: 800px;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}

.app-icon:hover { background: rgba(255,255,255,0.08); }

.app-icon-img {
    width: 56px; height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.app-icon-label {
    font-size: 12px;
    text-align: center;
    color: var(--text-secondary);
}

/* ── Settings Specific ── */
.settings-layout {
    display: flex;
    height: 100%;
}

.settings-sidebar {
    width: 180px;
    border-right: 1px solid var(--border);
    padding: 8px;
    flex-shrink: 0;
}

.settings-sidebar button {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    text-align: left;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 2px;
}

.settings-sidebar button:hover { background: rgba(255,255,255,0.06); }
.settings-sidebar button.active { background: var(--accent); color: #000; font-weight: 600; }

.settings-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.settings-section { margin-bottom: 24px; }
.settings-section h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--accent);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 13px;
}

.info-row .label { color: var(--text-secondary); }
.info-row .value { color: var(--text-primary); font-weight: 500; }

/* ── API Console ── */
.api-console textarea {
    width: 100%;
    min-height: 120px;
    background: #000;
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    resize: vertical;
    outline: none;
}

.api-console textarea:focus { border-color: var(--accent); }

.api-console pre {
    background: #000;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    overflow-x: auto;
    color: var(--text-primary);
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.btn {
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #fff; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.badge-high { background: var(--danger); color: #fff; }
.badge-medium { background: var(--warning); color: #000; }
.badge-low { background: var(--success); color: #fff; }
.badge-open { background: var(--accent); color: #000; }

/* ── Kova Dashboard ── */
.kova-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
}

.stat-card .stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.exception-list { list-style: none; }

.exception-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: rgba(255,255,255,0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.exception-info { flex: 1; }
.exception-info .entity { font-weight: 500; }
.exception-info .reason { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

#desktop-grid {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 16px;
    z-index: 10;
}
.app-icon {
    width: 100px;
    margin: 4px;
}
.app-icon-label {
    color: white !important;
    text-shadow: 0px 1px 3px rgba(0,0,0,0.8);
}

#btn-settings {
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
}
#btn-settings:hover { background: rgba(255,255,255,0.1); }
#btn-settings svg { stroke: white; fill: none; }

/* - App Opening Animation - */
@keyframes appOpen {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.window.window-opening {
    animation: appOpen 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* - App Closing Animation - */
@keyframes appClose {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.85) translateY(20px);
    }
}

.window.window-closing {
    animation: appClose 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* - App Minimizing Animation - */
@keyframes appMinimize {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.7) translateY(100px);
    }
}

.window.window-minimizing {
    animation: appMinimize 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* - App Restore Animation - */
@keyframes appRestore {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(30px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.window.window-restoring {
    animation: appRestore 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Global Dark Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb.hover {
    background: var(--accent);
}

/* ── Auth Screen Animations ── */
#auth-overlay {
    transition: background 0.5s ease-in-out;
}

.auth-card-content {
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.auth-fade-out {
    opacity: 0;
    transform: translateY(10px);
}

/* ── Remove Number Input Spinners ── */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield; /* Firefox compatibility */
}