/* =======================================================
   GLOBAL RESPONSIVE SETTINGS (For 1280x720 & All Screens)
   ======================================================= */

/* 1. Page Scroll Control */
body {
    overflow-x: hidden; /* Prevent horizontal scroll */
}

.content-wrapper {
    min-height: 100vh;
    padding: 10px 15px;
}

/* 2. THE MAGIC CLASS (Apply this to any box/div that needs to scroll internally) */
.auto-fit-box {
    background-color: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    
    /* --- FORMULA --- */
    /* Screen Height (100vh) - Header/Footer space (approx 200px) */
    /* This automatically takes up the remaining space */
    height: calc(100vh - 200px);
    
    overflow-y: auto; /* Scrollbar will only appear inside the box */
    
    /* Safety: Ensure it's not too small on mobile */
    min-height: 300px; 
}

/* 3. Small Screen / Laptop Optimizations (When height is less than 800px) */
@media (max-height: 800px) {
    /* Reduce global font size */
    body { font-size: 0.9rem; }
    
    .content-wrapper { padding-top: 5px !important; }
    
    /* Reduce heading sizes */
    h1, h2, h3, h4 { 
        font-size: 1.2rem !important; 
        margin-bottom: 0.5rem !important; 
    }
    
    /* Tighten cards and gaps */
    .card { margin-bottom: 10px !important; }
    .card-body { padding: 0.8rem !important; }
    .mb-3 { margin-bottom: 0.5rem !important; }
    
    /* Adjust buttons */
    .btn { padding: 0.25rem 0.5rem; font-size: 0.875rem; }

    /* Adjust box height (Since header became smaller) */
    .auto-fit-box {
        height: calc(100vh - 150px); 
        padding: 10px;
    }
}