/* =================== MOBILE OPTIMIZATION CSS v2.0 =================== */
/* Optimasi komprehensif untuk performa dan responsifitas mobile */

/* =================== CRITICAL MOBILE RESETS =================== */
@media (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: rgba(0,0,0,0.1) !important;
        -webkit-font-smoothing: antialiased;
        -webkit-text-size-adjust: 100%;
    }

    html, body {
        width: 100vw !important;
        height: 100vh !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-user-select: text;
        user-select: text;
    }

    body {
        font-size: 16px; /* Prevent zoom on input focus */
        line-height: 1.5;
    }

    /* Prevent layout shift */
    ::-webkit-scrollbar {
        width: 6px;
    }

    ::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    ::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 3px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
}

/* =================== MOBILE PERFORMANCE OPTIMIZATIONS =================== */
@media (max-width: 768px) {
    /* Disable expensive animations on mobile */
    * {
        animation-duration: 0.2s !important;
    }

    @media (prefers-reduced-motion: reduce) {
        * {
            animation: none !important;
            transition: none !important;
        }
    }

    /* Optimize images for mobile */
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }

    /* GPU acceleration untuk scroll smooth */
    .table-wrapper,
    .main-content,
    .left-panel,
    .right-panel,
    .cart-body {
        -webkit-overflow-scrolling: touch;
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }

    /* Optimize transitions */
    button, a, .btn {
        transition: background-color 0.2s ease, opacity 0.2s ease;
    }
}

/* =================== HEADER MOBILE OPTIMIZATION =================== */
@media (max-width: 768px) {
    .header {
        padding: 10px 12px !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
        min-height: auto !important;
    }

    .logo-container {
        gap: 8px !important;
        flex-shrink: 0;
    }

    .logo {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
    }

    .logo i {
        font-size: 24px !important;
    }

    .logo-text h1 {
        font-size: 1rem !important;
        margin-bottom: 2px !important;
    }

    .logo-text h2 {
        font-size: 0.65rem !important;
    }

    .version-badge {
        display: none !important;
    }

    .user-panel {
        width: 100% !important;
        order: 3 !important;
        margin-top: 8px !important;
        gap: 8px !important;
        flex-wrap: wrap !important;
    }

    .quick-stats {
        flex: 1 !important;
        min-width: 150px !important;
        padding: 6px 10px !important;
        gap: 6px !important;
        font-size: 0.65rem !important;
    }

    .user-info {
        padding: 6px 12px !important;
        gap: 8px !important;
        min-height: 36px !important;
    }

    .user-avatar {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.9rem !important;
        border-width: 1px !important;
    }
}

