@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* Backgrounds - Crisp White & Clean Slate */
    --bg-main: #f4f6fb;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-sidebar: #0a1633;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.08);
    --border-color: #e2e8f0;
    --border-dark: #cbd5e1;
    --border-subtle: #edf2f7;

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;

    /* Theme: Royal Blue, Crisp White, Vivid Red */
    --primary-blue: #1d4ed8;
    --primary-blue-hover: #1e40af;
    --primary-blue-dark: #172554;
    --primary-blue-light: #3b82f6;
    --primary-blue-subtle: #eff6ff;
    --primary-blue-border: #bfdbfe;

    --accent-red: #dc2626;
    --accent-red-hover: #b91c1c;
    --accent-red-dark: #991b1b;
    --accent-red-light: #ef4444;
    --accent-red-subtle: #fef2f2;
    --accent-red-border: #fecaca;

    /* Status Colors */
    --status-success: #16a34a;
    --status-success-subtle: #f0fdf4;
    --status-warning: #d97706;
    --status-warning-subtle: #fffbeb;
    --status-danger: #dc2626;
    --status-danger-subtle: #fef2f2;
    --status-info: #1d4ed8;
    --status-info-subtle: #eff6ff;

    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.07);
    --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
    --shadow-blue: 0 4px 14px rgba(29, 78, 216, 0.25);
    --shadow-red: 0 4px 14px rgba(220, 38, 38, 0.25);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    line-height: 1.5;
}

/* ==========================================================================
   Auth / Login Page (Blue + White + Red)
   ========================================================================== */
.auth-wrapper {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, #eff6ff 0%, #f4f6fb 50%, #fef2f2 100%);
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 430px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-top: 5px solid var(--accent-red);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-blue) 0%, var(--accent-red) 100%);
}

.auth-brand {
    text-align: center;
    margin-bottom: 26px;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--primary-blue-subtle);
    border: 1px solid var(--primary-blue-border);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 12px;
}

.auth-title {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-top: 4px;
}

/* ==========================================================================
   App Container & Navigation (Blue + White + Red)
   ========================================================================== */
.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #09132b 0%, #0c1b3f 100%);
    border-right: 1px solid #172a59;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
}

.sidebar-header {
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.sidebar-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-blue) 0%, var(--accent-red) 100%);
}

.sidebar-logo-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-red) 0%, #b91c1c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: #ffffff;
    box-shadow: var(--shadow-red);
}

.sidebar-logo-text {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.sidebar-logo-text span {
    color: #93c5fd;
    font-size: 0.72rem;
    display: block;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar-menu {
    padding: 16px 12px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-heading {
    font-size: 0.68rem;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 12px 12px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
    transition: all 0.15s ease;
    position: relative;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

.nav-link.active {
    color: #ffffff;
    background: linear-gradient(90deg, var(--primary-blue) 0%, #1e40af 100%);
    font-weight: 700;
    box-shadow: var(--shadow-blue);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--accent-red);
    border-radius: 4px 0 0 4px;
}

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 2.2;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #060d1f;
}

.user-profile-widget {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-blue) 0%, #1e40af 100%);
    border: 2px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #ffffff;
    font-size: 0.9rem;
}

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-details .name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-details .role {
    font-size: 0.72rem;
    color: #93c5fd;
    text-transform: capitalize;
    font-weight: 600;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.main-wrapper {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100vw - 260px);
    background-color: var(--bg-main);
}

.topbar {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-xs);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.content-body {
    padding: 28px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ==========================================================================
   Cards & Stats Widgets (Blue & Red Accents)
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-blue);
    border-radius: var(--radius-md);
    padding: 22px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.stat-card:nth-child(2) {
    border-left-color: var(--accent-red);
}

.stat-card:nth-child(3) {
    border-left-color: var(--primary-blue-light);
}

.stat-card:nth-child(4) {
    border-left-color: var(--accent-red-light);
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-icon-indigo, .stat-icon-cyan {
    background: var(--primary-blue-subtle);
    color: var(--primary-blue);
    border: 1px solid var(--primary-blue-border);
}

.stat-icon-amber, .stat-icon-emerald {
    background: var(--accent-red-subtle);
    color: var(--accent-red);
    border: 1px solid var(--accent-red-border);
}

.stat-content {
    flex: 1;
}

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

.stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 2px;
}

/* Section Card */
.card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ==========================================================================
   Buttons (Blue & Red Theme)
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(180deg, var(--primary-blue) 0%, var(--primary-blue-hover) 100%);
    color: #ffffff;
    box-shadow: var(--shadow-blue);
    border: 1px solid var(--primary-blue-hover);
}

.btn-primary:hover {
    background: var(--primary-blue-hover);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(180deg, var(--accent-red) 0%, var(--accent-red-hover) 100%);
    color: #ffffff;
    box-shadow: var(--shadow-red);
    border: 1px solid var(--accent-red-hover);
}

.btn-danger:hover {
    background: var(--accent-red-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-dark);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

/* ==========================================================================
   Form Controls
   ========================================================================== */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control, .form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.92rem;
    transition: all 0.15s ease;
}

.form-control:focus, .form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

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

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* ==========================================================================
   Badges & Alerts (Blue, Red, Success, Warning)
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-info, .badge-blue {
    background: var(--primary-blue-subtle);
    color: var(--primary-blue);
    border: 1px solid var(--primary-blue-border);
}

.badge-danger, .badge-red {
    background: var(--accent-red-subtle);
    color: var(--accent-red);
    border: 1px solid var(--accent-red-border);
}

.badge-success {
    background: var(--status-success-subtle);
    color: var(--status-success);
    border: 1px solid #bbf7d0;
}

.badge-warning {
    background: var(--status-warning-subtle);
    color: var(--status-warning);
    border: 1px solid #fde68a;
}

.badge-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-active {
    background: var(--status-success-subtle);
    color: var(--status-success);
    border: 1px solid #bbf7d0;
}
.status-active::before { background: var(--status-success); }

.status-suspended {
    background: var(--accent-red-subtle);
    color: var(--accent-red);
    border: 1px solid var(--accent-red-border);
}
.status-suspended::before { background: var(--accent-red); }

/* Status Dot */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background-color: var(--status-success);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.status-dot.offline {
    background-color: var(--accent-red);
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: var(--status-success-subtle);
    color: #14532d;
    border: 1px solid #bbf7d0;
    border-left: 4px solid var(--status-success);
}

.alert-danger {
    background: var(--accent-red-subtle);
    color: #7f1d1d;
    border: 1px solid var(--accent-red-border);
    border-left: 4px solid var(--accent-red);
}

.alert-info {
    background: var(--primary-blue-subtle);
    color: #1e3a8a;
    border: 1px solid var(--primary-blue-border);
    border-left: 4px solid var(--primary-blue);
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
