/* =========================================================
   MyKinerjaSOC - Design System & CSS Variables
   Adhering to TEMPLATE.md Specifications
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root, [data-theme="light"] {
    --bg-app: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: #2563eb;
    --bg-input: #ffffff;
    
    --border-color: #e2e8f0;
    --border-sidebar: #334155;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-sidebar: #f8fafc;
    --text-sidebar-muted: #94a3b8;
    
    --accent-primary: #2563eb;
    --accent-primary-hover: #1d4ed8;
    --accent-green: #16a34a;
    --accent-yellow: #ca8a04;
    --accent-red: #dc2626;
    --accent-purple: #7c3aed;
    --accent-cyan: #0891b2;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="dark"], .dark-theme {
    --bg-app: #090d16;
    --bg-surface: #111827;
    --bg-surface-hover: #1f2937;
    --bg-sidebar: #0b0f19;
    --bg-sidebar-hover: #161e2e;
    --bg-sidebar-active: #3b82f6;
    --bg-input: #1f2937;
    
    --border-color: #1f2937;
    --border-sidebar: #1f2937;
    
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-sidebar: #f9fafb;
    --text-sidebar-muted: #6b7280;
    
    --accent-primary: #3b82f6;
    --accent-primary-hover: #60a5fa;
    --accent-green: #22c55e;
    --accent-yellow: #eab308;
    --accent-red: #ef4444;
    --accent-purple: #a855f7;
    --accent-cyan: #06b6d4;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: var(--accent-primary-hover);
}

/* Layout Hierarchy */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 270px;
    background-color: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--border-sidebar);
    transition: width 0.2s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-sidebar);
}

.sidebar-logo {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px 24px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: var(--border-sidebar);
    border-radius: 4px;
}

.nav-group {
    margin-bottom: 6px;
}

.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.nav-section-header:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-section-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-section-count {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    background-color: rgba(59, 130, 246, 0.18);
    color: #60a5fa;
    font-family: var(--font-mono);
}

.nav-section-chevron {
    font-size: 0.7rem;
    color: #94a3b8;
    transition: transform 0.2s ease;
}

.nav-group.collapsed .nav-section-chevron {
    transform: rotate(-90deg);
}

.nav-group-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 4px;
}

.nav-group.collapsed .nav-group-items {
    display: none !important;
}


.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: 0.84rem;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
    margin-bottom: 2px;
    text-decoration: none;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    color: #94a3b8;
}

.nav-item:hover {
    background-color: var(--bg-sidebar-hover);
    color: #ffffff;
}
.nav-item:hover i {
    color: #ffffff;
}

.nav-item.active {
    background-color: var(--bg-sidebar-active);
    color: #ffffff;
    font-weight: 600;
}

.nav-item.active i {
    color: #ffffff;
}

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
}

.topbar {
    min-height: 64px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    position: sticky;
    top: 0;
    z-index: 90;
    gap: 16px;
    flex-wrap: wrap;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}


.content-body {
    flex: 1;
    padding: 28px;
}

.footer {
    padding: 16px 28px;
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* UI Cards & Grids */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}


.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.stat-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-body {
    padding: 20px;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

.table th {
    background-color: var(--bg-surface-hover);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table tr:hover td {
    background-color: var(--bg-surface-hover);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: var(--font-mono);
}
.badge-green { background-color: rgba(22, 163, 74, 0.12); color: var(--accent-green); }
.badge-red { background-color: rgba(220, 38, 38, 0.12); color: var(--accent-red); }
.badge-yellow { background-color: rgba(202, 138, 4, 0.12); color: var(--accent-yellow); }
.badge-blue { background-color: rgba(37, 99, 235, 0.12); color: var(--accent-primary); }

/* Buttons & Inputs */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}
.btn-primary {
    background-color: var(--accent-primary);
    color: #ffffff;
}
.btn-primary:hover {
    background-color: var(--accent-primary-hover);
    color: #ffffff;
}
.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover {
    background-color: var(--bg-surface-hover);
}
.btn-sm {
    padding: 4px 10px;
    font-size: 0.75rem;
}

.form-group {
    margin-bottom: 16px;
}
.form-label {
    display: block;
    font-size: 0.825rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease;
}
.form-control:focus {
    border-color: var(--accent-primary);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success {
    background-color: rgba(22, 163, 74, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(22, 163, 74, 0.2);
}
.alert-danger {
    background-color: rgba(220, 38, 38, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}
.theme-toggle-btn:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

/* Cyber Modal Dialogs */
.cyber-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.cyber-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.cyber-modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 28px 24px;
    max-width: 460px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 38px rgba(0, 0, 0, 0.35);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.cyber-modal-overlay.active .cyber-modal-card {
    transform: scale(1);
}

.cyber-modal-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto 16px;
}

.cyber-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.cyber-modal-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
}

.cyber-modal-actions {
    display: flex;
    gap: 12px;
}

/* Toast Box */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    color: var(--text-primary);
    font-size: 0.85rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease;
}

@keyframes toastSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

