/* ===== Sidebar Collapse Animations ===== */
.kt-menu-accordion {
    transition: max-height 0.3s ease;
    overflow: hidden;
}
.demo1 .kt-sidebar,
.demo1.kt-sidebar-fixed .kt-wrapper,
.demo1.kt-sidebar-fixed.kt-header-fixed .kt-header {
    transition: width 0.3s ease, padding-inline-start 0.3s ease, inset-inline-start 0.3s ease !important;
}
.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) .kt-sidebar-content {
    overflow-x: hidden;
}
.demo1.kt-sidebar-collapse .kt-sidebar .kt-menu > .kt-menu-item > .kt-menu-link {
    transition: justify-content 0.15s ease, padding 0.15s ease, gap 0.15s ease;
}
.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) .kt-menu > .kt-menu-item > .kt-menu-link {
    justify-content: center;
    padding: 6px 0 !important;
    gap: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
}
.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) .kt-menu > .kt-menu-item > .kt-menu-link .kt-menu-title,
.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) .kt-menu > .kt-menu-item > .kt-menu-link .kt-menu-arrow {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}
.demo1.kt-sidebar-collapse .kt-sidebar .kt-menu > .kt-menu-item > .kt-menu-link .kt-menu-title,
.demo1.kt-sidebar-collapse .kt-sidebar .kt-menu > .kt-menu-item > .kt-menu-link .kt-menu-arrow {
    transition: opacity 0.15s ease, visibility 0.15s ease;
}
.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) .kt-menu > .kt-menu-item > .kt-menu-heading {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}
.demo1.kt-sidebar-collapse .kt-sidebar .kt-menu > .kt-menu-item > .kt-menu-heading {
    transition: opacity 0.15s ease, visibility 0.15s ease;
}
.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) .kt-menu > .kt-menu-item > .kt-menu-heading::before {
    content: none !important;
}
.demo1.kt-sidebar-collapse .kt-sidebar .kt-menu > .kt-menu-item > .kt-menu-link .kt-menu-icon {
    transition: margin 0.15s ease;
}
.demo1.kt-sidebar-collapse .kt-sidebar .kt-menu-icon {
    width: 24px !important;
    flex-shrink: 0;
}
.demo1.kt-sidebar-collapse .kt-sidebar .kt-menu-icon i {
    font-size: 1.25rem !important;
}
.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) .kt-menu > .kt-menu-item > .kt-menu-accordion {
    display: none !important;
}
.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) .kt-menu > .kt-menu-item > .kt-menu-link .kt-menu-bullet {
    display: none !important;
}
.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) .default-logo {
    display: none !important;
}
.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) .small-logo {
    display: flex !important;
}
.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) .kt-sidebar-header {
    justify-content: center;
}

/* ===== Modal Animation ===== */
@keyframes kt-modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ===== Drawer / Modal Shared Styles ===== */
.kt-overlay {
    background: rgba(0,0,0,0.35);
}
.kt-overlay-dark {
    background: rgba(0,0,0,0.6);
}
.kt-drawer-panel {
    display: flex;
    flex-direction: column;
    transform: translateX(calc(100% + 20px));
    transition: transform 0.3s ease;
}
.kt-drawer-panel.open {
    transform: translateX(0);
}
.kt-drawer-backdrop {
    background: rgba(0,0,0,0);
    pointer-events: none;
    transition: background 0.25s ease;
}
.kt-drawer-backdrop.open {
    background: rgba(0,0,0,0.25);
    pointer-events: auto;
}

/* ===== Stat Cards ===== */
.stat-card {
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

/* ===== Delete / Confirm Modal ===== */
.kt-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.35);
    align-items: center;
    justify-content: center;
}
.kt-modal-box {
    width: 440px;
    max-width: calc(100vw - 2rem);
    animation: kt-modal-in 0.2s ease-out;
}
.kt-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem 1.25rem 1.5rem 1.25rem;
    gap: 0.5rem;
}
.kt-modal-text {
    text-align: center;
    width: 100%;
    line-height: 1.6;
}

/* ===== Bill Image Modal ===== */
.kt-image-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
.kt-image-modal-box {
    max-width: min(90vw, 800px);
    max-height: 90vh;
    animation: kt-modal-in 0.2s ease-out;
}

/* ===== History / Import Drawers ===== */
.kt-side-drawer {
    position: fixed;
    top: 0;
    right: -620px;
    bottom: 0;
    width: 620px;
    max-width: 100vw;
    z-index: 100;
    background: var(--popover);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}
.kt-side-drawer.open {
    right: 0;
}
.kt-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.kt-drawer-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--mono);
    margin: 0;
}
.kt-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    min-height: 0;
}
.kt-drawer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 0;
    gap: 12px;
}
.kt-drawer-loading-text {
    font-size: 14px;
    color: var(--secondary-foreground);
}
.kt-drawer-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ===== Import Preview Success/Error States ===== */
.kt-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
    text-align: center;
}
.kt-state-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin-bottom: 12px;
}
.kt-state-icon-success {
    background: color-mix(in srgb, #22c55e 10%, transparent);
}
.kt-state-icon-error {
    background: color-mix(in srgb, var(--destructive) 10%, transparent);
}
.kt-state-icon i {
    font-size: 1.5rem;
}
.kt-state-icon i.ki-check-circle {
    color: #22c55e;
}
.kt-state-icon i.ki-close-circle {
    color: var(--destructive);
}
.kt-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--mono);
    margin: 0 0 4px 0;
}
.kt-state-desc {
    font-size: 14px;
    color: var(--secondary-foreground);
    margin: 0;
}
.kt-state-error {
    font-size: 14px;
    color: var(--destructive);
    margin: 0;
}

