/* ============================================
   American POS - Main Stylesheet
   Extracted from index.html for optimization
   ============================================ */

/* American POS Brand Colors - Enterprise Upgrade */
:root {
    /* Enterprise Palette */
    --ent-primary: #4f46e5;
    --ent-primary-light: #6366f1;
    --ent-accent: #8b3a3a;
    --ent-accent-light: #a84a4a;

    /* Backgrounds & Glass */
    --ent-bg: #fdfdfe;
    --ent-sidebar: #01040a;
    --ent-glass: rgba(255, 255, 255, 0.85);
    --ent-glass-dark: rgba(15, 23, 42, 0.85);

    /* Cloud Shadows - Modern Premium Depth */
    --shadow-cloud: 0 20px 50px -12px rgba(0, 0, 0, 0.08);
    --shadow-cloud-lg: 0 30px 60px -12px rgba(0, 0, 0, 0.12);
    --shadow-cloud-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.03);

    /* Functional */
    --ent-success: #10b981;
    --ent-warning: #f59e0b;
    --ent-danger: #ef4444;
}

.dark {
    --ent-bg: #020617;
    --ent-sidebar: #01040a;
    --ent-glass: rgba(15, 23, 42, 0.7);
    --ent-glass-dark: rgba(2, 6, 23, 0.8);
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--ent-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark .glass-panel {
    background: var(--ent-glass-dark);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Cloud Shadow Utilities */
.shadow-cloud {
    box-shadow: var(--shadow-cloud);
}

.shadow-cloud-lg {
    box-shadow: var(--shadow-cloud-lg);
}

.shadow-cloud-inner {
    box-shadow: var(--shadow-cloud-inner);
}

.glass-nav {
    background: rgba(1, 4, 10, 0.85);
    /* Sidebar remains dark for extreme impact/contrast */
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    box-shadow: 10px 0 50px rgba(0, 0, 0, 0.1);
}

/* Impactful Nav Links */
.nav-link {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

/* Enterprise Typography & Scrollbars */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--ent-bg);
}

h1,
h2,
h3,
h4,
h5,
h6,
.brand-font {
    font-family: 'Outfit', sans-serif;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.4);
}

/* Premium Component Foundations */
.btn-enterprise {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-enterprise:active {
    transform: scale(0.97);
}

/* Mobile Performance Optimizations */
@media (max-width: 768px) {

    body,
    html {
        overflow-x: hidden;
        width: 100%;
    }

    #pos-content-wrapper {
        margin-right: 0;
    }

    #held-sales-drawer:not([style*="display: block"]),
    #held-sales-drawer:not([style*="display: flex"]) {
        display: none;
    }

    .category-btn,
    .product-card,
    a,
    button {
        touch-action: manipulation;
    }

    .product-card {
        content-visibility: auto;
        contain-intrinsic-size: 100px 150px;
    }

    /* Disable blur on mobile for performance/visual fix */
    .backdrop-blur-md,
    .backdrop-blur-sm,
    .glassmorphism {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background-color: rgba(0, 0, 0, 0.5);
        /* Solid fallback */
    }

    .dark .backdrop-blur-md,
    .dark .backdrop-blur-sm,
    .dark .glassmorphism {
        background-color: rgba(30, 41, 59, 0.95);
    }

    .content-visibility-auto {
        content-visibility: auto;
    }

    #desktop-cart-container {
        display: none;
    }
}

/* Fix for Covered Views - Elevate content above potential rogue overlays */
.view-section {
    z-index: 45;
    position: relative;
    height: 100% !important;
    width: 100% !important;
    overflow-y: auto !important;

    /* DEFAULT: Block for normal vertical scrolling (Dashboard, Sales, etc) */


    background-color: var(--bg-color, #f8fafc);
}

.dark .view-section {
    background-color: #020617;
    box-shadow: none;
}

/* Specific fix for Dashboard scrolling - ONLY when active */
#view-dashboard:not(.hidden) {
    overflow-y: auto !important;
}

/* POS LAYOUT - CRITICAL OVERRIDES - ONLY when active */
#view-pos:not(.hidden) {
    display: flex !important;
    /* Force Flex */
    flex-direction: row !important;
    /* Force Side-by-Side */
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    /* No scroll on container, children scroll */
    gap: 0 !important;
}

