/* Modern UI & Responsiveness Foundation */

:root {
    --primary-gradient: linear-gradient(135deg, #0ea5e9 0%, #10b981 100%);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow-premium: 0 8px 32px 0 rgba(15, 23, 42, 0.07);
    --text-main: #1e293b;
    --bg-main: #f8fafc;
    --sidebar-bg: #f8fafc;
    --sidebar-text: #64748b;
    --sidebar-text-active: #0ea5e9;
    --card-radius: 20px;
    
    /* Variable specific overrides */
    --card-bg: #ffffff;
    --topbar-bg: #ffffff;
    --table-header: #f8fafc;
}

[data-theme="dark"] {
    --bg-main: #0f172a;
    --text-main: #f1f5f9;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-bg: #1e293b;
    --topbar-bg: #1e293b;
    --table-header: #334155;
    --sidebar-bg: #0f172a;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', 'Poppins', sans-serif;
}

/* Glassmorphism Effect */
.glass-effect, .glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-premium);
    border-radius: var(--card-radius);
    overflow: visible; /* Important: allow dropdowns to pop out */
}

/* Premium Sidebar */
#accordionSidebar {
    background: var(--sidebar-bg) !important;
    border-right: 1px solid #e2e8f0;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.03);
    /* Fixed Sidebar Mechanics */
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1030;
    width: 16rem !important; /* Slightly wider for bigger logo */
}

/* Sidebar Brand Overrides */
.sidebar .sidebar-brand {
    height: auto !important; /* Allow growing */
    min-height: 120px;
    padding: 2rem 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.sidebar-brand-text {
    width: 100%;
}

.sidebar-brand-text img {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 15px;
}

/* Custom Thin Scrollbar for the Sidebar */
#accordionSidebar::-webkit-scrollbar {
    width: 6px;
}
#accordionSidebar::-webkit-scrollbar-track {
    background: transparent;
}
#accordionSidebar::-webkit-scrollbar-thumb {
    background: rgba(200, 200, 200, 0.5);
    border-radius: 10px;
}
#accordionSidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(14, 165, 233, 0.5); /* Primary blue with transparency */
}

.sidebar .nav-item .nav-link {
    font-weight: 500;
    color: var(--sidebar-text) !important;
    padding: 0.8rem 1.25rem;
    margin: 0.4rem 1rem;
    transition: all 0.2s ease-in-out;
    border-radius: 14px;
    display: flex;
    align-items: center;
    width: auto;
}

.sidebar .nav-item .nav-link i {
    color: #64748b !important;
    font-size: 1.1rem;
    margin-right: 0.75rem;
    width: 1.5rem;
    text-align: center;
    transition: color 0.2s ease;
}

.sidebar .nav-item .nav-link:hover {
    background: rgba(14, 165, 233, 0.08) !important;
    color: var(--sidebar-text-active) !important;
}

.sidebar .nav-item .nav-link:hover i {
    color: var(--sidebar-text-active) !important;
}

.sidebar .nav-item.active .nav-link {
    background: var(--primary-gradient) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.25);
}

.sidebar .nav-item.active .nav-link i,
.sidebar .nav-item.active .nav-link span {
    color: #ffffff !important;
}

/* Modernized Cards */
.card {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.15);
}

.card-header {
    background: var(--card-bg) !important;
    border-bottom: 1px solid var(--glass-border) !important;
    padding: 1.25rem 1.5rem;
}

[data-theme="dark"] .card-header h6 {
    color: #fff !important;
}

[data-theme="dark"] .sidebar-dark .nav-item .nav-link {
    color: #94a3b8 !important;
}