/* =================== MENU BAR MOBILE OPTIMIZATION =================== */
@media (max-width: 768px) {
    .menu-bar {
        padding: 0 !important;
        gap: 0 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        top: auto !important;
        flex-wrap: nowrap !important;
        height: auto !important;
        min-height: 50px !important;
        background: linear-gradient(to right, var(--sidebar), #334155) !important;
        position: relative !important;
        scrollbar-width: thin !important;
        scrollbar-color: rgba(255,255,255,0.3) rgba(0,0,0,0) !important;
    }

    /* Webkit scrollbar styling */
    .menu-bar::-webkit-scrollbar {
        height: 4px !important;
    }

    .menu-bar::-webkit-scrollbar-track {
        background: rgba(0,0,0,0.1) !important;
    }

    .menu-bar::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.3) !important;
        border-radius: 2px !important;
    }

    .menu-bar::-webkit-scrollbar-thumb:hover {
        background: rgba(255,255,255,0.5) !important;
    }

    .menu-btn {
        padding: 12px 14px !important;
        font-size: 0.7rem !important;
        min-width: 80px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        background: none !important;
        color: white !important;
        transition: all 0.2s ease !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        position: relative !important;
        margin: 0 !important;
        border-bottom: 3px solid transparent !important;
        text-align: center !important;
    }

    .menu-btn:hover {
        background: rgba(255,255,255,0.1) !important;
        border-bottom-color: rgba(255,255,255,0.5) !important;
    }

    .menu-btn.active {
        background: rgba(255,255,255,0.15) !important;
        border-bottom-color: #FFD700 !important;
        color: #FFD700 !important;
    }

    .menu-btn i {
        font-size: 14px !important;
        flex-shrink: 0 !important;
    }

    .menu-btn::before {
        display: none !important;
    }

    .badge {
        font-size: 0.45rem !important;
        padding: 2px 3px !important;
        min-width: 12px !important;
        position: absolute !important;
        top: 2px !important;
        right: 2px !important;
        background: #FF3E6D !important;
        color: white !important;
        border-radius: 3px !important;
    }

    /* Scroll hint indicator for hidden menu items */
    .menu-bar::after {
        content: "" !important;
        position: absolute !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 30px !important;
        background: linear-gradient(to right, transparent, rgba(0,0,0,0.2)) !important;
        pointer-events: none !important;
        z-index: 5 !important;
    }

    /* Menu scroll arrow buttons for Android compatibility */
    .menu-scroll-arrow {
        position: absolute !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        border: none !important;
        border-radius: 50% !important;
        background: rgba(255, 215, 0, 0.9) !important;
        color: #2F1C6A !important;
        font-size: 16px !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.2s ease !important;
        z-index: 10 !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
    }

    .menu-scroll-arrow:hover {
        background: #FFD700 !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
        transform: translateY(-50%) scale(1.1) !important;
    }

    .menu-scroll-arrow:active {
        transform: translateY(-50%) scale(0.95) !important;
    }

    .menu-scroll-left {
        left: 0 !important;
        margin-left: 4px !important;
    }

    .menu-scroll-right {
        right: 0 !important;
        margin-right: 4px !important;
    }

    .menu-scroll-arrow i {
        font-size: 14px !important;
    }
}

/* Portrait mode optimization - more compact */
@media (max-width: 480px) {
    .menu-bar {
        min-height: 48px !important;
        padding: 0 !important;
    }

    .menu-btn {
        padding: 10px 12px !important;
        font-size: 0.65rem !important;
        min-width: 72px !important;
    }

    .menu-btn i {
        font-size: 12px !important;
    }

    .badge {
        font-size: 0.4rem !important;
        padding: 1px 2px !important;
        min-width: 10px !important;
    }
}

/* =================== MAIN CONTENT MOBILE OPTIMIZATION =================== */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr !important;
        padding: 10px !important;
        gap: 10px !important;
        width: 100vw !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .left-panel {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 10px !important;
    }

    .right-panel {
        width: 100% !important;
        max-width: 100% !important;
        gap: 0px !important;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 8px !important;
        gap: 8px !important;
        grid-template-columns: 1fr !important;
    }

    .left-panel {
        display: none !important;
    }

    .right-panel {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        gap: 0px !important;
    }
}

/* =================== DASHBOARD CARDS MOBILE OPTIMIZATION =================== */
@media (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        margin-bottom: 10px !important;
        width: 100% !important;
    }

    .card {
        padding: 12px !important;
        border-radius: 8px !important;
        min-height: auto !important;
    }

    .card::before {
        width: 3px !important;
    }

    .card-icon {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        margin-bottom: 10px !important;
        font-size: 20px !important;
    }

    .card-title {
        font-size: 0.75rem !important;
        margin-bottom: 6px !important;
    }

    .card-value {
        font-size: 1.3rem !important;
        margin-bottom: 4px !important;
    }

    .card-trend {
        font-size: 0.65rem !important;
    }
}

@media (max-width: 480px) {
    .dashboard-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 8px !important;
    }

    .card {
        padding: 10px !important;
        border-radius: 6px !important;
    }

    .card-icon {
        width: 35px !important;
        height: 35px !important;
        margin-bottom: 8px !important;
        font-size: 18px !important;
    }

    .card-title {
        font-size: 0.7rem !important;
        margin-bottom: 4px !important;
        line-height: 1.2 !important;
    }

    .card-value {
        font-size: 1.2rem !important;
    }
}

