/* ============ Aravals Shop - Custom Styles ============ */
*, *::before, *::after {
    box-sizing: border-box;
}
html, body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    position: relative;
    margin: 0;
    padding: 0;
    -webkit-text-size-adjust: 100%;
}
main {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
}

:root {
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
}

.dark {
    --bg: #0b1220;
    --card: #111a2e;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #1e293b;
}

body {
    background: var(--bg);
    color: var(--text);
}

/* Component classes */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1rem;
}

.input {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}

.input:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, .15);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    font-weight: 600;
    padding: .625rem 1.25rem;
    border-radius: .75rem;
    border: none;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 2px 8px rgba(5, 150, 105, .3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(5, 150, 105, .4);
}

.btn-primary:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: 1.5px solid #059669;
    color: #059669;
    font-weight: 600;
    padding: .625rem 1.25rem;
    border-radius: .75rem;
    cursor: pointer;
    transition: all .2s;
    background: transparent;
}

.btn-outline:hover {
    background: #ecfdf5;
}

.dark .btn-outline:hover {
    background: rgba(5, 150, 105, .1);
}

.btn-danger {
    background: #dc2626;
    color: #fff;
    font-weight: 600;
    padding: .5rem 1rem;
    border-radius: .75rem;
    border: none;
    cursor: pointer;
}

.btn-danger:hover {
    background: #b91c1c;
}

.badge {
    display: inline-flex;
    align-items: center;
    font-size: .7rem;
    font-weight: 700;
    padding: .2rem .6rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.badge-green {
    background: #d1fae5;
    color: #065f46;
}

.badge-amber {
    background: #fef3c7;
    color: #92400e;
}

.badge-red {
    background: #fee2e2;
    color: #991b1b;
}

.badge-blue {
    background: #dbeafe;
    color: #1e40af;
}

.badge-slate {
    background: #e2e8f0;
    color: #334155;
}

.dark .badge-green {
    background: rgba(16, 185, 129, .2);
    color: #6ee7b7;
}

.dark .badge-amber {
    background: rgba(245, 158, 11, .2);
    color: #fcd34d;
}

.dark .badge-red {
    background: rgba(239, 68, 68, .2);
    color: #fca5a5;
}

.dark .badge-blue {
    background: rgba(59, 130, 246, .2);
    color: #93c5fd;
}

.dark .badge-slate {
    background: rgba(100, 116, 139, .2);
    color: #cbd5e1;
}

/* Hide scrollbar for category strip */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Line clamp */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Flash animation */
.flash-msg {
    animation: flashIn .3s ease, flashOut .4s ease 3.5s forwards;
}

@keyframes flashIn {
    from {
        opacity: 0;
        transform: translate(-50%, -12px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes flashOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    background: #059669;
    color: #fff;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
    animation: toastIn .3s ease;
}

.toast.toast-error {
    background: #dc2626;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* User dropdown */
.user-menu {
    display: none;
}

.menu-open .user-menu {
    display: block;
}

/* ============ Print styles ============ */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: #fff !important;
    }

    .card {
        border: none !important;
        box-shadow: none !important;
    }
}

/* ============ Thermal receipt ============ */
.receipt-paper {
    background: #fff;
    color: #000;
    font-family: 'Courier New', monospace;
    margin: 0 auto;
    padding: 12px 8px;
}

.receipt-80 {
    width: 80mm;
}

.receipt-58 {
    width: 58mm;
    font-size: 11px;
}

.receipt-paper table {
    width: 100%;
    border-collapse: collapse;
    font-size: inherit;
}

.receipt-paper td {
    padding: 1px 0;
    vertical-align: top;
}

.receipt-dashed {
    border-top: 1px dashed #000;
    margin: 6px 0;
}

@media print {
    .receipt-paper {
        width: inherit !important;
        margin: 0;
        padding: 0;
    }

    @page {
        margin: 3mm;
    }
}

/* ============ Invoice ============ */
.invoice-sheet {
    background: #fff;
    color: #1e293b;
    max-width: 210mm;
    margin: 0 auto;
    padding: 40px;
}

@media print {
    .invoice-sheet {
        box-shadow: none !important;
        border: none !important;
    }

    @page {
        size: A4;
        margin: 0;
    }
}

/* Barcode label sheet */
.label-sheet {
    display: flex;
    flex-wrap: wrap;
    gap: 4mm;
}

.product-label {
    border: 1px solid #ddd;
    border-radius: 2mm;
    padding: 2mm 3mm;
    text-align: center;
    width: 38mm;
    break-inside: avoid;
}

@media print {
    .product-label {
        border: 1px dashed #ccc;
    }
}

/* POS terminal */
.pos-product-tile {
    cursor: pointer;
    transition: all .15s;
    border: 2px solid var(--border);
}

.pos-product-tile:hover {
    border-color: #059669;
    transform: translateY(-2px);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}

/* ============ SweetAlert2 Light & Dark Mode ============ */
.swal2-popup {
    background: #ffffff !important;
    color: #0f172a !important;
    border-radius: 1.5rem !important;
}

.swal2-title {
    color: #0f172a !important;
    font-weight: 800 !important;
}

.swal2-html-container {
    color: #1e293b !important;
}

/* When in dark mode (Night Mode) */
.dark .swal2-popup {
    background: #0f172a !important;
    color: #ffffff !important;
    border: 1px solid #334155 !important;
}

.dark .swal2-title {
    color: #ffffff !important;
}

.dark .swal2-html-container {
    color: #f1f5f9 !important;
}

/* ============ Mobile-First Responsiveness & Native App Feel ============ */
html, body {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Responsive Table Wrapper - Zero Horizontal Overflow */
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.table-responsive table {
    min-width: 600px;
    width: 100%;
}

/* Hide scrollbars on horizontal swipe shelves while preserving momentum */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

/* Responsive Image Containers */
img, video, canvas, svg {
    max-width: 100%;
    height: auto;
}

/* Mobile Sticky Bottom Navigation & Action Bar Buffers (Mobile Viewport Only: < 768px) */
@media (max-width: 767.98px) {
    .has-mobile-bottom-nav {
        padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px)) !important;
    }

    .mobile-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    /* Mobile Sticky Detail Action Bar */
    .mobile-detail-bar {
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    }
}

@media (min-width: 768px) {
    .has-mobile-bottom-nav {
        padding-bottom: 0 !important;
    }
}


@media (max-width: 640px) {
    .hero-slide img {
        object-fit: cover !important;
    }
    .card {
        border-radius: 0.875rem;
    }
}