/* public/css/style.css */

/* --- Global & Typography --- */
body {
    font-family: 'Cairo', sans-serif;
    background-color: #f8f9fa;
    font-size: 16px;
    line-height: 1.6;
    color: #495057;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: #343a40;
}

a {
    color: #0d6efd;
    text-decoration: none;
}

a:hover {
    color: #0a58ca;
}

/* --- Main Layout Structure --- */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    position: relative; /* Needed for the mobile overlay */
}

/* --- Sidebar Styling --- */
.sidebar {
    width: 260px;
    min-width: 260px; /* Prevent it from shrinking */
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1000; /* High z-index to be on top of the overlay */
    background: #2c3e50;
    color: #ecf0f1;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    transition: margin-right 0.35s ease-in-out; /* Smooth transition */
}

.main {
    flex-grow: 1;
    margin-right: 260px; /* Default margin to make space for the sidebar */
    transition: margin-right 0.35s ease-in-out; /* Smooth transition */
}

/* --- THE CORE TOGGLE LOGIC (Desktop) --- */
/* When the wrapper has the 'toggled' class... */
.wrapper.sidebar-toggled .sidebar {
    margin-right: -260px; /* ...slide the sidebar completely off-screen. */
}
.wrapper.sidebar-toggled .main {
    margin-right: 0; /* ...remove the margin from the main content so it fills the screen. */
}

.sidebar-brand {
    padding: 1.15rem 1.5rem;
    font-size: 1.25rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-brand a {
    color: #fff;
}

.sidebar-nav {
    padding: 0;
    list-style: none;
}

.sidebar-header {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.8rem;
    color: #95a5a6;
}

.sidebar-link {
    display: block;
    padding: 0.9rem 1.5rem;
    color: #ecf0f1;
    transition: background 0.2s ease;
    border-right: 3px solid transparent;
}

.sidebar-link:hover {
    background: #34495e;
    color: #fff;
}

.sidebar-item.active > .sidebar-link {
    background: #34495e;
    color: #fff;
    border-right-color: #3498db;
}

/* --- Navbar --- */
.navbar-bg {
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,.075);
    z-index: 50;
    position: sticky;
    top: 0;
}

.sidebar-toggle {
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0 1rem;
    color: #343a40;
}

.navbar-align {
    margin-right: auto;
}

/* --- Component & Auth Styles --- */
.card {
    border: none;
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #f0f0f0;
}

.auth-wrapper {
    background: #f0f2f5;
}

.card.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0,0,0,.175)!important;
}

.card.border-start-primary { border-left-width: 0 !important; border-right: 0.25rem solid #4e73df !important; }
.card.border-start-success { border-left-width: 0 !important; border-right: 0.25rem solid #1cc88a !important; }
.card.border-start-info   { border-left-width: 0 !important; border-right: 0.25rem solid #36b9cc !important; }
.card.border-start-danger  { border-left-width: 0 !important; border-right: 0.25rem solid #e74a3b !important; }


/* --- NEW: Overlay for Mobile Sidebar --- */
.wrapper::after {
    content: '';
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0); /* Start transparent */
    z-index: 999; /* Below sidebar, above content */
    visibility: hidden; /* Hidden by default */
    transition: background 0.35s ease-in-out, visibility 0.35s;
}

/* --- RESPONSIVE OVERRIDES --- */
/* For screens smaller than 992px (tablets and phones) */
@media (max-width: 991.98px) {
    /* On mobile, the sidebar is hidden by default */
    .sidebar {
        margin-right: -260px;
    }
    .main {
        margin-right: 0;
        width: 100%; /* Ensure main content takes full width */
    }

    /* When toggled ON MOBILE, slide the sidebar in */
    .wrapper.sidebar-toggled .sidebar {
        margin-right: 0;
    }
    
    /* NEW: When toggled ON MOBILE, show the overlay */
    .wrapper.sidebar-toggled::after {
        background: rgba(0, 0, 0, 0.4); /* semi-transparent black */
        visibility: visible; /* Make it visible and clickable */
    }
}