/* Layout: Ultra-Compact & Sleek */
:root {
    /* Global Reset */
    box-sizing: border-box;

    /* Light Mode Variables */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;

    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #334155;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);

    /* Ultra Compact Dimensions */
    --sidebar-width: 220px;
    --header-height: 50px;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    min-height: 100vh;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.4;
    overflow-x: hidden;
    /* Prevent page-wide horizontal scroll */
}

/* Typography */
h1,
.h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

h2,
.h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

h3,
.h3 {
    font-size: 1rem;
    font-weight: 600;
}

h4,
.h4 {
    font-size: 0.9rem;
    font-weight: 600;
}

h5,
.h5,
h6,
.h6 {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Force Title Case or Normal Case Globally */
.text-uppercase {
    text-transform: initial !important;
}

th {
    text-transform: none !important;
}

/* Utilities */
.glass-panel,
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    border-radius: 6px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.2s;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Forms - Micro Sizing */
.form-control,
.form-select,
.btn {
    font-size: 0.8rem;
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    max-width: 100%;
    /* Prevent overflow */
}

.form-label {
    margin-bottom: 0.15rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-weight: 500;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-lg {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
}

.btn-sm {
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
}

.btn-danger,
.btn-secondary,
.btn-warning,
.btn-success,
.btn-info {
    border: none;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    width: var(--sidebar-width);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    padding: 0.5rem;
}

.nav-item {
    padding: 0.35rem 0.6rem;
    margin-bottom: 1px;
    border-radius: 4px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.8rem;
}

.nav-item:hover,
.nav-item.active {
    background-color: #eff6ff;
    color: var(--primary-color);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1rem;
    background-color: var(--bg-body);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--border-color);
}

.page-title {
    margin: 0;
}

/* Cards & stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    padding: 0.75rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0.25rem 0;
    color: var(--text-main);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
}

/* Tables - Single Line & Sleek */
.table-container {
    overflow-x: auto;
    background: #fff;
    border-radius: 6px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

/* Ensure Action Buttons are visible */
.table .btn-outline-primary,
.table .btn-outline-secondary,
.table .btn-outline-danger,
.table .btn-outline-success {
    background-color: #f8fafc;
    /* Slight grey bg */
    border-width: 1px;
    font-weight: 500;
}

.table .btn-outline-primary:hover,
.table .btn-outline-secondary:hover {
    background-color: var(--primary-color);
    color: white;
}

.table .btn-outline-danger:hover {
    background-color: var(--danger-color);
    color: white;
}

.table .btn-outline-success:hover {
    background-color: var(--success-color);
    color: white;
}

.table {
    width: 100%;
    margin-bottom: 0;
    font-size: 0.8rem;
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    background-color: #f8fafc;
    white-space: nowrap;
}

.table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-main);
    white-space: nowrap;
    /* CRITICAL: No Wrap */
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.table tr:last-child td {
    border-bottom: none;
}

/* Badges - Tiny */
.badge {
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0;
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-warning {
    background: #fef3c7;
    color: #a16207;
}

.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-primary {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-secondary {
    background: #f1f5f9;
    color: #475569;
}

/* Modals */
.modal-content {
    border-radius: 6px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.modal-header,
.modal-footer {
    padding: 0.6rem 1rem;
}

.modal-body {
    padding: 1rem;
}

/* Specific Utilities */
.text-muted {
    color: #94a3b8 !important;
}

.small {
    font-size: 0.7rem;
}

.w-1 {
    width: 1%;
    white-space: nowrap;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #f8fafc;
}

.login-card {
    padding: 2rem;
    background: #fff;
    box-shadow: var(--shadow-md);
}

/* ============================
   MOBILE RESPONSIVENESS
   ============================ */
.mobile-menu-btn {
    display: none;
    /* Hidden on Desktop */
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-main);
}

@media (max-width: 768px) {

    /* Layout Adjustments */
    .mobile-menu-btn {
        display: block;
        /* Show on Mobile */
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1001;
        background: rgba(255, 255, 255, 0.8);
        border-radius: 4px;
        backdrop-filter: blur(4px);
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    }

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

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
        padding-top: 60px;
        /* Space for fixed toggle button */
    }

    /* Adjust page header layout */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-title {
        margin-left: 2.5rem;
        /* Space for the button */
    }

    /* Table horizontal scroll wrapper */
    .table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}