/**
 * HackTeam Manager - Modern SaaS Theme & Design System
 * Supports Light & Dark Modes via CSS Variables
 */

:root {
    /* Brand Colors */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-rgb: 79, 70, 229;
    --primary-light: #e0e7ff;
    --primary-dark: #3730a3;
    
    --secondary: #64748b;
    --secondary-hover: #475569;
    
    --success: #10b981;
    --success-rgb: 16, 185, 129;
    --success-light: #d1fae5;
    
    --warning: #f59e0b;
    --warning-rgb: 245, 158, 11;
    --warning-light: #fef3c7;
    
    --danger: #ef4444;
    --danger-rgb: 239, 68, 68;
    --danger-light: #fee2e2;
    
    --info: #06b6d4;
    --info-rgb: 6, 182, 212;
    --info-light: #cffafe;

    /* Theme Layout Tokens (Light Mode Default) */
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: #312e81;
    --text-sidebar: #94a3b8;
    --text-sidebar-bright: #f8fafc;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 12px 20px -5px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --dropdown-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --sidebar-width: 260px;
    --header-height: 70px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-bs-theme="dark"] {
    --bg-body: #0b0f19;
    --bg-surface: #111827;
    --bg-surface-elevated: #1f2937;
    --bg-sidebar: #0b0f19;
    --bg-sidebar-hover: #1f2937;
    --bg-sidebar-active: #3730a3;
    --text-sidebar: #9ca3af;
    --text-sidebar-bright: #f9fafb;
    
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --text-subtle: #6b7280;
    
    --border-color: #1f2937;
    --border-subtle: #1e293b;
    
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --card-shadow-hover: 0 14px 25px -5px rgba(0, 0, 0, 0.6);
    --dropdown-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    
    --primary-light: rgba(79, 70, 229, 0.2);
    --success-light: rgba(16, 185, 129, 0.2);
    --warning-light: rgba(245, 158, 11, 0.2);
    --danger-light: rgba(239, 68, 68, 0.2);
    --info-light: rgba(6, 182, 212, 0.2);
}

/* Base Styles */
body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    transition: background-color 0.25s ease, color 0.25s ease;
    overflow-x: hidden;
}

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

/* App Wrapper Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar Navigation */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--border-color);
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-sidebar-bright);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-brand i {
    color: #6366f1;
    font-size: 1.5rem;
    margin-right: 0.75rem;
}

.sidebar-team-badge {
    padding: 1rem 1.25rem;
    margin: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.sidebar-heading {
    font-size: 0.725rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-subtle);
    padding: 0.75rem 0.75rem 0.35rem 0.75rem;
    font-weight: 600;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.85rem;
    color: var(--text-sidebar);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.925rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}
.nav-link-custom i {
    width: 24px;
    font-size: 1.1rem;
    margin-right: 0.75rem;
    opacity: 0.85;
}
.nav-link-custom:hover {
    color: var(--text-sidebar-bright);
    background-color: var(--bg-sidebar-hover);
    transform: translateX(3px);
}
.nav-link-custom.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

/* Main Container Area */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Top Navbar Header */
.app-header {
    height: var(--header-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    backdrop-filter: blur(8px);
}

/* App Content Area */
.app-content {
    flex: 1;
    padding: 1.75rem;
}

/* Modern Card Design */
.card-custom {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}
.card-custom:hover {
    box-shadow: var(--card-shadow-hover);
}

.card-header-custom {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Metric / Stat Cards */
.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 1.25rem;
}
.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger  { background: var(--danger-light); color: var(--danger); }
.stat-icon.info    { background: var(--info-light); color: var(--info); }

.stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-main);
}
.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.25rem;
}

/* Badges & Buttons */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #ffffff;
    border: none;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 0.55rem 1.25rem;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
    transition: all 0.2s ease;
}
.btn-primary-custom:hover {
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(79, 70, 229, 0.35);
}

/* Notification Popover */
.notification-menu {
    width: 360px;
    max-height: 480px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--dropdown-shadow);
}
.notification-item {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: flex-start;
    transition: background 0.15s ease;
}
.notification-item:hover {
    background-color: var(--border-subtle);
}
.notification-item.unread {
    background-color: rgba(79, 70, 229, 0.05);
}

/* Tables */
.table-custom {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.table-custom th {
    background: var(--bg-body);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.825rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}
.table-custom td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
}
.table-custom tr:hover td {
    background-color: rgba(0, 0, 0, 0.02);
}
[data-bs-theme="dark"] .table-custom tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Mobile Sidebar Overlay */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1030;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .sidebar-backdrop.show {
        display: block;
    }
}