/* Responsive Table for Mobile */
@media (max-width: 768px) {
    .table-responsive {
        border: none;
    }

    .table thead {
        display: none;
        /* Hide headers on mobile */
    }

    .table tbody tr {
        display: block;
        margin-bottom: 1rem;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        padding: 1rem;
        border: 1px solid #eee;
    }

    .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        border: none !important;
        padding: 0.5rem 0;
        font-size: 0.9rem;
    }

    .table td::before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        margin-right: 1rem;
        color: #636e72;
    }

    .table td:last-child {
        justify-content: center;
        border-top: 1px solid #f1f3f9 !important;
        margin-top: 0.5rem;
        padding-top: 1rem;
    }
}

/* Premium Buttons */
.btn {
    border-radius: 10px;
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

/* Form Styles */
.form-control {
    border-radius: 10px;
    border: 1px solid #d1d3e2;
    padding: 0.75rem 1rem;
}

.form-control:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 0.2rem rgba(14, 165, 233, 0.15);
}

/* Modern Topbar Search */
.search-bar-modern {
    background: #f1f5f9;
    border-radius: 50px;
    padding: 2px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    width: 300px;
}

.search-bar-modern:focus-within {
    background: #ffffff;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.search-bar-modern .form-control {
    background: transparent !important;
    border: none !important;
    padding-left: 1.25rem;
    font-size: 0.9rem;
    height: 38px;
}

.search-bar-modern .form-control:focus {
    box-shadow: none !important;
}

.search-bar-modern .btn {
    border-radius: 50px !important;
    padding: 0 1.25rem;
    height: 34px;
    margin: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Topbar Modernization */
.topbar {
    background: #ffffff !important;
    border-bottom: 1px solid #f1f3f9;
}

.topbar .nav-item .nav-link {
    color: var(--text-main) !important;
}

.topbar .nav-item .nav-link:hover {
    color: #0ea5e9 !important;
}

/* Modal Premium Styling */
.modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

.modal-header {
    border-bottom: 1px solid #f1f3f9;
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #f1f3f9;
    padding: 1.25rem;
}

/* Footer Styling */
.sticky-footer {
    background: #ffffff !important;
    border-top: 1px solid #f1f3f9;
    padding: 2rem 0 !important;
}

.sticky-footer .copyright span {
    color: #636e72 !important;
    font-weight: 500;
}

/* DataTables Premium Styling */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-gradient) !important;
    border: none !important;
    color: white !important;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.2);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current) {
    background: #edf2f7 !important;
    border: none !important;
    color: #4a5568 !important;
    border-radius: 8px;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    border: 1px solid #e3e6f0;
    padding: 6px 14px;
    transition: all 0.2s;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #0284c7;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(14, 165, 233, 0.15);
}

/* Dark Sidebar heading and divider refinements */
.sidebar-dark .sidebar-heading {
    color: #64748b !important;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 1rem 1.5rem 0.5rem;
}

.sidebar-dark .sidebar-divider {
    border-top: 1px solid #e2e8f0 !important;
}

.sidebar-dark .sidebar-brand-text img {
    filter: none !important;
}

