/* Google Fonts & FontAwesome Imports (Must be at the top) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css');

:root {
    --primary-soft: #4f46e5;
    --secondary-soft: #6366f1;
    --bg-main: #f8fafc;
    --sidebar-dark: #1e293b;
    --card-radius: 12px;
    --btn-radius: 10px;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-main) !important;
    color: #1e293b;
}

/* 
 * FORCE FontAwesome for all icon classes. 
 * Removing 'important' from the body font-family above is KEY 
 * to allow icons to use their own fonts.
 */
.fas,
.far,
.fal,
.fab,
.fa,
.nav-icon,
.nav-link i,
[class^="fa-"],
[class*=" fa-"] {
    font-family: "Font Awesome 5 Free" !important;
    font-weight: 900 !important;
    display: inline-block !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    -webkit-font-smoothing: antialiased !important;
}

.far {
    font-weight: 400 !important;
}

.fab {
    font-family: "Font Awesome 5 Brands" !important;
}

/* Card Styling */
.card {
    border: none !important;
    border-radius: var(--card-radius) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
}

.card-header {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(0, 0, 0, .05) !important;
    padding: 1.25rem 1.5rem !important;
}

.card-title {
    font-weight: 600 !important;
    font-size: 1.1rem !important;
    color: #334155 !important;
}

/* Sidebar Customization */
/* Sidebar Customization */
.main-sidebar {
    background-color: #ffffff !important;
    /* White sidebar */
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.05) !important;
}

.nav-sidebar .nav-link {
    border-radius: 8px !important;
    margin-bottom: 4px !important;
    padding: 0.75rem 1rem !important;
    transition: all 0.3s;
    color: #475569 !important;
    /* Slate color for text on white */
}

.nav-sidebar .nav-link:hover {
    background-color: #f1f5f9 !important;
    color: #4f46e5 !important;
}

.nav-sidebar .nav-link p {
    font-weight: 500 !important;
}

/* Spacing between Logo and First Menu Item */
.brand-link {
    margin-bottom: 1rem !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

/* Active item indicator for light theme */
.nav-sidebar .nav-link.active {
    background-color: rgba(79, 70, 229, 0.1) !important;
    color: #4f46e5 !important;
    border-right: 4px solid #4f46e5 !important;
    box-shadow: none !important;
}

/* Button Refinement */
.btn {
    border-radius: var(--btn-radius) !important;
    font-weight: 500 !important;
    padding: 0.5rem 1.25rem !important;
    text-transform: none !important;
    letter-spacing: 0.3px;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #4f46e5 !important;
    border-color: #4f46e5 !important;
}

.btn-primary:hover {
    background-color: #4338ca !important;
    transform: translateY(-1px);
}

.btn-success {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
}

.btn-info {
    background-color: #0ea5e9 !important;
    border-color: #0ea5e9 !important;
}

/* Forms Styling */
.form-control,
.custom-select {
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    padding: 0.6rem 1rem !important;
    height: auto !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2) !important;
}

/* Badge Styling */
.badge {
    padding: 0.5em 0.8em !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
}

/* Table Refinement */
.table thead th {
    border-top: none !important;
    background-color: #f1f5f9 !important;
    color: #64748b !important;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem !important;
}

.table td {
    vertical-align: middle !important;
    padding: 1rem !important;
    border-color: #f1f5f9 !important;
}

/* Animations */
.animation__shake {
    animation: none !important;
    /* Disable shake for cleaner feel */
}

/* Sidebar Toggle Icon Refinement */
[data-widget="pushmenu"] i::before {
    content: "\f03b" !important;
    /* fa-align-left */
    transition: all 0.3s ease;
}

.sidebar-collapse [data-widget="pushmenu"] i::before {
    content: "\f0c9" !important;
    /* fa-bars back as fallback or fa-indent */
}

/* Menu Headers with Icons */
/* Menu Headers with Icons */
/* Menu Headers with Icons */
.nav-header {
    background-color: transparent !important;
    color: #64748b !important;
    /* Darker slate for light theme */
    padding: 1.5rem 1rem 0.5rem !important;
    font-size: 0.75rem !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700 !important;
}

/* Sidebar Link Text Refinement to avoid 2 lines */
.nav-sidebar .nav-link p {
    font-size: 0.85rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-weight: 500 !important;
    letter-spacing: -0.01em;
}

/* Sidebar width adjustment to give more space, only when NOT collapsed */
@media (min-width: 992px) {

    body:not(.sidebar-collapse) .main-sidebar,
    body:not(.sidebar-collapse) .main-sidebar::before {
        width: 280px !important;
    }

    body:not(.sidebar-collapse) .content-wrapper,
    body:not(.sidebar-collapse) .main-footer,
    body:not(.sidebar-collapse) .main-header {
        margin-left: 280px !important;
    }
}

/* Fix for collapsed sidebar backgrounds and Z-Index persistence */
.main-sidebar {
    z-index: 1040 !important;
}

