/* KKMP Premium Theme - Merah Putih Global */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@400;600;700;800&display=swap');

:root {
    --kkmp-red: #e63946;
    --kkmp-red-dark: #c1121f;
    --kkmp-red-light: #ff6b6b;
    --kkmp-white: #ffffff;
    --kkmp-gray: #f8f9fa;
    --kkmp-dark: #1d3557;
    --kkmp-accent: #457b9d;
    --kkmp-success: #10b981;
    --accent-cloud: #0ea5e9;
    --accent-brand: #f59e0b;
    --accent-auth: #10b981;
    --shadow-premium: 0 10px 30px rgba(0, 0, 0, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

html { 
    overflow-y: scroll !important; 
    scroll-behavior: smooth; 
    background-color: #f8f9fa !important;  /* CRITICAL: Prevents white flash */
}
body { 
    font-family: 'Outfit', sans-serif; 
    background-color: #f8f9fa; /* Match with HTML to blend */
    color: var(--kkmp-dark); 
    margin: 0 !important; 
    transition: opacity 0.4s ease-in-out; 
}
body.page-ready { opacity: 1 !important; }

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

/* Page Transition Helpers */
.main-content {
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.3s ease-out;
}
.main-content.fade-out {
    opacity: 0;
    transform: translateY(10px);
}

#nav-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--kkmp-red), var(--kkmp-red-light));
    z-index: 99999;
    transition: width 0.4s ease-out;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.3);
}

/* Sidebar POS Premium Modern */
.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--glass-border);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.03);
    z-index: 1040;
    padding-top: 15px;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar .brand-wrapper {
    padding: 10px 25px 25px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 15px;
}

.sidebar-brand {
    font-size: 1.1rem;
    line-height: 1.2;
    font-weight: 800;
    color: var(--kkmp-red);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar ul.nav {
    padding-left: 0;
    display: block;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
}

/* Custom Premium Scrollbar for Sidebar */
.sidebar ul.nav::-webkit-scrollbar {
    width: 5px;
}
.sidebar ul.nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar ul.nav::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}
.sidebar ul.nav:hover::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}

.sidebar .nav-item {
    margin: 4px 15px;
    list-style: none;
}

.sidebar .nav-link {
    color: var(--kkmp-dark);
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.sidebar .nav-link i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    color: #64748b;
    transition: all 0.3s ease;
}

.sidebar .nav-link:hover {
    background-color: rgba(230, 57, 70, 0.05);
    color: var(--kkmp-red);
    transform: translateX(5px);
}

.sidebar .nav-link:hover i {
    color: var(--kkmp-red);
}

.sidebar .nav-link.active {
    background: #d63031 !important; /* Merah Solid POS Profesional */
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(214, 48, 49, 0.4) !important;
}

.sidebar .nav-link.active i {
    color: #ffffff !important;
}