/* Premium Badges */
.badge {
    padding: 0.5em 0.85em;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 8px;
}
.badge-success { background-color: rgba(28, 200, 138, 0.15); color: #1cc88a; }
.badge-warning { background-color: rgba(246, 194, 62, 0.15); color: #f6c23e; }
.badge-danger { background-color: rgba(231, 74, 59, 0.15); color: #e74a3b; }
.badge-secondary { background-color: rgba(133, 135, 150, 0.15); color: #858796; }

/* --- NEW PREMIUM ADDITIONS --- */

/* Entrance Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-up {
    animation: fadeInUp 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
    opacity: 0;
}

.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

/* Premium Stat Cards Overrides */
.stat-card {
    border: none;
    border-radius: 20px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #fff;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.stat-icon-box {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stat-card-primary .stat-icon-box {
    background: rgba(14, 165, 233, 0.1);
    color: #0ea5e9;
}

.stat-card-success .stat-icon-box {
    background: rgba(28, 200, 138, 0.1);
    color: #1cc88a;
}

.stat-card-info .stat-icon-box {
    background: rgba(54, 185, 204, 0.1);
    color: #36b9cc;
}

.stat-card-warning .stat-icon-box {
    background: rgba(246, 194, 62, 0.1);
    color: #f6c23e;
}

.stat-card-danger .stat-icon-box {
    background: rgba(231, 74, 59, 0.1);
    color: #e74a3b;
}

.stat-card-secondary .stat-icon-box {
    background: rgba(133, 135, 150, 0.1);
    color: #858796;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #636e72;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3436;
    margin: 0;
}

/* Refined Table Headers & Body */
.table thead th {
    background: #f8fafc;
    border: none !important;
    border-bottom: 2px solid #e2e8f0 !important;
    font-size: 0.8rem;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1.25rem 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background-color: #f1f5f9 !important;
    transform: scale(1.002);
}

.table tbody td {
    border-bottom: 1px solid #edf2f7 !important;
    padding: 1rem;
    vertical-align: middle;
    color: #4a5568;
}

/* --- PRINT OPTIMIZATION --- */
@media print {
    /* Hide non-essential layout elements */
    #accordionSidebar,
    .topbar,
    .btn,
    .modal,
    footer,
    .pagination,
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        display: none !important;
    }

    /* Force visibility and disable animations for print */
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Reset background and sizing for optimal paper printing */
    body, #wrapper, #content-wrapper, #content {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        overflow: visible !important;
    }
    
    .container-fluid {
        padding: 0 !important;
    }

    .card {
        border: none !important;
        box-shadow: none !important;
    }
    
    .card-header {
        border-bottom: 2px solid #000 !important;
        padding-left: 0 !important;
    }

    /* Expand tables to full width and ensure borders serialize */
    .table-responsive {
        overflow: visible !important;
    }
    
    table {
        width: 100% !important;
        border-collapse: collapse !important;
    }
    
    th, td {
        border: 1px solid #ddd !important;
        padding: 8px !important;
        color: #000 !important;
        font-size: 10pt !important;
    }
}

/* ============================================================
   RESPONSIVE TABLE → CARD LAYOUT  (screens ≤ 1200px)
   ============================================================ */
@media (max-width: 1200px) {

    /* Hide the header row — labels come from data-label */
    .table-responsive thead {
        display: none !important;
    }

    .table-responsive {
        overflow: visible !important;
    }

    /* Remove the outer overflow-x so cards stack cleanly */
    .table-responsive .table,
    .table-responsive .table tbody {
        display: block !important;
        width: 100% !important;
    }

    /* Each row = a card */
    .table-responsive .table tbody tr {
        display: block !important;
        margin-bottom: 1.5rem !important;
        border-radius: 16px !important;
        border: 1px solid var(--glass-border) !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.06) !important;
        background: var(--card-bg) !important;
        overflow: visible !important;
        padding: 0 !important;
        position: relative !important;
    }

    /* Each cell = a label-value row inside the card */
    .table-responsive .table tbody td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.85rem 1.5rem !important;
        border: none !important;
        border-bottom: 1px solid var(--glass-border) !important;
        font-size: 0.9rem !important;
        min-height: 48px;
        word-break: break-word;
        text-align: right !important;
    }

    .table-responsive .table tbody td:last-child {
        border-bottom: none !important;
    }

    /* Label (from data-label attribute) shown on the LEFT */
    .table-responsive .table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: #858796;
        text-align: left !important;
        margin-right: 2rem;
        min-width: 120px;
        flex-shrink: 0;
    }

    /* Action column — full width, centred */
    .table-responsive .table tbody td[data-label="ACTION"],
    .table-responsive .table tbody td[data-label=""] {
        justify-content: center !important;
        padding: 1.25rem !important;
        background: rgba(0,0,0,0.03);
    }

    .table-responsive .table tbody td[data-label="ACTION"]::before,
    .table-responsive .table tbody td[data-label=""]::before {
        display: none;
    }

    /* DataTables controls stacked */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none !important;
        text-align: left !important;
        margin-bottom: 1rem !important;
    }

    .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
        display: block !important;
    }

    .dataTables_wrapper .dataTables_paginate {
        float: none !important;
        text-align: center !important;
        margin-top: 1.5rem !important;
    }

    /* Laptop/Company unit selector cards — 2 per row on tablet, 1 per row on phone */
    .col-xl-3.col-md-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        margin-bottom: 1rem !important;
    }

    @media (max-width: 576px) {
        .col-xl-3.col-md-6 {
            flex: 0 0 100% !important;
            max-width: 100% !important;
        }
    }

    /* Card header buttons stack */
    .card-header .d-flex.flex-wrap {
        width: 100%;
        justify-content: flex-start !important;
        margin-top: 0.5rem;
    }

    .card-header .btn {
        flex: 1 1 auto !important;
        margin-bottom: 0.25rem;
    }
}