/* ===== SKU Multiselect ===== */
.sku-ms-list {
    scroll-behavior: smooth;
}
.sku-ms-list > div {
    background: #fff !important;
    color: #111 !important;
    border-bottom: 1px solid #e5e7eb !important;
    flex-shrink: 0 !important;
}
.dark .sku-ms-list > div {
    background: #1e1e2a !important;
    color: #e5e7eb !important;
    border-bottom: 1px solid #2d2d3d !important;
}
.sku-ms-list > div:hover {
    background: #f3f4f6 !important;
}
.dark .sku-ms-list > div:hover {
    background: #2d2d3d !important;
}

/* ===== Bill Status Filters ===== */
#status-filters a {
    color: #6B7280;
    transition: all 0.15s;
}
#status-filters a.active {
    background: #fff;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
#status-filters a.active[data-color="#3B82F6"] { color: #3B82F6; }
#status-filters a.active[data-color="#22c55e"] { color: #22c55e; }
#status-filters a.active[data-color="#ef4444"] { color: #ef4444; }
#status-filters a:not(.active):hover { color: var(--hover-color); }
#status-filters a[data-color="#3B82F6"]:not(.active):hover { color: #3B82F6; }
#status-filters a[data-color="#22c55e"]:not(.active):hover { color: #22c55e; }
#status-filters a[data-color="#ef4444"]:not(.active):hover { color: #ef4444; }

/* ===== Branded Background ===== */
.branded-bg {
    background-image: url('/premium/assets/media/images/2600x1600/1.png');
}
.dark .branded-bg {
    background-image: url('/premium/assets/media/images/2600x1600/1-dark.png');
}

/* ===== Password Strength ===== */
.pw-bar {
    height: 0.25rem;
    flex: 1;
    border-radius: 0.25rem;
    background: var(--destructive);
    transition: background 0.2s;
}

/* ===== Responsive Tables ===== */
.kt-scrollable-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}
.kt-scrollable-x-auto > table.table-fixed {
    table-layout: auto;
    width: 100%;
    min-width: 700px;
}
@media (max-width: 1023px) {
    .kt-scrollable-x-auto > table.table-fixed {
        min-width: 900px;
    }
    .kt-card-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* ===== Responsive Edit Bill Table ===== */
#edit-report-table {
    min-width: 1200px;
    width: 100%;
}
#edit-report-table input.kt-input,
#edit-report-table .kt-input {
    max-width: 100%;
    box-sizing: border-box;
}

/* ===== Responsive Roles Drawer ===== */
@media (max-width: 1023px) {
    #role-drawer-panel {
        width: 100% !important;
        max-width: calc(100vw - 1rem) !important;
        top: 0.5rem !important;
        bottom: 0.5rem !important;
        end: 0.5rem !important;
    }
    #perms-table th,
    #perms-table td {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    #perms-table th:nth-child(n+2),
    #perms-table td:nth-child(n+2) {
        width: auto !important;
        min-width: 50px !important;
    }
}

/* ===== Responsive Audit Drawer ===== */
@media (max-width: 1023px) {
    #audit-drawer-panel {
        width: 100% !important;
        max-width: calc(100vw - 1rem) !important;
        top: 0.5rem !important;
        bottom: 0.5rem !important;
        end: 0.5rem !important;
    }
}

/* ===== General Responsive ===== */
@media (max-width: 767px) {
    .kt-container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .kt-container-fluid > .flex.flex-row.gap-5.mb-5 {
        flex-direction: column;
    }
    .kt-card-body {
        padding: 1rem;
    }
    .kt-card-content {
        padding: 1rem;
    }
    .kt-card-header {
        flex-direction: column;
        align-items: stretch;
    }
    .kt-card-header form {
        width: 100%;
    }
    .kt-card-header form .kt-input {
        max-width: 100% !important;
    }
}
@media (max-width: 639px) {
    /* Stack stat cards */
    .flex.flex-row.gap-5.mb-5 > .kt-card,
    .flex.flex-row.gap-5.mb-5 > [class*="kt-card"] {
        min-width: 0;
    }
    /* Responsive filters row */
    #edit-report-filters {
        flex-wrap: wrap;
    }
}

/* ===== Role Drawer Description Row ===== */
@media (max-width: 767px) {
    #role-drawer-body .mt-4.flex.items-start.gap-4 {
        flex-direction: column;
    }
    #role-drawer-body .mt-4.flex.items-start.gap-4 .pt-6 {
        padding-top: 0;
    }
}

/* ===== Autofill Styles ===== */
@media print {
    .no-print { display: none !important; }
    @page { margin: 1.5cm; }
}