/* =================== TABLE MOBILE OPTIMIZATION =================== */
@media (max-width: 768px) {
    .table-container {
        border-radius: 8px !important;
        overflow: hidden !important;
        min-height: 300px !important;
        max-height: calc(100vh - 300px) !important;
    }

    .table-header {
        padding: 12px !important;
        font-size: 0.9rem !important;
    }

    .table-wrapper {
        overflow-x: auto !important;
        overflow-y: auto !important;
        max-height: calc(100vh - 350px) !important;
        -webkit-overflow-scrolling: touch !important;
    }

    table {
        font-size: 0.8rem !important;
        min-width: 100% !important;
    }

    th {
        padding: 10px 8px !important;
        font-size: 0.75rem !important;
        white-space: nowrap !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
    }

    td {
        padding: 10px 8px !important;
        font-size: 0.8rem !important;
    }

    /* Hide less important columns on mobile */
    th:nth-child(n+4),
    td:nth-child(n+4) {
        display: none !important;
    }

    /* Responsive column width */
    th:nth-child(1),
    td:nth-child(1) {
        width: 35% !important;
        min-width: 100px !important;
    }

    th:nth-child(2),
    td:nth-child(2) {
        width: 30% !important;
        min-width: 80px !important;
    }

    th:nth-child(3),
    td:nth-child(3) {
        width: 35% !important;
        min-width: 90px !important;
    }
}

@media (max-width: 480px) {
    .table-container {
        max-height: calc(100vh - 280px) !important;
        min-height: 250px !important;
    }

    .table-header {
        padding: 10px !important;
        font-size: 0.85rem !important;
    }

    .table-wrapper {
        max-height: calc(100vh - 320px) !important;
    }

    table {
        font-size: 0.75rem !important;
    }

    th {
        padding: 8px 6px !important;
        font-size: 0.7rem !important;
    }

    td {
        padding: 8px 6px !important;
        font-size: 0.75rem !important;
    }

    th:nth-child(n+3),
    td:nth-child(n+3) {
        display: none !important;
    }

    th:nth-child(1),
    td:nth-child(1) {
        width: 50% !important;
        min-width: 80px !important;
    }

    th:nth-child(2),
    td:nth-child(2) {
        width: 50% !important;
        min-width: 80px !important;
    }
}