/* Compact Data Display Utilities */
.merged-data-title {
    font-weight: 700;
    color: var(--text-main);
    display: block;
    margin-bottom: 0.1rem;
}

.merged-data-sub {
    font-size: 0.75rem;
    color: #858796;
    display: block;
    line-height: 1.2;
}

.spec-badge-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}

@media (min-width: 1201px) {
    .spec-badge-container {
        justify-content: flex-start;
    }
}

/* Fix Dropdown stacking in tables */
.table-responsive .table tbody tr {
    position: relative !important;
    z-index: 1;
}

.table-responsive .table tbody tr:focus-within,
.table-responsive .table tbody tr:hover {
    z-index: 100 !important;
}

/* Ensure open dropdown menu is always on top */
.table-responsive .table tbody tr .dropdown-menu.show {
    z-index: 9999 !important;
}

/* --- MOBILE RESPONSIVENESS — AGGRESSIVE OVERRIDES --- */

/* ======= MAX 768px (Tablet & Smartphone) ======= */
@media (max-width: 768px) {

    /* === SIDEBAR: collapse fully off-screen === */
    #accordionSidebar {
        height: auto !important;
        position: relative !important;
        overflow: hidden;
    }

    /* When toggled on mobile, sidebar should slide in; ensure it doesn't eat content width */
    body:not(.sidebar-toggled) #accordionSidebar {
        width: 14rem !important;
    }

    /* === GLOBAL CONTAINER: tighter padding === */
    .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    /* === TOPBAR === */
    .topbar {
        padding: 0.5rem 0.75rem !important;
    }

    /* === WELCOME BANNER === */
    .dash-welcome {
        padding: 1.5rem 1rem !important;
        border-radius: 14px !important;
        margin-bottom: 1.5rem;
    }

    .dash-welcome h2 {
        font-size: 1.3rem !important;
    }

    .dash-welcome p {
        font-size: 0.85rem !important;
    }

    /* === STAT CARDS === */
    .stat-card {
        padding: 1.2rem !important;
        border-radius: 14px !important;
    }

    .stat-card .card-value {
        font-size: 2rem !important;
    }

    .stat-card .card-icon {
        font-size: 3.5rem !important;
        right: 1rem !important;
    }

    /* === STANDARD CARDS === */
    .card-header {
        padding: 0.8rem 1rem !important;
    }

    .card-body {
        padding: 0.8rem 0.75rem !important;
    }

    /* === CHARTS === */
    .chart-container {
        height: 200px !important;
    }

    .chart-card {
        padding: 1rem !important;
        border-radius: 14px !important;
    }

    /* === TABLES === */
    .table thead th {
        padding: 0.6rem 0.5rem !important;
        font-size: 0.7rem !important;
    }

    .table tbody td {
        padding: 0.6rem 0.5rem !important;
        font-size: 0.82rem !important;
    }

    /* Ensure .table-responsive doesn't bleed outside card */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* === MODALS === */
    .modal-dialog {
        margin: 0.5rem auto !important;
        max-width: 95vw !important;
    }

    .modal-body {
        padding: 1rem !important;
    }

    /* === BUTTONS globally more tappable === */
    .btn {
        min-height: 36px;
        padding: 0.4rem 0.7rem !important;
        font-size: 0.82rem !important;
    }

    /* === DATATABLES UI CONTROLS === */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: center !important;
        float: none !important;
        margin-bottom: 0.5rem !important;
        font-size: 0.82rem !important;
    }

    /* === QUICK LINKS === */
    .quick-link-card {
        padding: 0.8rem 0.5rem !important;
        border-radius: 10px !important;
    }

    .quick-link-card .ql-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 1rem !important;
        border-radius: 8px !important;
    }

    .quick-link-card .ql-label {
        font-size: 0.72rem !important;
    }

    /* === BADGE SIZING === */
    .badge {
        font-size: 0.7rem !important;
        padding: 0.3em 0.5em !important;
    }

    /* === SWEETALERT === */
    .swal-modal {
        width: 90vw !important;
        padding: 1rem !important;
    }
}

