/* =============================================================
   FINAL RESPONSIVE SIDEBAR FIX
   ============================================================= */
#wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    align-items: stretch;
}

#sidebar {
    min-width: 250px;
    max-width: 250px;
    background: #4e73df;
    color: #fff;
    transition: all 0.3s;
    overflow-y: auto;
    /* //height: 100vh; */
    position: sticky;
    top: 0;
    z-index: 1051; /* High z-index to stay above content  */
	/* background-image: linear-gradient(180deg, #4e73df 10%, #224abe 100%);*/
}

#content {
    flex-grow: 1;
    width: 100%;
    background-color: #f8f9fc;
    display: flex;
    flex-direction: column;
}

/* MOBILE SETTINGS (iPad and Phones) */
@media (max-width: 992px) {
    #sidebar {
        position: fixed;
        left: -250px; /* Hide completely off-screen */
        transition: left 0.3s ease;
    }

    /* THE MAGIC CLASS: This must be applied to #sidebar via JS */
    #sidebar.active {
        left: 0 !important; /* Force show */
    }

    /* Dark overlay when menu is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1050; /* Just below the sidebar */
        top: 0;
        left: 0;
    }

    .sidebar-overlay.active {
        display: block;
    }
}
/* ==========================================================================
   1. GLOBAL RESET & BASE LAYOUT
   ========================================================================== */
:root {
    --sidebar-width: 250px;
    --primary-color: #4e73df;
    --bg-light: #f8f9fc;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-light);
    overflow-x: hidden; /* Prevent horizontal scroll on whole body */
}

/* Wrapper to hold Sidebar + Content */
#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}


/* ==========================================================================
   MAIN CONTENT & TABLE RESPONSIVENESS
   ========================================================================== */
#content {
    flex: 1; /* Take up remaining space */
    width: 100%;
    max-width: 100vw; /* Strict limit */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* Prevent page-wide horizontal scroll */
}

/* Common Container for all panels */
.container-fluid {
    padding: 1.5rem;
    width: 100%;
}

/* FORCED TABLE RESPONSIVENESS */
/* Wrap every table in this class in your PHP/HTML */
.table-responsive {
    width: 100% !important;
    margin-bottom: 1rem;
    overflow-x: auto; /* Internal scroll ONLY */
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

/* Ensure DataTables don't force width */
table.dataTable, .dataTables_wrapper {
    width: 100% !important;
    margin: 0 auto !important;
}

/* Form Grid Fixes for Mobile Rotate/iPad */
@media (max-width: 768px) {
    .container-fluid {
        padding: 10px;
    }
    
    /* Force buttons to stack on small screens */
    .btn-group-mobile {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-group-mobile .btn {
        width: 100%;
    }
}

/* ==========================================================================
   4. RESPONSIVE BREAKPOINTS (Tablet/Mobile)
   ========================================================================== */

@media (max-width: 992px) {
    /* SIDEBAR: Move off-screen by default on mobile */
    #sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
        position: fixed;
        height: 100%;
    }

    /* When Sidebar is Active (Toggled) */
    #sidebar.active {
        margin-left: 0;
    }

    /* HAMBURGER: Ensure it stays at the top-left */
    #sidebarCollapse {
        display: block !important;
        margin-right: 15px;
    }

    /* MAIN CONTENT: Ensure full width */
    #content {
        min-width: 100vw;
    }
}

/* ==========================================================================
   5. COMPONENT RESPONSIVENESS (Tables, Cards, Forms)
   ========================================================================== */

/* Fix Tables Blowout */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto; /* Forces internal scroll */
    -webkit-overflow-scrolling: touch;
    border: none;
}

/* Ensure DataTables handle width correctly */
.dataTables_wrapper, table.dataTable {
    width: 100% !important;
    margin: 0 !important;
}

/* Form Responsiveness: Stack inputs on mobile */
@media (max-width: 576px) {
    .row > [class*='col-'] {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem 0.75rem;
    }
    
    .btn-lg {
        width: 100%; /* Full width buttons on phone */
    }

    /* Tab navigation scrolling on mobile */
    .nav-tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 5px;
    }
    .nav-tabs .nav-link {
        white-space: nowrap;
    }
}

/* ==========================================================================
   6. LOGIN PAGE MODULE (Centering Fix)
   ========================================================================== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 15px;
    background: #4e73df;
}

.login-card {
    width: 100%;
    max-width: 400px;
    border: none;
    border-radius: 10px;
    box-shadow: 0 1rem 3rem rgba(0,0,0,.175);
}

.login-card .card-body {
    padding: 2.5rem;
}



/********************************************************************/
/**********************Custom CSS Fixed******************************/
/********************************************************************/
.min-vw-0{
	min-width: unset !important;
}

@media (min-width: 576px) {
	.table-responsive{
		display: inline-table !important;
	}
}

#bdayBadge {
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(220, 53, 69, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

#birthdayForceModal .modal-content {
    border-radius: 30px;
}

#birthdayForceModal h2 {
    font-family: 'Pacifico', cursive, sans-serif;
}

/* Background Dimmer Customization */
.modal-backdrop.show {
    opacity: 0.8;
    background-color: #2c3e50;
}

/* Prevent image stretching */
.custom-slider-img {
	height: 400px; /* Default height for Desktop */
	width: 100%;
	object-fit: cover; /* This is the magic line that prevents stretching */
	object-position: center;
}

/* Gradient overlay for text readability */
.carousel-caption-custom {
	background: rgba(0,0,0,0.5);
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	padding: 15px 0px 15px 0px !important;
	text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.custom-slider-img {
		height: 250px; /* Smaller height for Tablets */
	}
	.carousel-caption-custom h5 {
		font-size: 1.1rem;
	}
}

@media (max-width: 480px) {
	.custom-slider-img {
		height: 200px;
		object-fit: unset;
	}
	.carousel-caption-custom h5 {
	    font-size: 12px;
        font-weight: normal;
	}
	.carousel-caption-custom {
		padding: 5px 0px 5px 0px !important;
	}
}