/* 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 */
.text-theme-primary {
    color: var(--primary) !important;
}

/* Refactoring: Make all menu titles and app names follow the primary theme color */
h3.fw-bold.text-dark {
    color: var(--primary) !important;
}

.app-name-display {
    color: var(--text-main) !important;
}

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

/* Sidebar & Navigation */
.sidebar-desktop {
    border-right: 1px solid color-mix(in srgb, var(--text-muted) 20%, transparent);
}

.nav-menu {
    transition: all 0.2s ease;
    font-weight: 500;
    color: var(--text-main) !important;
}

.nav-menu i {
    color: var(--text-main) !important;
}

.sidebar-desktop .nav-menu:hover {
    background-color: color-mix(in srgb, var(--text-main) 8%, transparent);
    color: var(--text-main) !important;
}

.sidebar-desktop .nav-menu.active {
    background-color: color-mix(in srgb, var(--text-main) 12%, transparent);
    color: var(--text-main) !important;
    font-weight: 600;
}

.sidebar-desktop .nav-menu.active i {
    color: var(--text-main) !important;
}

/* Bottom Nav Active State (Mobile) */
.fixed-bottom .nav-menu.active {
    color: var(--text-main) !important;
}

.fixed-bottom .nav-menu.active i {
    color: var(--text-main) !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);
}

.bg-gradient-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.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;
}

/* Zebra striping */
.custom-table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

.custom-table tbody tr:hover {
    background-color: #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: 0.65rem 0.75rem;
}

.mobile-card .card-title {
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.mobile-card .card-text {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.15rem;
}

.mobile-card-compact {
    padding: 0.4rem 0.55rem !important;
}

.mobile-card-compact .card-title {
    font-size: 0.8rem;
    margin-bottom: 0;
    line-height: 1.2;
}

.mobile-card-compact .mobile-kode {
    font-size: 0.65rem;
    color: #9ca3af;
    line-height: 1.2;
}

.mobile-card-compact .mobile-price {
    font-size: 0.82rem;
    font-weight: 700;
}

.mobile-card-compact .mobile-stok {
    font-size: 0.7rem;
    font-weight: 600;
}

.mobile-card-compact .btn-sm {
    padding: 0.1rem 0.3rem;
    font-size: 0.6rem;
    line-height: 1;
}

/* Compact mobile header */
@media (max-width: 767.98px) {
    .page-view>.d-flex:first-child {
        padding: 0.5rem 0.75rem !important;
        margin-bottom: 0.5rem !important;
        gap: 0.5rem !important;
    }

    .page-view h3 {
        font-size: 1rem !important;
        margin-bottom: 0 !important;
    }

    .page-view .search-bar {
        flex: 1;
        min-width: 0;
    }

    .page-view .search-bar input {
        font-size: 0.85rem;
        padding: 0.3rem 0.5rem;
    }

    .page-view .search-bar .input-group-text {
        padding: 0.3rem 0.5rem;
    }

    .page-view .btn-primary.rounded-pill.px-4 {
        padding: 0.35rem 0.75rem !important;
        font-size: 0.8rem;
    }

    .page-view .btn-outline-success.rounded-pill,
    .page-view .btn-outline-primary.rounded-pill {
        padding: 0.35rem 0.5rem !important;
        font-size: 0.8rem;
    }
}

/* 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;
    }
}

/* Refactoring: Page Header Styling */
.page-header-block {
    background-color: var(--primary) !important;
    padding: 1.5rem 2rem;
    border-radius: 1rem;
    margin-top: 0.5rem !important;
    box-shadow: 0 10px 15px -3px color-mix(in srgb, var(--primary) 30%, transparent);
}

.page-header-block h2,
.page-header-block h3 {
    color: var(--text-main) !important;
    margin-bottom: 0.25rem !important;
    font-weight: 700 !important;
}

.page-header-block p {
    color: var(--text-main) !important;
    opacity: 0.85;
    margin-bottom: 0 !important;
}