/* =================== TRANSACTION FORM MOBILE OPTIMIZATION =================== */
@media (max-width: 768px) {
    .transaction-form {
        padding: 12px !important;
        border-radius: 6px !important;
        margin-bottom: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .form-group {
        margin-bottom: 10px !important;
    }

    .form-group label {
        font-size: 0.85rem !important;
        margin-bottom: 4px !important;
        font-weight: 500 !important;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 8px !important;
        font-size: 16px !important; /* Prevent zoom on iOS */
        border-radius: 4px !important;
        height: 40px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .form-group textarea {
        height: auto !important;
        min-height: 60px !important;
    }

    .form-row {
        display: flex !important;
        gap: 8px !important;
        margin-bottom: 10px !important;
        flex-wrap: wrap !important;
    }

    .form-row .form-group {
        flex: 1;
        min-width: 100px !important;
        margin-bottom: 0 !important;
    }
}

@media (max-width: 480px) {
    .transaction-form {
        padding: 10px !important;
        border-radius: 4px !important;
        margin-bottom: 8px !important;
    }

    .form-group {
        margin-bottom: 8px !important;
    }

    .form-group label {
        font-size: 0.8rem !important;
        margin-bottom: 3px !important;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 9px 6px !important;
        font-size: 16px !important;
        height: 38px !important;
    }

    .form-row {
        gap: 6px !important;
        margin-bottom: 8px !important;
    }

    .form-row .form-group {
        min-width: 80px !important;
    }
}

/* =================== CART CONTAINER MOBILE OPTIMIZATION =================== */
@media (max-width: 768px) {
    .cart-container {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: calc(100vh - 400px) !important;
        border-radius: 8px !important;
        margin-top: 10px !important;
    }

    .cart-header {
        padding: 12px !important;
        font-size: 0.9rem !important;
    }

    .cart-body {
        flex: 1 !important;
        overflow-y: auto !important;
        min-height: 200px !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .cart-item {
        padding: 10px 8px !important;
        border-radius: 4px !important;
        margin-bottom: 8px !important;
        font-size: 0.8rem !important;
    }

    .cart-footer {
        padding: 12px !important;
        gap: 8px !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .btn-pay,
    .btn-clear {
        padding: 10px 12px !important;
        font-size: 0.85rem !important;
        height: 40px !important;
        width: 100% !important;
        border-radius: 4px !important;
    }
}

@media (max-width: 480px) {
    .cart-container {
        max-height: none !important;
        margin-top: 8px !important;
        flex-shrink: 0 !important;
    }

    .cart-header {
        padding: 10px !important;
        font-size: 0.85rem !important;
    }

    .cart-body {
        min-height: auto !important;
        max-height: 40vh !important;
    }

    .cart-item {
        padding: 8px 6px !important;
        margin-bottom: 6px !important;
        font-size: 0.75rem !important;
    }

    .cart-footer {
        padding: 10px !important;
        gap: 6px !important;
    }

    .btn-pay,
    .btn-clear {
        padding: 9px 10px !important;
        font-size: 0.8rem !important;
        height: 38px !important;
    }
}

/* =================== BUTTON OPTIMIZATION =================== */
@media (max-width: 768px) {
    .btn {
        padding: 10px 12px !important;
        font-size: 0.85rem !important;
        border-radius: 4px !important;
        min-height: 40px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .btn i {
        font-size: 0.9rem !important;
        flex-shrink: 0 !important;
    }

    /* Primary button */
    .btn-primary {
        background: linear-gradient(135deg, #2F1C6A 0%, #673DE6 100%) !important;
        color: white !important;
        border: none !important;
    }

    .btn-primary:hover,
    .btn-primary:active {
        opacity: 0.9 !important;
        transform: none !important;
    }

    /* Secondary button */
    .btn-secondary {
        background: #f0f0f0 !important;
        color: #333 !important;
        border: 1px solid #ddd !important;
    }

    .btn-secondary:hover,
    .btn-secondary:active {
        background: #e0e0e0 !important;
    }

    /* Danger button */
    .btn-danger {
        background: #FF3E6D !important;
        color: white !important;
        border: none !important;
    }

    .btn-danger:hover,
    .btn-danger:active {
        opacity: 0.9 !important;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 9px 10px !important;
        font-size: 0.75rem !important;
        min-height: 36px !important;
        gap: 4px !important;
    }

    .btn i {
        font-size: 0.85rem !important;
    }

    .btn span {
        display: inline !important;
    }
}

/* =================== MODAL OPTIMIZATION =================== */
@media (max-width: 768px) {
    .modal-content {
        width: 95vw !important;
        max-height: 95vh !important;
        border-radius: 12px !important;
        max-width: calc(100vw - 20px) !important;
    }

    .modal-header {
        padding: 15px !important;
        font-size: 0.95rem !important;
    }

    .modal-body {
        padding: 15px !important;
        font-size: 0.85rem !important;
        max-height: calc(95vh - 100px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .modal-footer {
        padding: 12px !important;
        gap: 8px !important;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 100vw !important;
        height: 100vh !important;
        border-radius: 0 !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
    }

    .modal-header {
        padding: 12px !important;
        font-size: 0.9rem !important;
    }

    .modal-body {
        padding: 12px !important;
        font-size: 0.8rem !important;
        max-height: calc(100vh - 80px) !important;
    }
}

/* =================== INPUT FOCUS FIX (PREVENT ZOOM) =================== */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 10px 8px !important;
        border-radius: 4px !important;
        min-height: 40px !important;
    }

    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="number"]:focus,
    input[type="tel"]:focus,
    input[type="date"]:focus,
    select:focus,
    textarea:focus {
        outline: none !important;
        border-color: #673DE6 !important;
        box-shadow: 0 0 0 2px rgba(103, 61, 230, 0.1) !important;
    }
}

/* =================== SEARCH CONTAINER MOBILE =================== */
@media (max-width: 768px) {
    .search-container {
        padding: 12px !important;
        border-radius: 6px !important;
        margin-bottom: 10px !important;
    }

    .search-box {
        gap: 8px !important;
        flex-wrap: wrap !important;
    }

    .search-input {
        flex: 1 !important;
        min-width: 150px !important;
        padding: 10px 8px !important;
        font-size: 14px !important;
        height: 40px !important;
    }

    .search-btn {
        padding: 10px 12px !important;
        font-size: 0.85rem !important;
        min-height: 40px !important;
    }
}

/* =================== SECTION TITLE MOBILE =================== */
@media (max-width: 768px) {
    .section-title {
        font-size: 1rem !important;
        padding-bottom: 8px !important;
        margin-bottom: 10px !important;
        gap: 8px !important;
    }

    .section-title i {
        font-size: 1.1rem !important;
    }
}

@media (max-width: 480px) {
    .section-title {
        font-size: 0.95rem !important;
        padding-bottom: 6px !important;
        margin-bottom: 8px !important;
    }
}

/* =================== NOTIFICATION MOBILE =================== */
@media (max-width: 768px) {
    .notification {
        top: auto !important;
        bottom: 80px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: calc(100vw - 20px) !important;
        border-radius: 6px !important;
        padding: 12px 15px !important;
        font-size: 0.85rem !important;
    }

    .notification i {
        font-size: 1rem !important;
        margin-right: 8px !important;
    }
}

/* =================== DROPDOWN MENU FIX =================== */
@media (max-width: 768px) {
    .dropdown-menu,
    .suggestions-dropdown,
    .customer-dropdown {
        max-height: 200px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        z-index: 10000 !important;
    }

    .dropdown-item {
        padding: 10px 8px !important;
        font-size: 0.8rem !important;
        min-height: 36px !important;
    }
}

/* =================== BOTTOM SPACING (FOR MOBILE NAVIGATION) =================== */
@media (max-width: 768px) {
    .main-content {
        padding-bottom: 20px !important;
    }

    /* Extra space at bottom for floating buttons */
    body::after {
        content: '';
        display: block;
        height: 80px;
    }
}

/* =================== FIX STICKY ELEMENTS =================== */
@media (max-width: 768px) {
    .sticky-header,
    th {
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
        background: var(--gradient-primary) !important;
    }

    .menu-bar {
        position: sticky !important;
        top: 80px !important;
        z-index: 99 !important;
    }
}

/* =================== PRINT OPTIMIZATION =================== */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
    }

    .header,
    .menu-bar,
    .btn,
    .cart-container,
    .transaction-form,
    #manualSyncBtn,
    #syncStatusIndicator {
        display: none !important;
    }

    .main-content {
        padding: 0 !important;
        gap: 0 !important;
    }

    .table-container {
        box-shadow: none !important;
        page-break-inside: avoid !important;
    }

    table {
        border-collapse: collapse !important;
    }

    th, td {
        border: 1px solid black !important;
        padding: 8px !important;
    }
}

/* =================== LANDSCAPE MODE =================== */
@media (max-width: 1024px) and (orientation: landscape) {
    .header {
        padding: 8px 10px !important;
    }

    .logo {
        width: 40px !important;
        height: 40px !important;
    }

    .menu-bar {
        padding: 6px 8px !important;
    }

    .main-content {
        padding: 8px !important;
        gap: 8px !important;
    }

    .dashboard-cards {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 8px !important;
    }

    .card {
        padding: 10px !important;
    }

    .card-value {
        font-size: 1.2rem !important;
    }

    .table-container {
        min-height: auto !important;
        max-height: calc(100vh - 200px) !important;
    }
}

/* =================== HAMBURGER MENU (MOBILE ONLY) =================== */
@media (max-width: 768px) {
    /* Hamburger button styling */
    .hamburger-btn {
        display: flex !important;
        flex-direction: column !important;
        gap: 5px !important;
        background: none !important;
        border: none !important;
        cursor: pointer !important;
        padding: 8px !important;
        position: absolute !important;
        right: 12px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        z-index: 2000 !important;
    }

    .hamburger-btn span {
        display: block !important;
        width: 24px !important;
        height: 3px !important;
        background: white !important;
        border-radius: 2px !important;
        transition: all 0.3s ease !important;
    }

    /* Hamburger active state */
    .hamburger-btn.active span:nth-child(1) {
        transform: rotate(45deg) translateY(10px) !important;
    }

    .hamburger-btn.active span:nth-child(2) {
        opacity: 0 !important;
    }

    .hamburger-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translateY(-10px) !important;
    }

    /* Hidden menu bar (default state) */
    .menu-bar.hidden {
        display: none !important;
    }

    /* Menu bar visible in mobile drawer style */
    .menu-bar.mobile-drawer {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: auto !important;
        max-height: calc(100vh - 120px) !important;
        flex-direction: column !important;
        flex-wrap: wrap !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        z-index: 1999 !important;
        border-top: 1px solid rgba(255,255,255,0.2) !important;
        background: linear-gradient(180deg, var(--sidebar), #1a1a3a) !important;
        animation: slideUp 0.3s ease-out !important;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%) !important;
            opacity: 0 !important;
        }
        to {
            transform: translateY(0) !important;
            opacity: 1 !important;
        }
    }

    /* Menu buttons in drawer */
    .menu-bar.mobile-drawer .menu-btn {
        width: 100% !important;
        min-width: unset !important;
        padding: 14px 16px !important;
        text-align: left !important;
        border-radius: 0 !important;
        border-bottom: 1px solid rgba(255,255,255,0.1) !important;
        border-right-color: transparent !important;
        margin: 0 !important;
        justify-content: flex-start !important;
        gap: 12px !important;
    }

    .menu-bar.mobile-drawer .menu-btn:hover {
        background: rgba(255,255,255,0.1) !important;
    }

    .menu-bar.mobile-drawer .menu-btn.active {
        background: rgba(255,215,0,0.15) !important;
        border-left: 4px solid #FFD700 !important;
        padding-left: 12px !important;
    }

    /* Hide scroll arrows in mobile drawer mode */
    .menu-bar.mobile-drawer .menu-scroll-arrow {
        display: none !important;
    }

    /* Backdrop overlay */
    .hamburger-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(0,0,0,0.4) !important;
        z-index: 1998 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: opacity 0.3s ease !important;
    }

    .hamburger-overlay.active {
        opacity: 1 !important;
        pointer-events: all !important;
    }

    /* Logo container adjustment for hamburger button */
    .logo-container {
        position: relative !important;
        flex-wrap: nowrap !important;
    }
}