/* Prevent JS margin calculations from breaking layout */
main,
#main-container {
    height: 100% !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

#pos-content-wrapper {
    margin-right: 0 !important;
    flex: 1 1 auto !important;
    height: 100% !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    transition: all 0.3s ease-in-out;
}

/* Cart Container Dynamic States */
#desktop-cart-container {
    transition: width 0.3s ease-in-out, transform 0.3s ease-in-out;
}

#desktop-cart-container.cart-closed {
    width: 0 !important;
}

#desktop-cart-container.cart-closed #cart-sidebar {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateX(10px);
    /* Subtle slide out */
}

#cart-sidebar {
    transition: all 0.3s ease-in-out;
}

#main-content-area {
    flex: 1 1 auto !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
}



#product-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    gap: 1.25rem !important;
    width: 100% !important;
    padding: 1rem;
    padding-bottom: 80px;
}

/* Ensure body allows expansion */
html,
body {
    height: 100% !important;
    overflow: hidden !important;
    /* Prevent double scrollbars */
}

/* Force hidden elements to stay hidden even if JS sets inline display */


/* Default Blur Reset - Fix for Windows/Chrome rendering issues */
.backdrop-blur-sm {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Fallback Utility Classes */
.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.z-\[70\] {
    z-index: 70;
}

.flex {
    display: flex !important;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.bg-black\/60 {
    background-color: rgba(0, 0, 0, 0.6);
}



/* Price Check Modal */
#price-check-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9999;
    background-color: transparent;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#price-check-modal>div {
    background-color: #fff;
    width: 90%;
    max-width: 500px;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    position: relative;
    pointer-events: auto;
}

.dark #price-check-modal>div {
    background-color: #1e293b;
    color: #fff;
    border: 1px solid #334155;
}

/* Mobile Header Visibility */
header.md\:hidden>button:not(#mobile-menu-btn):not(#mobile-cart-btn) {
    display: none !important;
}

.desktop-visible {
    display: none !important;
}

@media (min-width: 768px) {
    .desktop-visible {
        display: flex !important;
    }

    header.md\:hidden {
        display: none !important;
    }

    #mobile-pos-controls {
        display: none !important;
    }
}

/* Autofill Styling Fix */
input:-webkit-autofill,
input:-webkit-autofill:active,
input:-webkit-autofill:focus,
input:-webkit-autofill:hover,
select:-webkit-autofill,
select:-webkit-autofill:focus,
select:-webkit-autofill:hover,
textarea:-webkit-autofill,
textarea:-webkit-autofill:focus,
textarea:-webkit-autofill:hover {
    -webkit-text-fill-color: #0f172a !important;
    -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
    box-shadow: 0 0 0 1000px #fff inset !important;
    background-color: #fff !important;
    color: #0f172a !important;
    transition: background-color 5000s ease-in-out 0s;
}

input[type=number],
input[type=text],
input[type=url],
select {
    color: #0f172a;
}

.dark input[type=number],
.dark input[type=text],
.dark input[type=url],
.dark select {
    color: #f1f5f9;
}

/* Base Font */
body {
    font-family: Outfit, sans-serif;
}

/* Soft Light Mode Theme */
:root {
    --soft-bg-primary: #f8f9fb;
    --soft-bg-secondary: #f1f3f7;
    --soft-bg-card: #ffffff;
    --soft-border: #e2e5eb;
    --soft-text: #3d4654;
}

html:not(.dark) body {
    background-color: var(--soft-bg-secondary);
}

html:not(.dark) .bg-gray-50,
html:not(.dark) .bg-slate-50 {
    background-color: var(--soft-bg-primary);
}

html:not(.dark) #sidebar {
    background-color: #f5f6f8;
    border-color: var(--soft-border);
}

html:not(.dark) header {
    background-color: #f5f6f8;
}

html:not(.dark) .bg-white:not(.dark\:bg-slate-800):not(.dark\:bg-slate-700):not(.dark\:bg-slate-900) {
    background-color: #fafbfc;
}

html:not(.dark) [class*=rounded-2xl].bg-white,
html:not(.dark) [class*=rounded-lg].bg-white,
html:not(.dark) [class*=rounded-xl].bg-white {
    background-color: #fcfcfd;
}

html:not(.dark) #product-grid-container {
    background-color: var(--soft-bg-secondary);
}