/* ======= MAX 576px (Small Smartphone – iPhone SE, etc.) ======= */
@media (max-width: 576px) {

    /* Force stacking for DataTable length+filter controls */
    .dataTables_wrapper .row > div {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
        text-align: left !important;
    }

    /* Make table filter search full width */
    .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
    }

    /* Full-width modals on tiny phones */
    .modal-dialog {
        margin: 0.25rem !important;
        max-width: 100% !important;
    }

    /* Card header title - truncate long text */
    .card-header h6 {
        font-size: 0.82rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 80%;
    }

    /* Pagination buttons stay compact */
    .paginate_button {
        padding: 0.1em 0.4em !important;
        font-size: 0.75rem !important;
        min-width: 28px !important;
    }

    /* Make sure profile dropdown is positioned correctly */
    .dropdown-menu-right {
        right: 0 !important;
        left: auto !important;
    }

    /* Stat card value even smaller */
    .stat-card .card-value {
        font-size: 1.7rem !important;
    }
}

/* ============================================================
   SIDEBAR TOGGLED (COLLAPSED) STATE
   Hanya tampilkan icon, sembunyikan teks & heading
   ============================================================ */
.sidebar.toggled {
    width: 6.5rem !important;
    overflow: visible !important;
}

/* Sembunyikan teks span di nav-link */
.sidebar.toggled .nav-item .nav-link span {
    display: none !important;
}

/* Sembunyikan sidebar heading labels */
.sidebar.toggled .sidebar-heading {
    display: none !important;
}

/* Sembunyikan brand text / logo */
.sidebar.toggled .sidebar-brand-text,
.sidebar.toggled .sidebar-brand img {
    display: none !important;
}

/* Pusatkan icon saat collapsed */
.sidebar.toggled .nav-item .nav-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.85rem !important;
    margin: 0.4rem auto !important;
    width: 3rem !important;
    height: 3rem !important;
    border-radius: 14px !important;
}

/* Icon tidak perlu margin-right saat collapsed */
.sidebar.toggled .nav-item .nav-link i {
    margin-right: 0 !important;
    font-size: 1.15rem !important;
}

/* Brand link centered when collapsed */
.sidebar.toggled .sidebar-brand {
    justify-content: center !important;
    padding: 1rem 0 !important;
}

/* HR dividers tetap terlihat */
.sidebar.toggled .sidebar-divider {
    margin: 0.25rem 1rem !important;
}

/* Tombol toggle tetap terlihat dan centered */
.sidebar.toggled #sidebarToggle {
    display: inline-block !important;
}

/* ============================================================
   RESPONSIVE MODERN LOGIN PAGE (DASHBOARD THEME)
   ============================================================ */

