/* AdminLTE Custom Overrides */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Sidebar Enhancements - Professional Dark Theme */
.main-sidebar {
    background: #343a40 !important;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}

/* Adjust content margin for wider sidebar on desktop */
@media (min-width: 768px) {
    body:not(.sidebar-mini-md):not(.sidebar-mini-xs):not(.layout-top-nav) .main-sidebar {
        width: 250px;
    }
    
    body:not(.sidebar-mini-md):not(.sidebar-mini-xs):not(.layout-top-nav) .content-wrapper,
    body:not(.sidebar-mini-md):not(.sidebar-mini-xs):not(.layout-top-nav) .main-footer,
    body:not(.sidebar-mini-md):not(.sidebar-mini-xs):not(.layout-top-nav) .main-header {
        margin-left: 250px;
    }
}

/* Brand/Logo Area */
.brand-link {
    padding: 1.5rem 1rem !important;
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    background: #2d3238 !important;
    display: flex !important;
    align-items: center !important;
    min-height: 57px;
}

.brand-link:hover {
    background: #2d3238 !important;
    color: #fff !important;
}

.brand-link .brand-image {
    max-height: 40px !important;
    width: auto !important;
    margin-right: 0.5rem !important;
    float: none !important;
}

.brand-text {
    color: #fff !important;
    font-weight: 600 !important;
}

/* Navigation Items */
.sidebar {
    padding-top: 0.5rem !important;
    background: #343a40 !important;
}

.sidebar .nav-link {
    padding: 0.75rem 1rem !important;
    font-size: 0.95rem !important;
    margin: 0.125rem 0.5rem !important;
    border-radius: 0.25rem !important;
    transition: all 0.2s ease !important;
    color: rgba(255,255,255,0.8) !important;
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,0.1) !important;
    color: #fff !important;
    transform: translateX(2px);
}

.sidebar .nav-link.active {
    background: #007bff !important;
    color: #fff !important;
    box-shadow: 0 2px 4px rgba(0,123,255,0.3);
}

.sidebar .nav-icon {
    font-size: 1.1rem !important;
    margin-right: 0.75rem !important;
    width: 24px !important;
    text-align: center;
    color: rgba(255,255,255,0.7) !important;
}

.sidebar .nav-link.active .nav-icon {
    color: #fff !important;
}

.sidebar .nav-link p {
    font-weight: 500 !important;
    margin: 0 !important;
    display: inline !important;
}

/* Sidebar scrollbar styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #2d3238;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

/* Khmer Font - Only apply to text elements, not icons */
body.lang-km p,
body.lang-km span:not(.badge):not([class*="fa"]):not(.navbar-badge),
body.lang-km h1, body.lang-km h2, body.lang-km h3, body.lang-km h4, body.lang-km h5, body.lang-km h6,
body.lang-km label,
body.lang-km .card-title,
body.lang-km .modal-title,
body.lang-km .nav-link p,
body.lang-km .brand-text,
body.lang-km button:not(.close):not([class*="swal"]),
body.lang-km input,
body.lang-km textarea,
body.lang-km select,
body.lang-km .form-control,
body.lang-km td,
body.lang-km th {
    font-family: 'Noto Sans Khmer', 'Koulen', 'Bayon', 'Kantumruy Pro', sans-serif !important;
}

/* Preserve icon fonts */
body.lang-km i,
body.lang-km .fa,
body.lang-km .fas,
body.lang-km .far,
body.lang-km .fab,
body.lang-km .fal {
    font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Brands' !important;
}

/* Badge Colors */
.badge-monthly {
    background: #17a2b8;
    color: white;
}

.badge-quarterly {
    background: #ffc107;
    color: #212529;
}

.badge-yearly {
    background: #28a745;
    color: white;
}

.badge-critical {
    background: #dc3545;
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #212529;
}

.badge-good {
    background: #28a745;
    color: white;
}

.badge-admin {
    background: #007bff;
    color: white;
}

.badge-user {
    background: #6c757d;
    color: white;
}

.parts-badge {
    background: #007bff;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

/* Loading Overlay */
.content-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 1;
    visibility: visible;
}

.content-loading-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

.content-loading-overlay.hidden {
    display: none !important;
}

.content-loader {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

.loading-text {
    color: #555;
    font-weight: 600;
    margin: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 14px;
}

/* Page Transition Animation */
.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fix Brand Text Visibility in Collapsed Sidebar */
.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover) .brand-text {
    display: none !important;
}

/* Hide Brand Text Setting & Center Logo */
.brand-link.hide-brand-text {
    justify-content: center !important;
}

.brand-link.hide-brand-text .brand-text {
    display: none !important;
}

.brand-link.hide-brand-text .brand-image {
    margin: 0 !important;
    float: none !important;
}

/* Facebook-style Verified Badge */
.verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background-color: #1877F2; /* Facebook Blue */
    color: white;
    border-radius: 50%;
    margin-left: 5px;
    vertical-align: middle;
    font-size: 9px;
}

.verified-badge i {
    transform: scale(0.8);
}
