/* ══════════════════════════════════════════════════════════════════════════
   GSC Ninja Dashboard — Design System
   ══════════════════════════════════════════════════════════════════════════ */

/* -- Custom Properties (Dark Theme) -- */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2332;
    --bg-hover: #243044;
    --bg-input: #0d1117;
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent-primary: #00D1FF;
    --accent-secondary: #00FF88;
    --accent-warning: #FFB800;
    --accent-danger: #FF4444;
    --border-color: #1e293b;
    --sidebar-width: 260px;
    --header-height: 64px;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-card: 0 4px 6px -1px rgba(0,0,0,0.3);
    --transition: all 0.2s ease;
}

/* -- Reset & Base -- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--accent-primary); text-decoration: none; transition: var(--transition); }
a:hover { opacity: 0.85; }
img { max-width: 100%; }

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

/* -- Sidebar -- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
    display: flex;
    flex-direction: column;
}
.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-logo h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: -0.02em;
}
.sidebar-logo span {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.sidebar-nav {
    padding: 12px 8px;
    flex: 1;
    list-style: none;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: var(--text-secondary);
    transition: var(--transition);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--bg-hover); color: var(--accent-primary); font-weight: 600; }
.nav-icon { width: 18px; text-align: center; opacity: 0.7; }
.nav-item.active .nav-icon { opacity: 1; }

/* Sidebar Clients */
.sidebar-section-title {
    padding: 16px 16px 8px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}
.client-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    margin: 0 8px;
    transition: var(--transition);
}
.client-item:hover { background: var(--bg-hover); }
.client-item.active { color: var(--text-primary); }
.client-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Sidebar User */
.sidebar-user {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}
.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--bg-primary);
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* -- Main Content -- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

/* -- Header -- */
.header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 40;
}
.header-title { font-size: 1.1rem; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 12px; }

/* -- Page Content -- */
.page-content { padding: 24px; }
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
}

/* -- KPI Cards -- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-card);
    border-left: 3px solid var(--accent-primary);
    transition: var(--transition);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 16px rgba(0,0,0,0.3); }
.kpi-card__label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}
.kpi-card__value { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
.kpi-card__delta { font-size: 0.8rem; margin-top: 4px; }
.kpi-card__delta--up { color: var(--accent-secondary); }
.kpi-card__delta--down { color: var(--accent-danger); }

/* -- Cards / Panels -- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 { font-size: 0.95rem; font-weight: 600; }
.card-body { padding: 20px; }

/* -- Tables -- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.data-table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-secondary);
    position: sticky;
    top: var(--header-height);
    z-index: 10;
    cursor: pointer;
    user-select: none;
}
.data-table th:hover { color: var(--accent-primary); }
.data-table th .sort-arrow { margin-left: 4px; opacity: 0.5; }
.data-table th.sorted .sort-arrow { opacity: 1; color: var(--accent-primary); }
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table td { font-size: 0.9rem; }
.data-table .url-cell {
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* -- Buttons -- */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent-primary); color: var(--bg-primary); }
.btn-primary:hover { background: #00b8e6; }
.btn-success { background: var(--accent-secondary); color: var(--bg-primary); }
.btn-danger { background: var(--accent-danger); color: white; }
.btn-warning { background: var(--accent-warning); color: var(--bg-primary); }
.btn-ghost {
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
}
.btn-ghost:hover { background: rgba(0, 209, 255, 0.1); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-group { display: flex; gap: 8px; }

/* -- Forms & Inputs -- */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.form-input,
.form-select,
.form-textarea {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    width: 100%;
    font-size: 0.9rem;
    font-family: var(--font-main);
    transition: var(--transition);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 209, 255, 0.15);
}
.form-textarea { min-height: 100px; resize: vertical; }
.form-select { cursor: pointer; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

/* -- Filter Bar -- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    flex-wrap: wrap;
    border: 1px solid var(--border-color);
}
.filter-bar .form-input,
.filter-bar .form-select {
    width: auto;
    min-width: 140px;
}
.date-presets { display: flex; gap: 4px; }
.date-preset {
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}
.date-preset:hover,
.date-preset.active {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
}

/* -- Badges -- */
.badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-block;
}
.badge--success { background: rgba(0, 255, 136, 0.15); color: var(--accent-secondary); }
.badge--danger { background: rgba(255, 68, 68, 0.15); color: var(--accent-danger); }
.badge--warning { background: rgba(255, 184, 0, 0.15); color: var(--accent-warning); }
.badge--info { background: rgba(0, 209, 255, 0.15); color: var(--accent-primary); }

/* -- Status Indicators -- */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot--green { background: var(--accent-secondary); }
.status-dot--yellow { background: var(--accent-warning); }
.status-dot--red { background: var(--accent-danger); }

/* -- Tabs -- */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}
.tab {
    padding: 12px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    font-weight: 500;
}
.tab:hover { color: var(--text-primary); }
.tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    font-weight: 600;
}

/* -- Alerts Widget -- */
.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}
.alert-item:hover { background: var(--bg-hover); }
.alert-item:last-child { border-bottom: none; }

/* -- Loading -- */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -- Empty State -- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state__icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state__text { font-size: 1rem; }

/* -- Toast / Notifications -- */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 1000;
    animation: slideUp 0.3s ease;
    max-width: 400px;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* -- Responsive -- */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
}
@media (max-width: 768px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .form-row { flex-direction: column; }
    .page-content { padding: 16px; }
}
@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .header { padding: 0 12px; }
}
