/* 
 * Modern UI Enhancement System
 * Preserves layout while modernizing elements
 */

:root {
    --modern-primary: #4e73df;
    --modern-info: #36b9cc;
    --modern-success: #1cc88a;
    --modern-warning: #f6c23e;
    --modern-danger: #e74a3b;
    --modern-secondary: #858796;
    --modern-bg-light: #f8f9fc;
    --modern-card-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
    --modern-radius: 1rem;
    --modern-radius-sm: 0.5rem;
    --modern-font: 'Inter', 'Noto Sans', sans-serif;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
}

body {
    font-family: var(--modern-font);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: #4e73df;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--modern-radius);
    box-shadow: var(--modern-card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 2rem 0 rgba(58, 59, 69, 0.15);
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    font-weight: 600;
    padding: 0.6rem 1.25rem;
    transition: all 0.2s ease-in-out;
}

.btn-primary { background-color: var(--modern-primary); border-color: var(--modern-primary); }
.btn-info { background-color: var(--modern-info); border-color: var(--modern-info); }
.btn-success { background-color: var(--modern-success); border-color: var(--modern-success); }

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 11px rgba(0, 0, 0, 0.1);
}

/* Forms */
.form-control, .form-select {
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d3e2;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #bac8f3;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #4e73df;
}

/* Tables */
.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(78, 115, 223, 0.05) !important;
}

.table tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
}

.table tbody td:first-child { border-top-left-radius: var(--modern-radius-sm); border-bottom-left-radius: var(--modern-radius-sm); }
.table tbody td:last-child { border-top-right-radius: var(--modern-radius-sm); border-bottom-right-radius: var(--modern-radius-sm); }

/* Sidebar Modernization */
.auth-sidebar {
    background: #ffffff !important;
    box-shadow: 4px 0 15px rgba(0,0,0,0.03);
}

.auth-sidebar .nav-link {
    border-radius: 0.5rem;
    margin: 0.25rem 0;
    padding: 0.75rem 1rem;
    font-weight: 500;
    color: #5a5c69;
    transition: all 0.2s;
}

/* Header Aesthetics - Modern Full-Width Top Header */
.top-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 80px !important;
    z-index: 1060 !important; /* Above sidebar */
    background: #ffffff !important;
    border-bottom: 1px solid rgba(0,0,0,0.08) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02) !important;
}

.top-header .navbar {
    height: 80px !important;
    padding: 0 1.5rem !important;
    display: flex !important;
    align-items: center !important;
    left: 0 !important; /* Override toggled left values */
    right: 0 !important;
    width: 100% !important;
    background: #ffffff !important;
}

/* Wide Logo inside the Top Header */
.header-logo-wrapper {
    display: flex !important;
    align-items: center !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-right: 20px !important;
    border-right: 1px solid rgba(0,0,0,0.08) !important;
    margin-right: 15px !important;
    height: 80px !important; /* Spans full height of header */
}

.header-logo-img {
    height: 70px !important; /* Min 55px (70px for high prominence) */
    width: auto !important;
    max-width: 350px !important;
    object-fit: contain !important;
    transition: all 0.3s ease;
}

.header-logo-img:hover {
    transform: scale(1.02);
}

/* Hamburger toggle position directly after logo */
.top-header .btn-toggle {
    margin-left: 0 !important;
}

/* Sidebar Wrapper starting below the Top Header */
.sidebar-wrapper, .auth-sidebar {
    border-right: 1px solid rgba(0,0,0,0.05) !important;
    box-shadow: 4px 0 20px rgba(0,0,0,0.02) !important;
    background: #ffffff !important;
    position: fixed !important;
    z-index: 1050 !important; /* Below top-header */
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.sidebar-header, .auth-sidebar .sidebar-header {
    flex: 0 0 auto !important;
    background: #ffffff !important;
    padding: 1.5rem !important;
    border-bottom: 1px solid rgba(0,0,0,0.04) !important;
}

.sidebar-nav, .auth-sidebar .sidebar-nav {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: 2rem !important;
    display: block !important;
    -webkit-overflow-scrolling: touch;
}



/* Custom Scrollbar for Sidebar - more visible */
.sidebar-wrapper::-webkit-scrollbar {
    width: 8px;
}

.sidebar-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-wrapper::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 10px;
}

