/* Global slight reduction for all screens to improve "neatness" */
:root {
    --bs-root-font-size: 15px;
}

body {
    --bs-body-font-size: 0.9rem;
}

/* --- MOBILE & TABLET OPTIMIZATION ( < 768px ) --- */
@media (max-width: 767.98px) {
    :root {
        --bs-root-font-size: 15.5px; /* Stay readable on mobile */
    }
    
    .card {
        --bs-card-spacer-y: 1rem;
        --bs-card-spacer-x: 1rem;
    }

    /* Ensure buttons are easy to tap on mobile */
    .btn {
        padding: 0.5rem 1rem;
    }
}

/* --- LAPTOP OPTIMIZATION ( 768px to 1600px ) --- */
@media (min-width: 768px) and (max-width: 1600px) {
    :root {
        --bs-root-font-size: 14.5px;
        --bs-gutter-x: 1rem;
    }

    .card {
        --bs-card-spacer-y: 1rem;
        --bs-card-spacer-x: 1rem;
        --bs-card-cap-padding-y: 0.875rem;
        --bs-card-cap-padding-x: 1rem;
    }

    /* Tighten Navbar */
    .layout-navbar {
        block-size: 3.5rem !important;
    }

    .layout-navbar.navbar-detached {
        inline-size: calc(100% - 1rem * 2) !important;
        margin-block: 0.5rem 0 !important;
        padding-inline: 1rem !important;
    }

    /* Tighten Tables */
    .table > :not(caption) > * > * {
        padding: 0.5rem 0.5rem !important;
    }

    /* Form elements */
    .form-control, .form-select {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }

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

    /* Headings for cleaner look */
    h1, .h1 { font-size: 1.8rem !important; }
    h2, .h2 { font-size: 1.6rem !important; }
    h3, .h3 { font-size: 1.4rem !important; }
    h4, .h4 { font-size: 1.2rem !important; }
}

/* --- SMALL LAPTOP / TABLET LANDSCAPE ( < 1400px ) --- */
@media (min-width: 768px) and (max-width: 1399.98px) {
    :root {
        --bs-root-font-size: 14px;
    }
}

/* --- SIDEBAR WIDTH ADJUSTMENT (Desktop) --- */
@media (min-width: 1200px) {
    .layout-menu-fixed:not(.layout-menu-collapsed) .layout-page,
    .layout-menu-fixed-offcanvas:not(.layout-menu-collapsed) .layout-page {
        padding-left: 240px; /* Reduced from default 260px if needed */
    }
    .layout-menu {
        width: 240px !important;
    }
}
