:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
    --background: #f1f5f9;
    --surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 0.5rem;
    --sidebar-width: 260px;
}

body {
    background-color: var(--background);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Brand Logo */
.brand-logo-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
}

.brand-logo {
    max-height: 50px;
    max-width: 60px;
    object-fit: contain;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar .nav-link {
    color: #94a3b8;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    margin: 0.125rem 0.75rem;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.sidebar .nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    color: #ffffff;
    background: var(--primary);
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    margin-right: 0.75rem;
}

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

/* Cards */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--surface);
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

/* Stats cards */
.stat-card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

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

/* Tables */
.table {
    font-size: 0.9rem;
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom-width: 1px;
}

.table td {
    vertical-align: middle;
}

/* Badges */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

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

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

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

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Page header */
.page-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 0;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.page-header .text-muted {
    font-size: 0.875rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Responsive - Tablet */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

/* Responsive - Mobile */
@media (max-width: 767.98px) {
    /* Header actions */
    .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .d-flex.flex-wrap.gap-2 {
        width: 100%;
    }

    .d-flex.flex-wrap.gap-2 .btn,
    .d-flex.flex-wrap.gap-2 form {
        flex: 1 1 auto;
        min-width: 0;
    }

    .d-flex.flex-wrap.gap-2 .btn {
        white-space: nowrap;
        font-size: 0.8rem;
        padding: 0.375rem 0.5rem;
    }

    /* Filter form */
    .card .form .row {
        gap: 0.5rem;
    }

    .card .form .col-md-6,
    .card .form .col-md-4,
    .card .form .col-md-2 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Tables */
    .table-responsive {
        font-size: 0.8rem;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.35rem;
        white-space: nowrap;
    }

    .table .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .table .btn-group .btn {
        width: 100%;
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Hide less important columns on mobile */
    .table .hide-mobile {
        display: none;
    }

    /* Cards */
    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    /* Page header */
    .page-header {
        padding: 1rem 0;
        margin-bottom: 1rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

    /* Container padding */
    .container-fluid.py-4 {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Buttons general */
    .btn {
        font-size: 0.875rem;
    }

    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Topbar */
    .navbar .container-fluid {
        padding: 0.5rem 0.75rem;
    }

    .navbar .dropdown .small {
        display: none;
    }

    /* Detail pages */
    .card-body .row .col-md-6,
    .card-body .row .col-md-4,
    .card-body .row .col-md-3 {
        margin-bottom: 0.5rem;
    }

    /* Form pages */
    .form-control,
    .form-select {
        font-size: 1rem;
    }

    /* Sidebar overlay */
    .sidebar-overlay.show {
        opacity: 0.5;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* Timeline */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 1rem;
    padding-left: 1rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.25rem;
    top: 0.35rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

/* Print button */
.btn-print {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}