.sidebar-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.25);
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.2);
}

.sidebar-nav .metismenu a, .auth-sidebar .sidebar-nav .metismenu a {
    border-radius: 12px !important;
    margin: 0.15rem 0.85rem !important;
    padding: 0.5rem 1rem !important;
    font-weight: 500 !important;
    font-size: 0.925rem !important;
    color: #5a5c69 !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    text-decoration: none !important;
    white-space: normal !important;
    overflow: visible !important;
    height: auto !important;
}

.sidebar-nav .metismenu a .menu-title, .auth-sidebar .sidebar-nav .metismenu a .menu-title {
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.4 !important;
    flex: 1;
}

.sidebar-nav .metismenu a:hover, .auth-sidebar .sidebar-nav .metismenu a:hover {
    background-color: rgba(30, 144, 255, 0.08) !important; /* Premium matching theme background */
    color: rgb(30, 144, 255) !important;
    transform: translateX(4px) scale(1.01) !important;
}

.sidebar-nav .metismenu li.mm-active > a, .auth-sidebar .sidebar-nav .metismenu li.mm-active > a {
    background: linear-gradient(135deg, rgb(8, 47, 85) 0%, rgb(30, 144, 255) 70%, rgb(0, 191, 255) 100%) !important; /* AISEE deep blue gradient */
    color: #fff !important;
    box-shadow: 0 4px 15px rgba(30, 144, 255, 0.3) !important;
}

.sidebar-nav .metismenu a .parent-icon, .auth-sidebar .sidebar-nav .metismenu a .parent-icon {
    font-size: 1.25rem !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0 !important;
    transition: all 0.25s ease;
}

/* Page Layout Wrapper - Ensure spacing under top header */
.main-wrapper {
    margin-top: 80px !important;
    padding: 24px !important;
    min-height: calc(100vh - 80px) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow-x: hidden !important;
}

.main-wrapper > .main-content {
    min-height: auto !important;
    height: 100% !important;
}

/* Desktop layout styling and spacing adjustment (min-width: 1199px) */
@media screen and (min-width: 1199px) {
    .sidebar-wrapper, .auth-sidebar {
        top: 80px !important; /* Positioned directly below top-header */
        bottom: 0 !important;
        left: 0 !important;
        width: 260px !important;
        height: calc(100vh - 80px) !important;
    }
    
    .sidebar-wrapper .sidebar-header, 
    .auth-sidebar .sidebar-header {
        display: none !important; /* Hide redundant sidebar header */
    }
    
    .sidebar-wrapper .sidebar-nav, 
    .auth-sidebar .sidebar-nav {
        margin-top: 20px !important;
    }
    
    body.toggled .main-wrapper {
        margin-left: 70px !important;
    }
    
    body:not(.toggled) .main-wrapper {
        margin-left: 260px !important;
    }
    
    body.toggled .sidebar-wrapper {
        width: 70px !important;
    }
    
    body:not(.toggled) .sidebar-wrapper {
        width: 260px !important;
    }
}