.login-page {
    background-color: #000;
    background-image: linear-gradient(rgba(0,0,0,0.1), rgba(0,0,0,0.1)), url('../img/background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    height: 100vh; /* Use fixed height for viewport */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    font-family: 'Inter', sans-serif;
    color: #ffffff;
    overflow: hidden; /* Prevent ALL scrolling on login */
}

.login-container {
    max-width: 480px; /* Centered form width */
    width: 100%;
    background: rgba(255, 255, 255, 0.05); /* Even more transparent glass */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.login-illustration {
    flex: 1.1;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    border-right: 1px solid rgba(0, 0, 0, 0.03);
}

.login-illustration img {
    max-width: 90%;
    height: auto;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.1));
}

.login-form-area {
    padding: 35px 45px; /* Reduced vertical padding */
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: transparent;
}

.login-header h1 {
    font-size: 32px;
    font-weight: 800;
    color: #ffffff; /* White for better visibility on background */
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    text-align: center;
}

.login-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    margin-bottom: 25px; /* Reduced margin */
    text-align: center;
}

/* Integrated Switching System */
.login-switcher {
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 14px;
    display: flex;
    margin-bottom: 25px; /* Reduced margin */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.switcher-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.switcher-btn.active {
    background: #0ea5e9; /* Dashboard Primary Color */
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

/* Form Visibility Management */
.login-form-wrapper {
    position: relative;
    overflow: hidden;
}

.form-content {
    transition: all 0.4s ease;
}

.form-content.hidden {
    display: none;
    opacity: 0;
    transform: translateY(10px);
}

.login-field {
    margin-bottom: 22px;
}

.login-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.login-input {
    width: 100%;
    height: 52px;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0 16px;
    font-size: 15px;
    color: #1a1a1a;
    transition: all 0.2s;
}

.login-input:focus {
    background: #ffffff;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
    outline: none;
}

.login-btn {
    width: 100%;
    height: 54px;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 8px 20px -5px rgba(253, 74, 24, 0.35);
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px -5px rgba(253, 74, 24, 0.45);
}

/* Mobile Responsiveness - AGGRESSIVE */
@media (max-width: 900px) {
    .login-container {
        max-width: 480px;
        flex-direction: column;
        min-height: auto;
        border-radius: 24px;
    }
    
    .login-illustration {
        display: none;
    }
    
    .login-form-area {
        padding: 40px 25px;
    }
}

/* Smart Phone Small SCREEN Optimize */
@media (max-width: 480px) {
    .login-page {
        padding: 10px;
    }

    .login-container {
        border-radius: 20px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    }

    .login-header h1 {
        font-size: 26px;
    }

    .login-form-area {
        padding: 35px 20px;
    }

    .switcher-btn {
        padding: 8px 10px;
        font-size: 12px;
    }

    .login-input {
        height: 48px;
        font-size: 14px;
    }

    .login-btn {
        height: 50px;
        font-size: 15px;
    }
}


/* Additional Utility Classes */
.bg-light-danger { 
    background-color: #fff5f5 !important; 
}
.badge-danger-solid { 
    background-color: #e3342f !important; 
    color: #fff !important; 
}
.icon-circle.bg-danger {
    background-color: #e74a3b !important;
}
/* Login Responsiveness Overrides */
@media (max-width: 576px) {
    .login-container {
        border-radius: 20px;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    }
    
    .login-form-area {
        padding: 30px 25px; /* Reduced for mobile */
    }
    
    .login-header h1 {
        font-size: 24px; /* Slightly smaller for mobile height */
    }

    .login-header p {
        margin-bottom: 15px;
    }
    
    .login-switcher {
        margin-bottom: 20px;
    }
    
    .login-input {
        height: 46px; /* Tighter for mobile height */
    }
    
    .login-btn {
        height: 48px;
    }

    .login-footer {
        margin-top: 25px !important; /* Reduced margin */
    }
}

@media (max-height: 700px) {
    .login-container {
        transform: scale(0.9); /* Scale down if screen is too short */
    }
}

@media (max-width: 380px) {
    .login-page {
        padding: 10px;
    }
    
    .login-form-area {
        padding: 30px 20px;
    }
}

/* --- MS365 PREMIUM REDESIGN --- */

:root {
    --gradient-ngu: linear-gradient(135deg, #eb5a3c 0%, #f97316 100%);
    --gradient-idst: linear-gradient(135deg, #cc0000 0%, #ef4444 100%);
    --gradient-ttm: linear-gradient(135deg, #5dd3b6 0%, #10b981 100%);
    --gradient-ilt: linear-gradient(135deg, #1a3263 0%, #312e81 100%);
    
    --gradient-premium: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    --gradient-standart: linear-gradient(135deg, #1cc88a 0%, #13855c 100%);
    --gradient-basic: linear-gradient(135deg, #36b9cc 0%, #258391 100%);
}

.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    border-radius: 24px;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 45px 0 rgba(31, 38, 135, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.stat-card-active {
    position: relative;
    overflow: hidden;
}

.stat-card-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: currentColor;
    opacity: 0.8;
}

/* Company specific glass cards */
.card-ngu { border-left: 5px solid #eb5a3c !important; }
.card-idst { border-left: 5px solid #cc0000 !important; }
.card-ttm { border-left: 5px solid #5dd3b6 !important; }
.card-ilt { border-left: 5px solid #1a3263 !important; }

/* Active states for company cards */
.active-ngu { background: var(--gradient-ngu) !important; color: white !important; }
.active-idst { background: var(--gradient-idst) !important; color: white !important; }
.active-ttm { background: var(--gradient-ttm) !important; color: white !important; }
.active-ilt { background: var(--gradient-ilt) !important; color: white !important; }

.active-ngu .stat-label, .active-ngu .stat-value, .active-ngu i,
.active-idst .stat-label, .active-idst .stat-value, .active-idst i,
.active-ttm .stat-label, .active-ttm .stat-value, .active-ttm i,
.active-ilt .stat-label, .active-ilt .stat-value, .active-ilt i {
    color: white !important;
}

.active-ngu .stat-icon-box,
.active-idst .stat-icon-box,
.active-ttm .stat-icon-box,
.active-ilt .stat-icon-box {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* License Modern Cards */
.license-card {
    border-radius: 20px;
    padding: 1.5rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.license-premium { background: var(--gradient-premium); }
.license-standart { background: var(--gradient-standart); }
.license-basic { background: var(--gradient-basic); }

.license-card i {
    font-size: 4rem;
    position: absolute;
    right: -10px;
    bottom: -10px;
    opacity: 0.15;
    transform: rotate(-15deg);
}

.license-content {
    position: relative;
    z-index: 1;
}

.license-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.license-stats {
    font-size: 1.5rem;
    font-weight: 800;
}

.license-available {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.8;
}

/* Modern Ticket List Redesign */
.ticket-list-modern {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0.5rem;
}

.ticket-modern-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.25rem;
}

.ticket-modern-card:hover {
    transform: translateY(-5px) scale(1.005);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
}

.ticket-card-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.ticket-card-title-group {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}

.ticket-icon-circle {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.ticket-modern-card:hover .ticket-icon-circle {
    transform: rotate(5deg) scale(1.1);
    background: #fff;
}

.ticket-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    line-height: 1.4;
    text-decoration: none !important;
}

.ticket-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 1.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-divider {
    color: #cbd5e1;
    font-size: 1rem;
    line-height: 1;
}

.queue-badge-premium {
    background: var(--primary-gradient);
    color: white;
    padding: 6px 14px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.75rem;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
    display: inline-flex;
    align-items: center;
}

.ticket-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1.25rem;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.ticket-footer-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.footer-meta-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    padding: 6px 12px;
    border-radius: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.footer-meta-item:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--primary);
}

.footer-meta-item i {
    font-size: 0.95rem;
    margin-right: 0.5rem;
}

.badge-soft-overdue {
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #ffe4e6;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
