@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Brand Colors - Professional Slate & Blue */
    --primary-color: #2c3e50;
    --primary-dark: #1a252f;
    --accent-color: #3498db;
    --accent-hover: #2980b9;

    /* Functional Colors */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;

    /* Neutrals */
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    background-color: var(--bg-body);
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    margin: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ================== Sidebar ================== */
.sidebar {
    height: 100vh;
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: width 0.3s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 25px;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-menu {
    padding: 0.5rem 0.25rem;
    list-style: none;
    margin: 0;
}

.sidebar-menu li {
    margin-bottom: 2px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s ease;
    font-weight: 500;
    font-size: 0.85rem;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(4px);
}

.sidebar-menu a.active {
    background-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.sidebar-menu a i {
    margin-right: 8px;
    width: 18px;
    text-align: center;
    font-size: 0.95rem;
}

/* ================== Main Content ================== */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ================== Header ================== */
.top-header {
    height: var(--header-height);
    background-color: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.top-header h5 {
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

/* ================== Cards ================== */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1rem;
}

.card-body {
    padding: 1.5rem;
}

/* ================== Tables ================== */
.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: #f9fafb;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.table-hover tbody tr:hover {
    background-color: #f9fafb;
}

/* ================== Badges & Buttons ================== */
.badge {
    padding: 0.35em 0.8em;
    font-weight: 600;
    border-radius: 9999px;
    font-size: 0.75rem;
}

.status-pending {
    background-color: #fffbeb;
    color: #b45309;
    border: 1px solid #fcd34d;
}

.status-approved {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.status-rejected {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.btn {
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(52, 152, 219, 0.4);
}

/* ================== Login Page ================== */
.login-bg {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1a252f 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h3 {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.form-control {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
}

.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ================== Responsive Adjustments ================== */
@media (max-width: 991.98px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        left: -280px;
        width: 280px !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        height: 100% !important;
    }

    body.show-sidebar .sidebar {
        transform: translateX(280px);
    }

    .main-content {
        margin-left: 0 !important;
        padding: 1rem;
        width: 100%;
    }

    .top-header {
        padding: 0 15px;
        margin-bottom: 1.5rem;
    }

    .sidebar-overlay {
        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: 999;
    }

    body.show-sidebar .sidebar-overlay {
        display: block;
    }
}

/* ================== Responsive Tables ================== */
@media (max-width: 767.98px) {
    .table-responsive-stack thead {
        display: none;
    }

    .table-responsive-stack tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: white;
        padding: 0.5rem;
        box-shadow: var(--shadow-sm);
    }

    .table-responsive-stack td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 0.5rem !important;
        border-bottom: 1px solid #f3f4f6 !important;
    }

    .table-responsive-stack td:last-child {
        border-bottom: none !important;
    }

    .table-responsive-stack td::before {
        content: attr(data-label);
        font-weight: 700;
        text-transform: uppercase;
        font-size: 0.7rem;
        color: var(--text-muted);
        margin-right: 1rem;
        text-align: left;
    }
}

/* ================== Utilities ================== */
.print-card {
    page-break-inside: avoid;
}

/* Ensure images don't overflow */
img {
    max-width: 100%;
    height: auto;
}

@media print {

    .sidebar,
    .top-header .btn {
        display: none;
    }

    .main-content {
        margin: 0;
        padding: 0;
    }

    body {
        background: white;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .card {
        box-shadow: none;
        border: none;
        margin-bottom: 10px !important;
        page-break-inside: avoid;
    }

    .card-header {
        padding: 4px 8px !important;
        font-size: 12px !important;
    }

    /* Ultra-compact table for print - NUCLEAR OPTION */
    .pdf-mode .table td,
    .pdf-mode .table th {
        padding: 0 !important;
        /* Zero padding */
        font-size: 9px !important;
        line-height: 10px !important;
        /* Fixed line height matching font */
        height: 11px !important;
        /* Force row height */
        vertical-align: middle !important;
        border-top: 1px solid #000 !important;
        border-bottom: 1px solid #000 !important;
    }

    .pdf-mode .table tr {
        height: 11px !important;
    }

    /* Target ALL children to kill spacing */
    .pdf-mode .table td *,
    .pdf-mode .table th * {
        margin: 0 !important;
        padding: 0 !important;
        line-height: 10px !important;
        display: inline-block !important;
        /* Prevent block breaks adding height */
        vertical-align: middle !important;
    }

    .pdf-mode br {
        display: none !important;
        /* Kill line breaks if possible */
    }

    .pdf-mode .badge {
        border: 1px solid #000;
        color: #000;
        padding: 0 1px !important;
        font-size: 8px !important;
        line-height: 8px !important;
    }

    .table td,
    .table th {
        padding: 0 2px !important;
        /* Zero vertical padding */
        font-size: 10px !important;
        line-height: 1 !important;
        /* Tightest line height */
        height: auto !important;
        vertical-align: middle !important;
    }

    /* Remove all internal margins/padding from cell content */
    .table td *,
    .table th * {
        margin: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        line-height: 1 !important;
    }

    /* Adjust Badge */
    .badge {
        border: 1px solid #000 !important;
        color: #000 !important;
        background: transparent !important;
        padding: 0 2px !important;
        font-size: 9px !important;
        display: inline-block !important;
    }

    /* Ensure icon spacing is tiny but exists */
    .bi {
        margin-right: 2px !important;
    }
}

/* Compact Table Utility */
.table-compact td,
.table-compact th {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}