/* Dark-Crawler Web Interface Styles - v3.0 (Clean Rewrite) */

/* ==========================================================================
   1. Variables & Theme Configuration
   ========================================================================== */
:root {
    /* Color Palette: Slate (Dark Mode Optimized) */
    --bg-body: #0f172a;       /* Slate 900 */
    --bg-surface: #1e293b;    /* Slate 800 */
    --bg-surface-hover: #334155; /* Slate 700 */
    --bg-sidebar: #020617;    /* Slate 950 */
    
    --border-color: #334155;  /* Slate 700 */
    --border-subtle: #1e293b; /* Slate 800 */
    
    /* Typography Colors */
    --text-primary: #f1f5f9;  /* Slate 100 - High contrast but not harsh white */
    --text-secondary: #cbd5e1; /* Slate 300 - Readable body text */
    --text-muted: #94a3b8;    /* Slate 400 - Metadata and de-emphasized text */
    
    /* Brand Colors */
    --primary: #60a5fa;       /* Blue 400 */
    --primary-hover: #3b82f6; /* Blue 500 */
    --primary-subtle: rgba(96, 165, 250, 0.15);
    
    /* Status Colors */
    --success: #10b981;       /* Emerald 500 */
    --warning: #f59e0b;       /* Amber 500 */
    --danger: #ef4444;        /* Red 500 */
    --info: #0ea5e9;          /* Sky 500 */
    
    /* Layout Dimensions */
    --sidebar-width: 260px;
    --header-height: 64px;
    
    /* Spacing & Radius */
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-sm: 0.25rem;
}

/* ==========================================================================
   2. Reset & Base Styles
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

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

a:hover {
    color: var(--primary-hover);
    text-decoration: none;
}

/* ==========================================================================
   3. Layout Structure
   ========================================================================== */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
}

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

.top-header {
    height: var(--header-height);
    background-color: rgba(15, 23, 42, 0.8); /* Semi-transparent slate 900 */
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 900;
}

.content-wrapper {
    padding: 2rem;
    flex: 1;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* ==========================================================================
   4. Navigation Components
   ========================================================================== */
.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background-color: var(--primary);
    color: #ffffff; /* Always white on primary background */
}

.nav-link i {
    width: 1.25rem;
    text-align: center;
    font-size: 1rem;
}

/* ==========================================================================
   5. UI Components
   ========================================================================== */
/* Cards */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-outline-secondary:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* Tables */
.table {
    color: var(--text-secondary);
    margin-bottom: 0;
    width: 100%;
}

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

.table td {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    padding: 0.35em 0.65em;
    font-weight: 600;
    border-radius: 9999px;
    font-size: 0.75rem;
}

.bg-success { background-color: var(--success) !important; color: #ffffff; }
.bg-danger { background-color: var(--danger) !important; color: #ffffff; }
.bg-warning { background-color: var(--warning) !important; color: #000000; }
.bg-info { background-color: var(--info) !important; color: #ffffff; }
.bg-primary { background-color: var(--primary) !important; color: #ffffff; }
.bg-secondary { background-color: var(--bg-surface-hover) !important; color: var(--text-secondary); }

/* Forms */
.form-control, .form-select {
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    padding: 0.625rem 1rem;
}

.form-control:focus, .form-select:focus {
    background-color: var(--bg-body);
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--primary-subtle);
}

/* Tabs */
.nav-tabs {
    border-bottom: 1px solid var(--border-color);
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    margin-bottom: -1px;
}

.nav-tabs .nav-link:hover {
    color: var(--text-primary);
    border-color: transparent;
    background: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    background: transparent;
    border-bottom: 2px solid var(--primary);
}

/* Dropdowns */
.dropdown-menu {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.dropdown-item {
    color: var(--text-secondary);
}

.dropdown-item:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.dropdown-divider {
    border-top-color: var(--border-color);
}

/* ==========================================================================
   6. Utilities & Helpers
   ========================================================================== */
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }

.border-primary { border-color: var(--primary) !important; }
.border-secondary { border-color: var(--border-color) !important; }

.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important; }

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .top-header {
        padding: 0 1rem;
    }
    .content-wrapper {
        padding: 1rem;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