/* Mobile responsive layout fixes (max-width: 1198px) */
@media screen and (max-width: 1198px) {
    .sidebar-wrapper, .auth-sidebar {
        top: 0 !important; /* Slide out full height on mobile/tablet */
        left: -260px !important; /* Hide off-screen by default */
        height: 100vh !important;
        z-index: 1070 !important; /* Above top-header */
        width: 260px !important;
    }
    
    body.toggled .sidebar-wrapper,
    body.toggled .auth-sidebar {
        left: 0 !important; /* Slide in when toggled */
    }
    
    .sidebar-wrapper .sidebar-header, 
    .auth-sidebar .sidebar-header {
        display: flex !important; /* Show header on mobile for closing button */
        position: relative;
    }

    .sidebar-wrapper .sidebar-close, 
    .auth-sidebar .sidebar-close,
    .toggle-icon {
        position: absolute !important;
        right: 15px !important;
        top: 25px !important;
        cursor: pointer;
    }
    
    .sidebar-wrapper .sidebar-nav, 
    .auth-sidebar .sidebar-nav {
        margin-top: 20px !important; 
    }
    
    .main-wrapper {
        margin-left: 0 !important;
        margin-top: 80px !important;
    }
    
    .top-header .navbar {
        justify-content: space-between !important;
    }
    
    .top-header .btn-toggle {
        margin-left: auto !important;
    }

    .header-logo-img {
        height: 45px !important;
        max-width: 200px !important;
    }
    
    .header-logo-wrapper {
        padding-right: 0 !important;
        margin-right: 0 !important;
        border-right: none !important;
    }
}

/* Sidebar Toggle Transitions - Desktop Only */
@media screen and (min-width: 1199px) {
    body.toggled .sidebar-wrapper, 
    body.toggled .auth-sidebar {
        width: 70px !important;
    }

    body.toggled .sidebar-wrapper .sidebar-text, 
    body.toggled .sidebar-wrapper .menu-title,
    body.toggled .sidebar-wrapper .menu-label,
    body.toggled .auth-sidebar .sidebar-text, 
    body.toggled .auth-sidebar .menu-title,
    body.toggled .auth-sidebar .menu-label {
        display: none !important;
    }

    body.toggled .sidebar-wrapper .sidebar-header, 
    body.toggled .auth-sidebar .sidebar-header {
        justify-content: center !important;
        padding: 1.5rem 0.5rem !important;
    }

    body.toggled .sidebar-wrapper .logo-wrapper, 
    body.toggled .auth-sidebar .logo-wrapper {
        padding-right: 0 !important;
        display: flex !important;
        justify-content: center !important;
    }

    body.toggled .sidebar-wrapper .logo-img, 
    body.toggled .auth-sidebar .logo-img {
        display: none !important;
    }

    body.toggled .sidebar-wrapper .logo-name, 
    body.toggled .auth-sidebar .logo-name {
        display: none !important;
    }

    body.toggled .sidebar-nav .metismenu a, 
    body.toggled .auth-sidebar .sidebar-nav .metismenu a {
        justify-content: center !important;
        padding: 0.7rem !important;
        margin: 0.35rem 0.85rem !important;
        gap: 0 !important;
        border-radius: 10px !important;
    }

    body.toggled .sidebar-nav .metismenu a .parent-icon, 
    body.toggled .auth-sidebar .sidebar-nav .metismenu a .parent-icon {
        margin-right: 0 !important;
    }
}