/* Hover state for non-active links to improve clarity */
.sidebar .nav-link:not(.active):hover {
    background-color: rgba(230, 57, 70, 0.08) !important;
    color: var(--kkmp-red) !important;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px 25px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

/* Main Content Area */
.main-content {
    margin-left: 260px; /* Lebar Sidebar */
    padding: 30px 40px !important;
    min-height: 100vh;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
    position: relative;
    z-index: 1; /* Pastikan di bawah sidebar */
}

.mobile-header { display: none; }

/* Offcanvas for Mobile */
@media (max-width: 991px) {
    .sidebar { margin-left: -280px; width: 280px; }
    .main-content { margin-left: 0; padding: 15px; padding-top: 85px; }
    
    .mobile-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 65px;
        background: white;
        box-shadow: 0 2px 15px rgba(0,0,0,0.06);
        display: flex;
        align-items: center;
        padding: 0 20px;
        z-index: 1030;
        justify-content: space-between;
    }
    
    .sidebar.show-mobile {
        margin-left: 0;
        box-shadow: 5px 0 30px rgba(0,0,0,0.15);
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(4px);
        z-index: 1035;
        display: none;
        animation: fadeIn 0.3s ease;
    }
    .sidebar-overlay.show { display: block; }
    
    /* Android-like Bottom Action for Mobile (Optional/Contextual) */
    .btn-mobile-wide { width: 100%; padding: 14px; font-size: 1.1rem; border-radius: 16px; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Touch Optimization for All Mobile Devices */
@media (max-width: 576px) {
    .card { border-radius: 16px; }
    .btn, .form-control, .form-select { min-height: 48px; font-size: 16px !important; } /* Cegah Zoom Otomatis di iOS/Android */
    .h3, h3 { font-size: 1.5rem; }
    .main-content { padding: 12px; padding-top: 80px; }
    
    /* Better spacing for mobile lists */
    .table td, .table th { padding: 12px 8px; }
}

/* Tactile Feedback for Android-like Feel */
.btn:active, .nav-link:active { transform: scale(0.96); transition: 0.1s; }
.card:active { transform: scale(0.98); }

/* Cards & Accents */
.card {
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    overflow: hidden;
    background: white;
}

.card:hover { 
    transform: translateY(-8px) scale(1.01); 
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12); 
    border-color: rgba(230, 57, 70, 0.2);
}

/* Premium Border Accents */
.card-sales, .card-cloud { border-top: 5px solid var(--accent-cloud); border-left: 1px solid rgba(14,165,233,0.1); }
.card-trans, .card-auth { border-top: 5px solid var(--kkmp-success); border-left: 1px solid rgba(16,185,129,0.1); }
.card-stock, .card-brand { border-top: 5px solid var(--accent-brand); border-left: 1px solid rgba(245,158,11,0.1); }
.card-warning { border-top: 5px solid var(--kkmp-red); border-left: 1px solid rgba(230,57,70,0.1); }

/* Quick Setup Wizard Premium */
#modalSetupWizard .modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

#modalSetupWizard .bg-danger {
    background: linear-gradient(135deg, #e63946 0%, #c1121f 100%) !important;
}

.setup-step-animate {
    animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.upload-box {
    transition: all 0.3s ease;
    border: 2px dashed #dee2e6;
}

.upload-box:hover {
    border-color: var(--kkmp-red);
    background-color: rgba(230, 57, 70, 0.05);
    transform: translateY(-2px);
}

.step-indicator-active {
    background: white !important;
    color: var(--kkmp-red) !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

/* Statistics Components */
.stat-icon-bg { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 15px; }

/* Buttons & Inputs */
.btn-kkmp { background-color: var(--kkmp-red); color: white; border: none; font-weight: 600; border-radius: 50px; transition: 0.3s; }
.btn-kkmp:hover { background-color: var(--kkmp-red-dark); transform: translateY(-2px); color: white; box-shadow: 0 5px 15px rgba(230, 57, 70, 0.2); }

/* Smooth Page Entry (tanpa flicker opacity) */
/* Body entry via inline style for flicker-free load */
body { opacity: 1; }


/* Global Utilities */
.text-kkmp { color: var(--kkmp-red); }
.bg-kkmp { background-color: var(--kkmp-red); }
.rounded-premium { border-radius: 20px; }

.glass-effect {
    background: rgba(255, 255, 255, 0.95) !important; /* Hampir solid untuk kontras maksimal */
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08) !important;
}

.btn-quick-menu {
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
}

.btn-quick-menu:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1) !important;
    filter: brightness(0.95);
}

/* CSS Khusus Cetak Struk (Thermal 58mm) */
#print-area { display: none; }