@media (max-width: 480px) {
    .hamburger-btn {
        right: 8px !important;
        padding: 6px !important;
    }

    .hamburger-btn span {
        width: 20px !important;
        height: 2px !important;
    }

    .menu-bar.mobile-drawer {
        max-height: calc(100vh - 100px) !important;
    }

    .menu-bar.mobile-drawer .menu-btn {
        padding: 12px 14px !important;
        font-size: 0.75rem !important;
    }
}

/* =================== ACCESSIBILITY =================== */
@media (max-width: 768px) {
    button, a, input, select, textarea {
        -webkit-user-select: none;
        user-select: none;
    }

    button:focus,
    a:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline: 2px solid #673DE6 !important;
        outline-offset: 2px !important;
    }

    /* Visible focus ring */
    :focus-visible {
        outline: 2px solid #673DE6 !important;
        outline-offset: 2px !important;
    }
}

/* =================== SMOOTH SCROLLING =================== */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }

    * {
        -webkit-scrolling-touch: auto;
    }
}

/* =================== ENHANCED MOBILE LAYOUT IMPROVEMENTS v3.0 =================== */
/* Tampilan mobile lebih mirip desktop dengan layout side-by-side */

/* Tablet devices (600px - 1024px) - Dual panel layout */
@media (min-width: 600px) and (max-width: 1024px) {
    body {
        display: flex;
        flex-direction: column;
        height: 100vh;
    }

    .header {
        flex-shrink: 0;
        z-index: 1000;
    }

    .menu-bar {
        flex-shrink: 0;
        z-index: 999;
    }

    .main-wrapper {
        display: flex;
        flex: 1;
        overflow: hidden;
        gap: 0;
    }

    .left-panel {
        width: 45% !important;
        min-width: 300px;
        max-width: 500px;
        overflow-y: auto;
        border-right: 1px solid #e0e0e0;
        padding: 15px !important;
        background: #f9f9f9;
    }

    .main-content {
        flex: 1;
        overflow-y: auto;
        padding: 15px !important;
    }

    .right-panel {
        width: 30% !important;
        min-width: 250px;
        overflow-y: auto;
        border-left: 1px solid #e0e0e0;
        padding: 15px !important;
        background: #fafafa;
    }

    /* Dashboard cards in 3 columns for tablet */
    .dashboard-cards {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
    }

    /* Table responsive for tablet */
    th:nth-child(n+5),
    td:nth-child(n+5) {
        display: none !important;
    }

    /* Form fields lebih rapi */
    .form-group {
        margin-bottom: 12px !important;
    }

    input, select, textarea {
        font-size: 15px !important;
        padding: 10px !important;
    }

    /* Buttons lebih besar */
    button {
        padding: 10px 18px !important;
        font-size: 0.9rem !important;
    }

    /* Cart responsive */
    .cart-item {
        padding: 10px !important;
        font-size: 0.85rem !important;
    }
}