html:not(.dark) #cart-container,
html:not(.dark) .desktop-cart-container {
    background-color: #f9fafb;
}

html:not(.dark) [class*=border-slate-200] {
    border-color: var(--soft-border);
}

html:not(.dark) [class*=border-slate-100] {
    border-color: #e8eaef;
}

html:not(.dark) input[type=number],
html:not(.dark) input[type=search],
html:not(.dark) input[type=text],
html:not(.dark) select,
html:not(.dark) textarea {
    background-color: #fff;
    border-color: #d8dce3;
}

html:not(.dark) .shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

html:not(.dark) .shadow {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
}

html:not(.dark) .shadow-lg {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

html:not(.dark) .bg-black.bg-opacity-50 {
    background-color: rgba(55, 65, 81, 0.4);
}

html:not(.dark) .text-slate-900 {
    color: var(--soft-text);
}

html:not(.dark) .text-slate-800 {
    color: #475569;
}

html:not(.dark) .bg-indigo-600 {
    background-color: #5c6bc0;
}

html:not(.dark) .bg-emerald-600,
html:not(.dark) .bg-green-600 {
    background-color: #4db6ac;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-in {
    animation: fadeIn 0.2s ease-out forwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.cart-item-new {
    animation: slideInRight 0.25s ease-out forwards;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.animate-shimmer {
    animation: shimmer 2s infinite;
}

@keyframes tip-over {
    0% {
        transform: rotate(0);
    }

    20% {
        transform: rotate(-10deg);
    }

    40% {
        transform: rotate(10deg);
    }

    60% {
        transform: rotate(-5deg);
    }

    80% {
        transform: rotate(135deg);
    }

    100% {
        transform: rotate(135deg);
    }
}

/* Hover Scroll */
.hover-scroll {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s;
}

.hover-scroll:hover {
    scrollbar-color: #94a3b8 transparent;
}

.hover-scroll::-webkit-scrollbar {
    height: 6px;
    background-color: transparent;
}

.hover-scroll::-webkit-scrollbar-track {
    background-color: transparent;
}

.hover-scroll::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 20px;
}

.hover-scroll:hover::-webkit-scrollbar-thumb {
    background-color: #94a3b8;
}

/* Desktop Only Flex - FORCED VISIBLE FOR DEBUGGING */
.desktop-only-flex {
    display: flex !important;
    /* Was none, changed to force visibility */
}

@media (min-width: 768px) {
    .desktop-only-flex {
        display: flex !important;
    }
}

/* DEBUG BORDERS - REMOVE LATER */
#pos-content-wrapper {

    min-height: 100px !important;
    /* Ensure it has height */
}

/* Users Grid */
#users-card-grid {
    grid-auto-rows: auto !important;
}

#users-card-grid>div {
    height: auto !important;
    min-height: fit-content !important;
}

/* Active Ring Effect */
.active-ring {
    position: relative;
}

.active-ring::after {
    content: '';
    position: absolute;
    inset: -2px;
    border: 2px solid rgb(99 102 241 / 0.5);
    border-radius: 14px;
    opacity: 1;
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }

    #receipt-modal-content,
    #receipt-modal-content * {
        visibility: visible;
    }

    #receipt-modal-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        display: block !important;
    }

    #close-receipt,
    #email-receipt-btn,
    #print-receipt-btn {
        display: none !important;
    }

    #payment-modal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background: #fff;
        z-index: 9999;
        visibility: visible;
        display: block !important;
    }
}

/* ============================================
   American POS Brand Styles
   ============================================ */

/* Sidebar nav links - burgundy accent on active */
.nav-link {
    color: rgba(255, 255, 255, 0.8);
}

.nav-link:hover {
    background: linear-gradient(90deg, rgba(139, 58, 58, 0.15) 0%, rgba(168, 74, 74, 0.1) 100%) !important;
    color: var(--brand-burgundy-light) !important;
}

.nav-link.active {
    background: linear-gradient(90deg, var(--brand-burgundy) 0%, var(--brand-burgundy-light) 100%) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(139, 58, 58, 0.3);
}

/* Sidebar text colors */
#sidebar {
    color: rgba(255, 255, 255, 0.9);
}

#sidebar .border-slate-200 {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.connection-status-indicator span {
    color: rgba(255, 255, 255, 0.7) !important;
}