/* Custom Styling Premium Toko Saddar */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --surface: #f3f4f6;
    --sidebar-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--surface);
    color: var(--text-main);
    letter-spacing: -0.01em;
}

/* Glassmorphism Login */
.bg-login {
    background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 100%);
}
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
}
.shadow-premium {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
}

/* Utilities */
.shadow-primary {
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

/* Sidebar & Navigation */
.sidebar-desktop {
    border-right: 1px solid #e5e7eb;
}
.nav-menu {
    transition: all 0.2s ease;
    font-weight: 500;
}
.sidebar-desktop .nav-menu:hover {
    background-color: #f3f4f6;
    color: var(--text-main) !important;
}
.sidebar-desktop .nav-menu.active {
    background-color: #eef2ff;
    color: var(--primary) !important;
    font-weight: 600;
}
.sidebar-desktop .nav-menu.active i {
    color: var(--primary) !important;
}

/* Bottom Nav Active State (Mobile) */
.fixed-bottom .nav-menu.active {
    color: var(--primary) !important;
}
.fixed-bottom .nav-menu.active i {
    color: var(--primary) !important;
}
.fixed-bottom .nav-menu {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.fixed-bottom .nav-menu:active {
    transform: scale(0.92);
}

/* Page Views Transition */
.page-view {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Stats Dashboard */
.bg-gradient-primary { background: linear-gradient(135deg, #4f46e5, #3b82f6); }
.bg-gradient-success { background: linear-gradient(135deg, #10b981, #059669); }
.bg-gradient-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.bg-gradient-info { background: linear-gradient(135deg, #0ea5e9, #0284c7); }

.stat-card {
    transition: transform 0.3s ease;
}
.stat-card:hover {
    transform: translateY(-5px);
}
.bg-icon {
    position: absolute;
    right: -10px;
    bottom: -15px;
    font-size: 5rem;
    opacity: 0.15;
    transform: rotate(-15deg);
}

/* Tables */
.custom-table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding-top: 1rem;
    padding-bottom: 1rem;
}
.custom-table td {
    padding-top: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f3f4f6;
}

/* Kasir Grid */
.product-card {
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #ffffff;
}
.product-card:active {
    transform: scale(0.95);
}
.product-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05) !important;
    border-color: #e5e7eb !important;
    transform: translateY(-3px);
}
.product-image-placeholder {
    height: 100px;
    background: #f3f4f6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 2rem;
    margin-bottom: 10px;
}

.cart-card {
    background-color: #ffffff;
}

/* Inputs & Form */
.form-control {
    font-size: 0.95rem;
}
.form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(79, 70, 229, 0.15);
    border-color: #a5b4fc;
}
.search-bar input:focus {
    box-shadow: none;
}

/* Hide scrollbar visually but keep functionality */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Scrollbar customization */
.custom-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.custom-scroll::-webkit-scrollbar-track {
    background: transparent; 
}
.custom-scroll::-webkit-scrollbar-thumb {
    background: #d1d5db; 
    border-radius: 10px;
}
.custom-scroll::-webkit-scrollbar-thumb:hover {
    background: #9ca3af; 
}

/* Inputs without spin buttons */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield;
}

/* ==========================================
   MOBILE & TABLET RESPONSIVE
   ========================================== */

/* Bottom Nav More Popup */
#bottom-more-popup {
    position: fixed;
    bottom: calc(60px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1060;
    width: max-content;
    max-width: 200px;
}
#bottom-more-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
.popup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: -1;
}

/* Mobile Card List */
.mobile-card-list { display: none; }
.mobile-card {
    background: #fff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 12px;
    overflow: hidden;
    transition: transform 0.2s;
}
.mobile-card:active { transform: scale(0.98); }
.mobile-card .card-body { padding: 1rem; }
.mobile-card .card-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}
.mobile-card .card-text {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

/* Full-screen Modal & Table-to-Card on Mobile */
@media (max-width: 767.98px) {
    /* Hide tables, show cards */
    .table-responsive .custom-table { display: none !important; }
    .mobile-card-list { display: block !important; }

    /* Full-screen modal */
    .modal-dialog {
        margin: 0 !important;
        max-width: 100% !important;
        min-height: 100vh !important;
    }
    .modal-content {
        border-radius: 0 !important;
        min-height: 100vh !important;
        border: none !important;
    }
    .modal-body { padding: 1rem !important; }
    .modal-footer {
        padding: 1rem !important;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
    }

    /* Stat cards compact */
    .stat-card .card-body { padding: 0.75rem !important; }
    .stat-card h3 { font-size: 1rem !important; }
    .stat-card h6 { font-size: 0.7rem !important; }
    .bg-icon { font-size: 3rem !important; }

    /* Touch-friendly buttons */
    .btn { min-height: 40px; }

    /* Kasir: stack product & cart vertically */
    #view-kasir .col-md-7, #view-kasir .col-md-5 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Product grid */
    .product-card .product-image-placeholder { height: 80px; }

    /* Bottom nav items touch feedback */
    .bottom-nav-item:active { transform: scale(0.9); }

    /* Ensure page views scroll above the bottom nav */
    .page-view {
        padding-bottom: calc(75px + env(safe-area-inset-bottom)) !important;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .product-card .product-image-placeholder { height: 90px; }
}

/* Role Based Hiding */
.hidden-role {
    display: none !important;
}

/* ==========================================
   PRINTER BLUETOOTH UI (Sidebar)
   ========================================== */
#bt-icon-mobile, #bt-icon-desktop {
    transition: color 0.2s ease;
}
#bt-icon-mobile.text-success, #bt-icon-desktop.text-success {
    animation: btPulse 2s infinite;
}
@keyframes btPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