/* Login/Register Split Screen Extensions */
.auth-split-wrapper {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

.auth-split-form {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: #fff;
    overflow-y: auto;
}

.auth-split-visual {
    flex: 1.2;
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.auth-visual-content {
    color: #fff;
    text-align: center;
    z-index: 2;
    padding: 4rem;
}

.auth-visual-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.15;
    background-size: cover;
    background-position: center;
}

/* Floating Elements for Visual */
.floating-element {
    position: absolute;
    animation: float 6s ease-in-out infinite;
    opacity: 0.2;
    z-index: 1;
}

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

/* Dashboard Specifics */
.metric-card {
    border: none;
    border-radius: var(--modern-radius);
    padding: 1.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.metric-card .metric-icon {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 5rem;
    opacity: 0.2;
    transform: rotate(-15deg);
}

.metric-card.primary { background: linear-gradient(135deg, #4e73df 0%, #224abe 100%); }
.metric-card.success { background: linear-gradient(135deg, #1cc88a 0%, #13855c 100%); }
.metric-card.info { background: linear-gradient(135deg, #36b9cc 0%, #258391 100%); }
.metric-card.warning { background: linear-gradient(135deg, #f6c23e 0%, #dda20a 100%); }

.icon-box {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.icon-box-primary { background: rgba(78, 115, 223, 0.1); color: #4e73df; }
.icon-box-success { background: rgba(28, 200, 138, 0.1); color: #1cc88a; }
.icon-box-info { background: rgba(54, 185, 204, 0.1); color: #36b9cc; }

/* Glassmorphism utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

/* Section Header */
.section-header {
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    color: #4e73df;
}

.section-header p {
    color: #858796;
    margin-bottom: 0;
}

/* Authentication Layouts */
.auth-basic-wrapper {
    min-height: 100vh;
    background-color: #f8f9fc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Split Screen Refinements */
@media (max-width: 991px) {
    .auth-split-wrapper {
        flex-direction: column;
    }
    .auth-split-form {
        padding: 2rem 1.5rem;
        flex: none;
        width: 100%;
    }
    .auth-split-visual {
        display: none !important;
    }
}

/* Form Groups */
.input-group-text {
    background-color: #f8f9fc;
    border-color: #d1d3e2;
    color: #858796;
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-split-form > div {
    animation: fadeIn 0.5s ease-out;
}

/* Premium Onboarding Content Canvas Spacing */
.main-wrapper.auth-content {
    margin-top: 80px !important;
    min-height: calc(100vh - 80px) !important;
    padding: 0 2.5rem 2.5rem 2.5rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    background-color: #f8f9fc !important;
    box-sizing: border-box !important;
}

/* Ensure container-fluid has no negative margin inside auth-content */
.main-wrapper.auth-content > .container-fluid {
    width: 100% !important;
    max-width: 1080px !important;
    padding: 0 !important;
    padding-top: 5vh !important; /* Push down slightly from the very top */
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important; /* Shifted from center to top align */
}

/* Inner Auth Card (Inside standard layout) */
.auth-inner-card {
    background: #ffffff !important;
    border-radius: 20px !important; /* Premium rounded radius */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03), 0 1px 8px rgba(0, 0, 0, 0.015) !important; /* Soft layered shadows */
    border: 1px solid rgba(0, 0, 0, 0.03) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    max-width: 1080px !important; /* Unified perfect width matching registration */
    margin: 0 auto !important;
    animation: fadeIn 0.4s ease-out !important;
}

.auth-inner-card-form {
    flex: 1.5 !important;
    padding: 2.5rem 2.5rem !important;
}

.auth-inner-card-visual {
    flex: 1 !important;
    background: linear-gradient(135deg, rgb(8, 47, 85) 0%, rgb(30, 144, 255) 70%, rgb(0, 191, 255) 100%) !important; /* AISEE deep blue gradient */
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 2.5rem !important;
    color: #ffffff !important;
    text-align: center !important;
}

.auth-inner-card-visual.success { background: linear-gradient(135deg, #1cc88a 0%, #13855c 100%) !important; }
.auth-inner-card-visual.info { background: linear-gradient(135deg, rgb(8, 47, 85) 0%, rgb(30, 144, 255) 70%, rgb(0, 191, 255) 100%) !important; }

/* Registration Card styling globally */
.main-wrapper.auth-content .card {
    border-radius: 20px !important;
    border: 1px solid rgba(0, 0, 0, 0.03) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03), 0 1px 8px rgba(0, 0, 0, 0.015) !important;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 1080px !important; /* Perfect readability width for multi-column grids */
    margin: 0 auto !important;
    background: #ffffff !important;
}

.main-wrapper.auth-content .card-body {
    padding: 2.5rem 2.5rem !important;
}

/* Grid-based Registration Form */
.registration-grid-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.registration-grid-form .col-full {
    grid-column: span 2;
}

@media (max-width: 991px) {
    .main-wrapper.auth-content {
        padding: 1.5rem 1rem !important; /* Safe slim mobile margins */
    }
    .auth-inner-card {
        flex-direction: column !important;
        max-width: 540px !important;
    }
    .auth-inner-card-visual {
        display: none !important;
    }
    .auth-inner-card-form {
        padding: 2.5rem 1.75rem !important;
    }
    .main-wrapper.auth-content .card-body {
        padding: 2.5rem 1.5rem !important;
    }
    .registration-grid-form {
        grid-template-columns: 1fr;
    }
    .registration-grid-form .col-full {
        grid-column: span 1;
    }
}

/* Status Badges */
.badge {
    padding: 0.5em 0.8em;
    font-weight: 600;
    border-radius: 6px;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.badge-soft-success { background-color: rgba(28, 200, 138, 0.1); color: #1cc88a; }
.badge-soft-danger { background-color: rgba(231, 74, 59, 0.1); color: #e74a3b; }
.badge-soft-warning { background-color: rgba(246, 194, 62, 0.1); color: #f6c23e; }
.badge-soft-info { background-color: rgba(54, 185, 204, 0.1); color: #36b9cc; }
.badge-soft-primary { background-color: rgba(78, 115, 223, 0.1); color: #4e73df; }

/* Table Enhancements */
.table thead th {
    background-color: #f8f9fc;
    color: #4e73df;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    border-bottom: 2px solid #e3e6f0;
    padding: 1rem 1.25rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(78, 115, 223, 0.05);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* AISEE Deep Blue Gradient Buttons */
.btn-gradient-primary {
    background: linear-gradient(135deg, rgb(8, 47, 85) 0%, rgb(30, 144, 255) 70%, rgb(0, 191, 255) 100%) !important;
    color: #fff !important;
    border: none !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 10px rgba(30, 144, 255, 0.2) !important;
}

.btn-gradient-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 15px rgba(30, 144, 255, 0.3) !important;
    color: #fff !important;
}

/* AISEE Deep Blue Branding Utilities */
.text-brand-blue { color: rgb(8, 47, 85) !important; }
.border-brand-blue { border-color: rgb(8, 47, 85) !important; }
.bg-brand-blue-light { background-color: rgba(8, 47, 85, 0.05) !important; }

/* Compact Input Styles for Dense Grid */
.registration-grid-form .form-control, 
.registration-grid-form .form-select,
.auth-inner-card-form .form-control,
.auth-inner-card-form .form-select {
    padding: 0.5rem 0.85rem !important;
    font-size: 0.9rem !important;
    border-radius: 0.4rem !important;
}

.registration-grid-form .form-label,
.auth-inner-card-form .form-label {
    margin-bottom: 0.25rem !important;
    font-size: 0.8rem !important;
}

/* 12-Column Responsive Grid for Registration Form */
.registration-grid-form {
    display: grid !important;
    grid-template-columns: repeat(12, 1fr) !important;
    row-gap: 0.85rem !important;
    column-gap: 1.25rem !important;
}

/* Default spans for mobile (full-width) */
.registration-grid-form > div {
    grid-column: span 12 !important;
}

/* Desktop Spans (Medium devices and up) */
@media (min-width: 768px) {
    .registration-grid-form .col-full {
        grid-column: span 12 !important;
    }
    .registration-grid-form .col-half {
        grid-column: span 6 !important;
    }
    .registration-grid-form .col-third {
        grid-column: span 4 !important;
    }
}

/* Custom Validation Styles */
.form-control.is-valid, .form-select.is-valid {
    border-color: #198754 !important;
    background-image: none !important;
}
.form-control.is-invalid, .form-select.is-invalid {
    border-color: #dc3545 !important;
    background-image: none !important;
}
.validation-message {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: none;
}
.is-invalid ~ .validation-message.invalid-feedback-custom,
.is-invalid + .validation-message.invalid-feedback-custom {
    display: block !important;
    color: #dc3545 !important;
}
.input-group.is-invalid ~ .validation-message.invalid-feedback-custom {
    display: block !important;
    color: #dc3545 !important;
}

/* Password Rules Checklist */
.password-rules {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    padding-left: 0;
    list-style-type: none;
}
.password-rules li {
    margin-bottom: 0.25rem;
    color: #6c757d;
    display: flex;
    align-items: center;
}
.password-rules li i {
    margin-right: 0.5rem;
    font-size: 0.85rem;
}
.password-rules li.valid {
    color: #198754 !important;
}
.password-rules li.invalid {
    color: #dc3545 !important;
}

/* Fix Modal z-index overlapping with top-header */
.modal-backdrop {
    z-index: 1065 !important;
}
.modal {
    z-index: 1075 !important;
}

/* =========================================================
   EXPERT UI/UX DASHBOARD REFINEMENTS
   Applies to Tables, Cards, and Data Containers
   ========================================================= */

/* --- Card Optimizations --- */
.main-content .card {
    border: 1px solid rgba(0,0,0,0.06) !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.02) !important;
    margin-bottom: 1.25rem !important;
}

.main-content .card-body {
    padding: 1.25rem !important;
}

/* Adjust Section Headers */
.main-content .section-header {
    margin-bottom: 1.25rem !important;
}
.main-content h2, 
.main-content .section-header h2 {
    font-size: 1.4rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.25rem !important;
    letter-spacing: -0.01em !important;
}
.main-content p.text-muted,
.main-content .section-header p {
    font-size: 0.9rem !important;
    margin-bottom: 0 !important;
}

/* --- Table Optimizations --- */
.main-content .table-responsive {
    border-radius: 0.375rem !important;
    border: 1px solid rgba(0,0,0,0.05) !important;
    margin-bottom: 0 !important;
    background: #fff !important;
}

.main-content .table {
    margin-bottom: 0 !important;
    font-size: 0.85rem !important;
}

.main-content .table th {
    background-color: #f8f9fa !important;
    color: #495057 !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 0.75rem 1rem !important;
    border-bottom: 2px solid rgba(0,0,0,0.05) !important;
    border-top: none !important;
    white-space: nowrap !important;
}

.main-content .table td {
    padding: 0.75rem 1rem !important;
    vertical-align: middle !important;
    color: #333 !important;
    border-bottom: 1px solid rgba(0,0,0,0.03) !important;
}

/* Hover effect on table rows */
.main-content .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.01) !important;
}
.main-content .table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.03) !important;
    transition: background-color 0.15s ease-in-out;
}

/* --- Badges and Labels --- */
.main-content .badge {
    padding: 0.4em 0.7em !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    border-radius: 0.25rem !important;
    letter-spacing: 0.02em !important;
}

/* --- Form Filters Density --- */
.main-content .card-body .form-label {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: #6c757d !important;
    margin-bottom: 0.25rem !important;
    text-transform: uppercase !important;
}

.main-content .card-body .form-control,
.main-content .card-body .form-select {
    font-size: 0.85rem !important;
    padding: 0.4rem 0.75rem !important;
    min-height: 32px !important;
    border-radius: 0.375rem !important;
}

/* --- Action Buttons --- */
.main-content .table .btn,
.main-content .table .btn-sm {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.8rem !important;
    border-radius: 0.25rem !important;
    line-height: 1.2 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.25rem !important;
}
.main-content .table .btn i,
.main-content .table .btn-sm i {
    font-size: 0.85rem !important;
}

/* Pagination Adjustments inside cards */
.main-content .card .p-4 {
    padding: 1rem 1.25rem !important;
    border-top: 1px solid rgba(0,0,0,0.05) !important;
    background: #fdfdfd !important;
}

/* Bulk actions bar compactness */
.main-content #bulkOperationsBar .card-body {
    padding: 0.75rem 1.25rem !important;
}