.sidebar-collapse .main-sidebar,
.sidebar-collapse .main-sidebar::before {
    width: 4.6rem !important;
    transition: width 0.3s ease-in-out;
}

/* Allow expansion on hover when collapsed (sidebar-mini) */
.sidebar-mini.sidebar-collapse .main-sidebar:hover,
.sidebar-mini.sidebar-collapse .main-sidebar:hover::before {
    width: 280px !important;
    box-shadow: 8px 0 25px rgba(0, 0, 0, 0.2) !important;
}

/* Ensure labels and brand text become visible on hover when collapsed */
.sidebar-mini.sidebar-collapse .main-sidebar:hover .brand-text,
.sidebar-mini.sidebar-collapse .main-sidebar:hover .nav-sidebar .nav-link p,
.sidebar-mini.sidebar-collapse .main-sidebar:hover .nav-header {
    opacity: 1 !important;
    display: inline-block !important;
    visibility: visible !important;
    width: auto !important;
}

/* Hide header text when collapsed and NOT hovered for a cleaner look */
.sidebar-collapse .main-sidebar:not(:hover) .nav-header {
    font-size: 0 !important;
    padding: 1rem 0 !important;
    text-align: center;
}

.sidebar-collapse .main-sidebar:not(:hover) .nav-header i,
.sidebar-collapse .main-sidebar:not(:hover) .nav-header span {
    font-size: 1.1rem !important;
}

.sidebar-collapse .content-wrapper,
.sidebar-collapse .main-footer,
.sidebar-collapse .main-header {
    margin-left: 4.6rem !important;
}

/* Active item indicator */
.nav-sidebar .nav-link.active {
    background-color: rgba(79, 70, 229, 0.15) !important;
    color: #818cf8 !important;
    border-right: 3px solid #6366f1 !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Logo Styling Improvements */
.brand-link {
    height: auto !important;
    min-height: 75px !important;
    padding: 1rem 0.5rem !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    background-color: transparent !important;
    /* Transparent to match white sidebar */
    border-bottom: 1px solid #f1f5f9 !important;
    margin-bottom: 1.5rem !important;
    /* Increased margin to prevent overlap */
    position: relative !important;
    z-index: 10 !important;
}

/* Ensure sidebar content starts after the logo */
.sidebar {
    padding-top: 0 !important;
}

.brand-image-custom,
.custom-logo-xl {
    max-height: 60px !important;
    max-width: 85% !important;
    width: auto !important;
    margin: auto !important;
    display: block !important;
    object-fit: contain !important;
    transition: all 0.3s ease-in-out;
}

/* Collapsed Sidebar Adjustments */
.sidebar-collapse .brand-link {
    min-height: 4.6rem !important;
    padding: 0.5rem !important;
}

/* ==========================================================================
   Modern Split-Screen Login
   ========================================================================== */

.login-page {
    background: #ffffff !important;
    height: 100vh !important;
    display: flex !important;
    padding: 0 !important;
    margin: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}

.auth-container {
    display: flex;
    width: 100%;
    height: 100vh;
}

.auth-form-side {
    flex: 0 0 450px;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.02);
    z-index: 2;
}

.auth-image-side {
    flex: 1;
    height: 100%;
    background-image: url('../img/login-bg.png');
    background-size: cover;
    background-position: center;
    position: relative;
}

.auth-image-side::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.2) 0%, rgba(30, 41, 59, 0.4) 100%);
}

.auth-logo-container {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-logo-container img {
    max-width: 280px;
    height: auto;
}

.auth-card-body {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sidebar-dark);
    margin-bottom: 0.5rem;
    text-align: left;
}

.auth-subtitle {
    font-size: 0.95rem;
    color: #64748b;
    margin-bottom: 2rem;
    text-align: left;
}

/* Override AdminLTE default login styles */
.login-box {
    width: 100% !important;
    margin: 0 !important;
}

.login-box .card {
    box-shadow: none !important;
    background: transparent !important;
    margin: 0 !important;
}

.login-box .card-body {
    padding: 0 !important;
}

/* Modern Input Groups */
.input-group-modern {
    margin-bottom: 1.5rem;
}

.input-group-modern label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
}

.input-group-modern .input-group-text {
    background-color: #f8fafc !important;
    border-right: none !important;
    color: #94a3b8 !important;
    border-radius: 10px 0 0 10px !important;
}

.input-group-modern .form-control {
    border-left: none !important;
    border-radius: 0 10px 10px 0 !important;
    background-color: #f8fafc !important;
    font-size: 0.95rem;
}

.auth-btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%) !important;
    border: none !important;
    padding: 0.8rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3) !important;
    margin-top: 1rem;
}

.auth-btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 15px rgba(79, 70, 229, 0.4) !important;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .auth-image-side {
        display: none;
    }

    .auth-form-side {
        flex: 1;
        padding: 2rem;
    }
}