@media print {
    /* Base Reset: Hide all by default */
    body * { visibility: hidden; }

    /* Show Receipt ONLY when printing receipt */
    body.is-printing-receipt #print-area, 
    body.is-printing-receipt #print-area * { 
        visibility: visible !important; 
    }
    
    body.is-printing-receipt #print-area {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 80mm; /* Sesuai Kertas Thermal User (80mm) */
        padding: 5mm;
        background: white;
        color: black;
        font-family: 'Inter', Arial, sans-serif;
        line-height: 1.4; /* Slightly more spacing for readability */
    }
    
    .receipt-header { text-align: center; margin-bottom: 20px; }
    .receipt-header img { max-width: 65mm; filter: grayscale(100%); }
    .receipt-text { font-size: 13pt; } /* Increased base font size */
    .receipt-footer { text-align: center; font-size: 11pt; margin-top: 20px; font-style: italic; }
    
    /* Font specifically for items and prices on 80mm */
    #print-area .item-row { font-size: 12pt; }
    #print-area .total-row { font-size: 16pt; font-weight: bold; border-top: 1px dashed #000; padding-top: 8px; }
    
    /* Sembunyikan elemen UI lainnya */
    .navbar, .btn, .modal, .container, .modal-backdrop, .sidebar, .mobile-header { display: none !important; }
}

/* Table Action Buttons Premium */
.btn-action-table {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0,0,0,0.08);
    background: white;
    color: #64748b;
    font-size: 0.85rem;
}

.btn-action-table:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.btn-action-table.btn-edit:hover { color: var(--kkmp-accent); border-color: var(--kkmp-accent); background-color: rgba(69, 123, 157, 0.05); }
.btn-action-table.btn-simpanan:hover { color: var(--accent-brand); border-color: var(--accent-brand); background-color: rgba(245, 158, 11, 0.05); }
.btn-action-table.btn-card:hover { color: var(--kkmp-dark); border-color: var(--kkmp-dark); background-color: rgba(29, 53, 87, 0.05); }
.btn-action-table.btn-delete:hover { color: var(--kkmp-red); border-color: var(--kkmp-red); background-color: rgba(230, 57, 70, 0.05); }

.action-container {
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* Modal Premium Enhancements */
.modal-content {
    animation: modalSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.ls-1 { letter-spacing: 1px; }

.modal-header.bg-kkmp {
    background: linear-gradient(135deg, var(--kkmp-red) 0%, var(--kkmp-red-dark) 100%);
}

.modal .form-control:focus, .modal .form-select:focus {
    background-color: #fff !important;
    box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.1);
    border-color: var(--kkmp-red-light) !important;
}

/* Force Contrast for Danger Buttons in Premium Cards */
.btn-danger {
    background-color: #d63031 !important;
    border-color: #d63031 !important;
    color: #ffffff !important;
}

/* Utilities for Proportional Typography - Product Names */
.product-name-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b !important;
    letter-spacing: -0.1px;
    margin-bottom: 2px;
}

/* Mobile Sticky Bottom Bar (Total Display) */
.mobile-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 10px 15px 25px;
    box-shadow: 0 -10px 25px rgba(0,0,0,0.1);
    z-index: 1050;
    border-radius: 24px 24px 0 0;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.mobile-bottom-bar .total-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: #64748b;
    letter-spacing: 0.5px;
}

.mobile-bottom-bar .total-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--kkmp-red);
}

/* Optimized Mobile Grid Spacing */
@media (max-width: 991px) {
    .container-fluid { padding-left: 15px !important; padding-right: 15px !important; }
    .main-content { padding-top: 80px !important; padding-bottom: 110px !important; } /* Extra bottom for sticky bar */
    .row.g-4 { --bs-gutter-y: 1.5rem; }
    
    /* Make cart table more compact on mobile */
    .table-responsive .table { min-width: 450px; } /* Force Horizontal scroll for table table instead of squishing */
    .table-responsive::-webkit-scrollbar { height: 4px; }
    
    .card-header h5 { font-size: 1.1rem; }
    .input-group-lg { scale: 0.95; transform-origin: left; }
}

@media (max-width: 576px) {
    .mobile-header { height: 60px; }
    .mobile-header .fs-5 { font-size: 1rem !important; }
    .total-display { font-size: 1.4rem !important; }
    
    /* Better button sizing for thumbs */
    .btn-lg, .btn-primary.w-100 { padding: 15px 10px !important; font-size: 1rem !important; border-radius: 14px !important; }
}