/* Large tablet / Small laptop (1025px - 1200px) - Almost desktop */
@media (min-width: 1025px) and (max-width: 1200px) {
    .left-panel {
        width: 40% !important;
    }

    .main-content {
        flex: 1;
    }

    .right-panel {
        width: 35% !important;
    }

    /* Dashboard cards 4 columns */
    .dashboard-cards {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    /* Show more table columns */
    th:nth-child(n+6),
    td:nth-child(n+6) {
        display: none !important;
    }
}

/* Small mobile optimization (320px - 480px) */
@media (max-width: 480px) {
    .main-wrapper {
        flex-direction: column;
    }

    .left-panel {
        width: 100% !important;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .main-content {
        flex: 1;
        width: 100%;
    }

    .right-panel {
        width: 100% !important;
        border-left: none;
        border-top: 1px solid #e0e0e0;
        max-height: 50vh;
    }

    /* Vertical stacking untuk kartus dashboard */
    .dashboard-cards {
        grid-template-columns: 1fr !important;
    }

    /* Buttons lebih kecil untuk layar kecil */
    button {
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
    }

    /* Tabel hanya 2-3 kolom */
    th:nth-child(n+3),
    td:nth-child(n+3) {
        display: none !important;
    }
}

/* =================== IMPROVED MENU & NAVIGATION =================== */
/* Menu yang lebih responsive */
@media (max-width: 768px) {
    .menu-bar {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 8px 0;
        background: linear-gradient(to right, #2F1C6A, #1a1a3a);
        border-bottom: 2px solid #673DE6;
    }

    .menu-btn {
        flex: 0 0 auto;
        min-width: 70px;
        padding: 10px 12px;
        text-align: center;
        transition: all 0.3s ease;
        position: relative;
    }

    .menu-btn:hover {
        background: rgba(255, 255, 255, 0.15);
        transform: translateY(-2px);
    }

    .menu-btn.active {
        background: rgba(103, 61, 230, 0.3);
        border-bottom: 3px solid #FFD700;
        color: #FFD700;
    }

    /* Badge styling */
    .badge {
        position: absolute;
        top: 5px;
        right: 5px;
        background: #FF3E6D;
        color: white;
        border-radius: 50%;
        width: 18px;
        height: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.65rem;
        font-weight: bold;
    }
}

/* =================== IMPROVED CARD LAYOUT =================== */
@media (max-width: 768px) {
    .dashboard-cards {
        gap: 10px !important;
        margin-bottom: 15px !important;
    }

    .card {
        border-radius: 10px;
        padding: 12px;
        background: white;
        border: 1px solid #e0e0e0;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        transition: all 0.3s ease;
    }

    .card:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        transform: translateY(-2px);
    }

    .card-icon {
        font-size: 24px;
        margin-bottom: 8px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        background: rgba(103, 61, 230, 0.1);
    }

    .card-title {
        font-size: 0.75rem;
        color: #666;
        margin-bottom: 6px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .card-value {
        font-size: 1.5rem;
        font-weight: 700;
        color: #2F1C6A;
        margin-bottom: 4px;
    }

    .card-trend {
        font-size: 0.65rem;
        color: #999;
    }
}

/* =================== IMPROVED FORM STYLING =================== */
@media (max-width: 768px) {
    .form-group {
        margin-bottom: 12px;
    }

    .form-group label {
        display: block;
        margin-bottom: 6px;
        font-weight: 500;
        color: #333;
        font-size: 0.9rem;
    }

    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        width: 100%;
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 6px;
        font-size: 16px; /* Prevents zoom on iOS */
        font-family: inherit;
        background: white;
        transition: all 0.3s ease;
    }

    input:focus,
    select:focus,
    textarea:focus {
        border-color: #673DE6;
        box-shadow: 0 0 0 3px rgba(103, 61, 230, 0.1);
        outline: none;
    }

    /* Button styling improvements */
    button {
        border: none;
        border-radius: 6px;
        padding: 10px 16px;
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-height: 40px;
    }

    .btn-primary {
        background: linear-gradient(135deg, #673DE6 0%, #2F1C6A 100%);
        color: white;
    }

    .btn-primary:hover {
        box-shadow: 0 4px 12px rgba(103, 61, 230, 0.3);
        transform: translateY(-2px);
    }

    .btn-secondary {
        background: #f0f0f0;
        color: #333;
    }

    .btn-secondary:hover {
        background: #e0e0e0;
    }

    .btn-success {
        background: #00D98B;
        color: white;
    }

    .btn-danger {
        background: #FF3E6D;
        color: white;
    }
}

/* =================== IMPROVED TABLE STYLING =================== */
@media (max-width: 768px) {
    table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.8rem;
    }

    thead {
        background: linear-gradient(135deg, #2F1C6A 0%, #673DE6 100%);
        color: white;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    th {
        padding: 10px;
        text-align: left;
        font-weight: 600;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    tbody tr {
        border-bottom: 1px solid #e0e0e0;
        transition: all 0.2s ease;
    }

    tbody tr:hover {
        background: rgba(103, 61, 230, 0.05);
    }

    td {
        padding: 10px;
        color: #333;
    }

    /* Alternating row colors */
    tbody tr:nth-child(even) {
        background: #f9f9f9;
    }

    tbody tr:nth-child(even):hover {
        background: rgba(103, 61, 230, 0.08);
    }
}

/* =================== IMPROVED MODAL STYLING =================== */
@media (max-width: 768px) {
    .modal {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 10000;
    }

    .modal-content {
        width: 90%;
        max-width: 500px;
        max-height: 90vh;
        overflow-y: auto;
        background: white;
        border-radius: 12px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.2);
        animation: slideUp 0.3s ease;
    }

    @keyframes slideUp {
        from {
            transform: translateY(30px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    .modal-header {
        padding: 15px;
        border-bottom: 1px solid #e0e0e0;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .modal-header h5 {
        margin: 0;
        font-size: 1.1rem;
        color: #2F1C6A;
    }

    .modal-body {
        padding: 15px;
        max-height: calc(90vh - 120px);
        overflow-y: auto;
    }

    .modal-footer {
        padding: 15px;
        border-top: 1px solid #e0e0e0;
        display: flex;
        gap: 10px;
        justify-content: flex-end;
    }
}

/* =================== IMPROVED NOTIFICATION STYLING =================== */
@media (max-width: 768px) {
    .notification {
        position: fixed;
        top: 60px;
        right: 12px;
        left: 12px;
        padding: 12px;
        border-radius: 8px;
        margin-bottom: 10px;
        z-index: 10001;
        animation: slideIn 0.3s ease;
    }

    @keyframes slideIn {
        from {
            transform: translateX(400px);
            opacity: 0;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }

    .notification.success {
        background: #d4edda;
        color: #155724;
        border: 1px solid #c3e6cb;
    }

    .notification.error {
        background: #f8d7da;
        color: #721c24;
        border: 1px solid #f5c6cb;
    }

    .notification.info {
        background: #d1ecf1;
        color: #0c5460;
        border: 1px solid #bee5eb;
    }

    .notification.warning {
        background: #fff3cd;
        color: #856404;
        border: 1px solid #ffeeba;
    }
}

/* =================== LANDSCAPE MOBILE OPTIMIZATION =================== */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        max-height: 100vh;
        overflow: hidden;
    }

    .header {
        min-height: 50px;
    }

    .main-wrapper {
        max-height: calc(100vh - 100px);
        overflow: auto;
    }

    .left-panel,
    .main-content,
    .right-panel {
        max-height: calc(100vh - 100px);
    }

    .dashboard-cards {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 8px !important;
    }

    .card {
        padding: 8px !important;
    }

    .card-value {
        font-size: 1rem !important;
    }
}


