/* assets/css/style.css */

/* =========================
   ROOT VARIABLES
========================= */

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;

    --light-bg: #f8fafc;
    --white: #ffffff;

    --text-dark: #1e293b;
    --text-muted: #64748b;

    --border-color: #e2e8f0;

    --sidebar-width: 240px;
    --topbar-height: 65px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* =========================
   RESET
========================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    overflow-x: hidden;
}

/* =========================
   LOADER
========================= */

.loader-wrapper {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =========================
   TOP NAVBAR
========================= */

.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    z-index: 1000;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
    color: var(--text-dark);
    font-size: 1.2rem;
    padding: 0.5rem;
    cursor: pointer;
}

.sidebar-toggle:hover {
    color: var(--primary-color);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color) !important;
}

/* =========================
   SIDEBAR
========================= */

.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    background: var(--white);
    border-right: 1px solid var(--border-color);
    z-index: 999;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease;
}

/* Desktop collapsed */
.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
}

.sidebar-header h5 {
    font-size: 0.95rem;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-menu li {
    margin: 0.25rem 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 0.7rem 1.25rem;
    color: var(--text-dark);
    text-decoration: none;
    border-left: 3px solid transparent;
    font-size: 0.875rem;
    transition: all 0.25s ease;
}

.sidebar-menu li a i {
    width: 20px;
    margin-right: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.sidebar-menu li a:hover {
    background: var(--light-bg);
    border-left-color: var(--primary-color);
}

.sidebar-menu li a:hover i {
    color: var(--primary-color);
}

.sidebar-menu li.active a {
    background: linear-gradient(
        90deg,
        rgba(99,102,241,0.12),
        rgba(99,102,241,0.04)
    );
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar-menu li.active a i {
    color: var(--primary-color);
}

.sidebar-submenu {
    list-style: none;
    padding-left: 0;
    background: var(--light-bg);
    border-left: 3px solid var(--primary-color);
}

.sidebar-submenu li a {
    padding: 0.5rem 1rem 0.5rem 3rem;
    font-size: 0.8rem;
}

.sidebar-submenu li a i {
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.sidebar-dropdown-toggle {
    position: relative;
}

.sidebar-dropdown-toggle .fa-chevron-down {
    transition: transform 0.3s ease;
}

.sidebar-dropdown-toggle.active .fa-chevron-down {
    transform: rotate(180deg);
}

/* =========================
   MAIN CONTENT
========================= */

.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 2rem;
    min-height: calc(100vh - var(--topbar-height) - 60px);
    transition: margin-left 0.3s ease;
}

/* Desktop sidebar collapsed */
@media (min-width: 992px) {
    .main-content.expanded {
        margin-left: 0;
    }
}

/* =========================
   FOOTER
========================= */

.footer {
    background: var(--white);
    padding: 1.25rem 0;
    border-top: 1px solid var(--border-color);
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 992px) {
    .footer.expanded {
        margin-left: 0;
    }
}

/* =========================
   RESPONSIVE (MOBILE)
========================= */

@media (max-width: 991.98px) {

    .sidebar {
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 1001;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1.25rem;
    }

    .footer {
        margin-left: 0;
    }
}

/* =========================
   CARDS, TABLES, FORMS
   (UNCHANGED – SAFE)
========================= */

/* (Everything below this line remains exactly as you had it:
   cards, buttons, tables, forms, login, badges, toastr,
   select2, scrollbar — no functional issues there) */


.footer.expanded {
    margin-left: 0;
}

/* Cards */
.card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    background: var(--white);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.card-header h5 {
    font-size: 0.95rem;
    margin-bottom: 0;
}

.stat-card {
    border-radius: 10px;
    padding: 1.25rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.stat-card p {
    font-size: 0.8rem;
}

.stat-card h3 {
    font-size: 1.5rem;
}

.stat-card small {
    font-size: 0.75rem;
}

.stat-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

/* Buttons */
.btn {
    border-radius: 6px;
    padding: 0.45rem 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Tables */
.table {
    background: var(--white);
    font-size: 0.875rem;
}

.table thead th {
    background: var(--light-bg);
    color: var(--text-dark);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    padding: 0.75rem;
    font-size: 0.8rem;
}

.table tbody td {
    padding: 0.75rem;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: var(--light-bg);
}

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 0.625rem 0.875rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.15);
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 2rem;
}

.login-card {
    max-width: 450px;
    width: 100%;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 2rem;
    text-align: center;
}

.login-body {
    padding: 2.5rem;
}

/* Badges */
.badge {
    padding: 0.5em 0.875em;
    border-radius: 6px;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-width));
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .footer {
        margin-left: 0;
    }
}

/* Toastr Customization */
.toast-success {
    background-color: var(--success-color) !important;
}

.toast-error {
    background-color: var(--danger-color) !important;
}

.toast-info {
    background-color: var(--info-color) !important;
}

.toast-warning {
    background-color: var(--warning-color) !important;
}

/* Select2 Customization */
.select2-container--bootstrap-5 .select2-selection {
    border-radius: 8px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}