@media print {
    .only-print {
        display: black;
    }
}

/* ==========================================================================
   Modern Login / Auth UI
   --------------------------------------------------------------------------
   Scoped to the auth screens only. The auth layout renders a centered white
   card (".max-w-md.bg-white") that contains the logo and the login form.
   These rules restyle only that screen without touching the rest of the app.
   ========================================================================== */

/* ---- Animated gradient backdrop (auth layout wrapper) ------------------- */
/* The auth layout is the full-screen bg-cover element that wraps a .max-w-md
   card. We detect it via :has() and paint a rich animated gradient on top of
   whatever background image is configured. */
.bg-cover:has(.max-w-md.bg-white) {
    position: relative;
    min-height: 100vh;
    background-image:
        radial-gradient(1200px 600px at 10% 10%, rgba(56, 189, 248, 0.25), transparent 60%),
        radial-gradient(1000px 500px at 90% 20%, rgba(129, 140, 248, 0.25), transparent 60%),
        radial-gradient(900px 600px at 50% 100%, rgba(236, 72, 153, 0.18), transparent 60%),
        linear-gradient(135deg, #0f172a 0%, #155e75 55%, #0f766e 100%) !important;
    background-size: 200% 200%, 200% 200%, 200% 200%, 200% 200%;
    animation: authGradientShift 18s ease infinite;
    overflow: hidden;
}

/* Soft floating blobs for depth */
.bg-cover:has(.max-w-md.bg-white)::before,
.bg-cover:has(.max-w-md.bg-white)::after {
    content: "";
    position: absolute;
    border-radius: 9999px;
    filter: blur(70px);
    opacity: 0.55;
    pointer-events: none;
    z-index: 0;
}

.bg-cover:has(.max-w-md.bg-white)::before {
    width: 420px;
    height: 420px;
    top: -120px;
    left: -80px;
    background: radial-gradient(circle at 30% 30%, #22d3ee, transparent 70%);
    animation: authFloat 12s ease-in-out infinite;
}

.bg-cover:has(.max-w-md.bg-white)::after {
    width: 480px;
    height: 480px;
    bottom: -160px;
    right: -100px;
    background: radial-gradient(circle at 70% 70%, #a78bfa, transparent 70%);
    animation: authFloat 14s ease-in-out infinite reverse;
}

@keyframes authGradientShift {
    0%   { background-position: 0% 0%, 100% 0%, 50% 100%, 0% 50%; }
    50%  { background-position: 100% 50%, 0% 50%, 50% 0%, 100% 50%; }
    100% { background-position: 0% 0%, 100% 0%, 50% 100%, 0% 50%; }
}

@keyframes authFloat {
    0%, 100% { transform: translateY(0) translateX(0); }
    50%      { transform: translateY(-30px) translateX(20px); }
}

/* ---- The glass card ----------------------------------------------------- */
.max-w-md.bg-white {
    position: relative;
    z-index: 1;
    max-width: 26rem !important;
    width: 100% !important;
    padding: 2.5rem 2.25rem 2.25rem !important;
    border-radius: 1.5rem !important;
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow:
        0 20px 60px -15px rgba(2, 6, 23, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.25) inset !important;
    animation: authCardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

/* ---- Logo --------------------------------------------------------------- */
.max-w-md.bg-white img.w-36.h-36 {
    width: 5.5rem !important;
    height: 5.5rem !important;
    object-fit: contain;
    padding: 0.75rem;
    border-radius: 1.25rem;
    background: linear-gradient(135deg, #ecfeff, #e0e7ff);
    box-shadow: 0 10px 25px -10px rgba(21, 94, 117, 0.6);
    animation: authLogoPop 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

@keyframes authLogoPop {
    from { opacity: 0; transform: scale(0.6) rotate(-8deg); }
    to   { opacity: 1; transform: scale(1) rotate(0); }
}

/* A friendly welcome line injected above the form */
.max-w-md.bg-white form::before {
    content: "Welcome back";
    display: block;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.max-w-md.bg-white form::after {
    content: none;
}

/* subtle subtitle under the title using the first field's wrapper spacing */
.max-w-md.bg-white > .justify-center.mb-8 {
    margin-bottom: 1.25rem !important;
}

/* ---- Field labels ------------------------------------------------------- */
.max-w-md.bg-white .input-label {
    display: block;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em;
    color: #334155 !important;
    margin-bottom: 0.35rem;
    text-transform: none;
}

/* ---- Inputs ------------------------------------------------------------- */
.max-w-md.bg-white .form-input {
    width: 100% !important;
    padding: 0.8rem 1rem !important;
    border-radius: 0.85rem !important;
    border: 1.5px solid #e2e8f0 !important;
    background: #f8fafc !important;
    color: #0f172a !important;
    font-size: 0.95rem !important;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease !important;
    box-shadow: none !important;
}

.max-w-md.bg-white .form-input::placeholder {
    color: #94a3b8;
}

.max-w-md.bg-white .form-input:hover {
    border-color: #cbd5e1 !important;
}

.max-w-md.bg-white .form-input:focus {
    outline: none !important;
    background: #ffffff !important;
    border-color: #0e7490 !important;
    box-shadow: 0 0 0 4px rgba(14, 116, 144, 0.15) !important;
}

/* give each field group a bit more breathing room */
.max-w-md.bg-white form .mb-4.pt-1 {
    margin-bottom: 1.1rem !important;
    box-shadow: none !important;
}

/* ---- Submit button (full-width gradient CTA) ---------------------------- */
.max-w-md.bg-white form .mb-4.text-right {
    text-align: center !important;
    margin-top: 0.5rem;
}

.max-w-md.bg-white #submit-login.btn.btn-app {
    width: 100% !important;
    padding: 0.85rem 1rem !important;
    border: none !important;
    border-radius: 0.9rem !important;
    font-size: 0.98rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em;
    color: #ffffff !important;
    background: linear-gradient(135deg, #0e7490 0%, #0891b2 45%, #06b6d4 100%) !important;
    background-size: 180% 180% !important;
    box-shadow: 0 12px 24px -8px rgba(8, 145, 178, 0.6) !important;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background-position 0.4s ease !important;
}

.max-w-md.bg-white #submit-login.btn.btn-app:hover {
    background-position: 100% 50% !important;
    transform: translateY(-1px);
    box-shadow: 0 16px 30px -8px rgba(8, 145, 178, 0.7) !important;
}

.max-w-md.bg-white #submit-login.btn.btn-app:active {
    transform: translateY(0);
    box-shadow: 0 8px 16px -8px rgba(8, 145, 178, 0.7) !important;
}

.max-w-md.bg-white #submit-login.btn.btn-app:focus {
    outline: none !important;
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.3), 0 12px 24px -8px rgba(8, 145, 178, 0.6) !important;
}

/* ---- Helper links (register / recover) ---------------------------------- */
.max-w-md.bg-white form p.text-sm {
    text-align: center;
    color: #64748b;
    margin-top: 0.5rem;
    font-size: 0.85rem !important;
}

.max-w-md.bg-white form p.text-sm a {
    color: #0e7490 !important;
    font-weight: 700;
    transition: color 0.15s ease;
}

.max-w-md.bg-white form p.text-sm a:hover {
    color: #0369a1 !important;
    text-decoration: underline;
}

/* ---- Demo-mode banner (only shown when demo mode is on) ----------------- */
.max-w-md.bg-white form .bg-green-200 {
    border-radius: 0.85rem !important;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5) !important;
    border: 1px solid #a7f3d0;
}

.max-w-md.bg-white form .btn.btn-app[type="button"] {
    width: auto !important;
    display: inline-block;
}

/* ---- Already-logged-in state buttons ------------------------------------ */
.max-w-md.bg-white .btn.mt-2 {
    border-radius: 0.85rem !important;
}

/* ---- Small screens ------------------------------------------------------ */
@media (max-width: 480px) {
    .max-w-md.bg-white {
        padding: 2rem 1.4rem !important;
        border-radius: 1.25rem !important;
    }
    .max-w-md.bg-white form::before {
        font-size: 1.4rem;
    }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    .bg-cover:has(.max-w-md.bg-white),
    .bg-cover:has(.max-w-md.bg-white)::before,
    .bg-cover:has(.max-w-md.bg-white)::after,
    .max-w-md.bg-white,
    .max-w-md.bg-white img.w-36.h-36 {
        animation: none !important;
    }
}


/* ==========================================================================
   Modern POS UI (http://127.0.0.1:8000/pos)
   --------------------------------------------------------------------------
   CSS-only restyle. Scoped to the POS screen via `main:has(.product-list)`,
   which only exists on the POS page. No markup/structure is changed — same
   grid, same elements, same positions. We only refresh surfaces, colors,
   spacing accents, shadows, and interaction states.
   ========================================================================== */

:root {
    --pos-bg: #eef2f7;
    --pos-surface: #ffffff;
    --pos-line: #e6ebf1;
    --pos-brand: #0e7490;
    --pos-brand-2: #0891b2;
    --pos-ink: #0f172a;
    --pos-muted: #64748b;
    --pos-radius: 14px;
    --pos-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.18);
    --pos-shadow-hover: 0 10px 30px -10px rgba(14, 116, 144, 0.35);
}

/* Page backdrop */
main:has(.product-list) {
    background: var(--pos-bg);
}

/* ---- Panels (product grid panel + cart panel + toolbar) ----------------- */
main:has(.product-list) .p-2.bg-white.mb-1.rounded,
main:has(.product-list) .bg-white.h-fit.p-2 {
    background: var(--pos-surface) !important;
    border: 1px solid var(--pos-line);
    border-radius: var(--pos-radius) !important;
    box-shadow: var(--pos-shadow);
}

/* ---- Top toolbar buttons / back link (COLORFUL) -------------------------
   Each toolbar card gets its own vibrant gradient. We cycle colors by
   :nth-child so it stays lively no matter which conditional buttons show.
   Scoped to the POS toolbar grid only. ------------------------------------ */
main:has(.product-list) .grid.gap-2 > .text-center.border.border-gray-400.p-1.cursor-pointer.hover\:bg-gray-100.mb-1.rounded-md {
    border: none !important;
    border-radius: 14px !important;
    color: #ffffff !important;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    box-shadow: 0 6px 16px -6px rgba(37, 99, 235, 0.55);
    transition: transform 0.14s ease, box-shadow 0.2s ease, filter 0.16s ease;
}
/* Vibrant palette, cycled across the toolbar cards */
main:has(.product-list) .grid.gap-2 > .text-center.border.border-gray-400.rounded-md:nth-child(6n + 1) {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    box-shadow: 0 6px 16px -6px rgba(139, 92, 246, 0.55);
}
main:has(.product-list) .grid.gap-2 > .text-center.border.border-gray-400.rounded-md:nth-child(6n + 2) {
    background: linear-gradient(135deg, #f43f5e 0%, #ec4899 100%);
    box-shadow: 0 6px 16px -6px rgba(236, 72, 153, 0.55);
}
main:has(.product-list) .grid.gap-2 > .text-center.border.border-gray-400.rounded-md:nth-child(6n + 3) {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    box-shadow: 0 6px 16px -6px rgba(249, 115, 22, 0.55);
}
main:has(.product-list) .grid.gap-2 > .text-center.border.border-gray-400.rounded-md:nth-child(6n + 4) {
    background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
    box-shadow: 0 6px 16px -6px rgba(16, 185, 129, 0.55);
}
main:has(.product-list) .grid.gap-2 > .text-center.border.border-gray-400.rounded-md:nth-child(6n + 5) {
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    box-shadow: 0 6px 16px -6px rgba(59, 130, 246, 0.55);
}
main:has(.product-list) .grid.gap-2 > .text-center.border.border-gray-400.rounded-md:nth-child(6n + 6) {
    background: linear-gradient(135deg, #a855f7 0%, #d946ef 100%);
    box-shadow: 0 6px 16px -6px rgba(217, 70, 239, 0.55);
}
/* Hover / active */
main:has(.product-list) .grid.gap-2 > .text-center.border.border-gray-400.p-1.cursor-pointer.hover\:bg-gray-100.mb-1.rounded-md:hover {
    transform: translateY(-2px);
    filter: brightness(1.08) saturate(1.1);
    box-shadow: 0 12px 26px -8px rgba(15, 23, 42, 0.4) !important;
}
main:has(.product-list) .grid.gap-2 > .text-center.border.border-gray-400.p-1.cursor-pointer.hover\:bg-gray-100.mb-1.rounded-md:active {
    transform: translateY(0);
}
/* Icons + labels on colored buttons -> white */
main:has(.product-list) .grid.gap-2 > .text-center.border.border-gray-400.rounded-md .content-title-icon,
main:has(.product-list) .grid.gap-2 > .text-center.border.border-gray-400.rounded-md .text-xs {
    color: #ffffff !important;
}

/* ---- Order type + search selects/inputs in the toolbar ------------------ */
main:has(.product-list) .border.border-gray-400.p-1.rounded-md.px-2,
main:has(.product-list) select.col-span-3,
main:has(.product-list) input.col-span-3 {
    border: 1px solid var(--pos-line) !important;
    border-radius: 12px !important;
    background: #f8fafc;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
main:has(.product-list) .border.border-gray-400.p-1.rounded-md.px-2:focus,
main:has(.product-list) select.col-span-3:focus,
main:has(.product-list) input.col-span-3:focus {
    outline: none !important;
    background: #fff;
    border-color: var(--pos-brand) !important;
    box-shadow: 0 0 0 4px rgba(14, 116, 144, 0.12);
}

/* ---- Category filter (input-select) ------------------------------------- */
main:has(.product-list) .form-input {
    border-radius: 12px !important;
    border: 1px solid var(--pos-line) !important;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
main:has(.product-list) .form-input:focus {
    border-color: var(--pos-brand) !important;
    box-shadow: 0 0 0 4px rgba(14, 116, 144, 0.12) !important;
    outline: none !important;
}

/* ---- Product cards ------------------------------------------------------ */
main:has(.product-list) .p-1.border.border-gray-400.select-none.cursor-pointer.transition-shadow.bg-gray-50.shadow.hover\:shadow-lg.text-center.rounded-md {
    background: var(--pos-surface) !important;
    border: 1px solid var(--pos-line) !important;
    border-radius: 14px !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    overflow: hidden;
    transition: transform 0.14s ease, box-shadow 0.2s ease, border-color 0.18s ease;
}
main:has(.product-list) .p-1.border.border-gray-400.select-none.cursor-pointer.transition-shadow.bg-gray-50.shadow.hover\:shadow-lg.text-center.rounded-md:hover {
    transform: translateY(-3px);
    border-color: transparent !important;
    box-shadow: var(--pos-shadow-hover);
}
main:has(.product-list) .p-1.border.border-gray-400.select-none.cursor-pointer.transition-shadow.bg-gray-50.shadow.hover\:shadow-lg.text-center.rounded-md:active {
    transform: translateY(-1px);
}
/* Product image framing (keeps size, just rounds + fits nicely) */
main:has(.product-list) .product-list img {
    border-radius: 10px;
    object-fit: cover;
    aspect-ratio: 1 / 1;
}
/* Price pill */
main:has(.product-list) .product-list .text-blue-600 {
    display: inline-block;
    margin-top: 2px;
    padding: 1px 8px;
    border-radius: 9999px;
    background: #ecfeff;
    color: var(--pos-brand) !important;
}

/* ---- Scroll areas (subtle scrollbar) ------------------------------------ */
main:has(.product-list) .product-list,
main:has(.product-list) .cart-list {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
main:has(.product-list) .product-list::-webkit-scrollbar,
main:has(.product-list) .cart-list::-webkit-scrollbar { width: 8px; }
main:has(.product-list) .product-list::-webkit-scrollbar-thumb,
main:has(.product-list) .cart-list::-webkit-scrollbar-thumb {
    background: #cbd5e1; border-radius: 9999px;
}

/* ---- Customer / table header bar (top of cart) -------------------------- */
main:has(.product-list) .mb-4.flex.text-xs.justify-between.rounded.p-2.border.border-gray-400 {
    border: 1px solid var(--pos-line) !important;
    border-radius: 12px !important;
    background: #f8fafc;
}

/* ---- Cart line items ---------------------------------------------------- */
main:has(.product-list) .cart-list li .bg-gray-100.border-l.border-r.border-t.border-gray-400 {
    border-color: var(--pos-line) !important;
    border-top-left-radius: 12px;
    background: #f1f5f9 !important;
}
main:has(.product-list) .cart-list li .flex.justify-between.text-cyan-900.border-l.border-r.border-b.border-gray-400 {
    border-color: var(--pos-line) !important;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    background: #ffffff;
}
/* qty +/- buttons */
main:has(.product-list) .cart-list li button.w-6.h-6 {
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}
main:has(.product-list) .cart-list li button.w-6.h-6:hover:not(:disabled) {
    background: var(--pos-brand);
    color: #fff;
}

/* ---- Summary bar (Subtotal / Tax / Discount / Total) -------------------- */
main:has(.product-list) .align-bottom.bg-gray-100 {
    background: transparent !important;
    padding-top: 6px;
}
main:has(.product-list) .align-bottom.bg-gray-100 .w-full.border.rounded.border-gray-300.py-1.px-2 {
    border: 1px solid var(--pos-line) !important;
    border-radius: 12px !important;
    background: var(--pos-surface);
    box-shadow: var(--pos-shadow);
}
main:has(.product-list) .align-bottom.bg-gray-100 p.text-sm {
    color: var(--pos-muted) !important;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
main:has(.product-list) .align-bottom.bg-gray-100 strong {
    color: var(--pos-ink);
    font-size: 1.05rem;
}
/* Highlight the Total box as the primary figure */
main:has(.product-list) .align-bottom.bg-gray-100 .mt-1 .w-full.border.rounded.border-gray-300.py-1.px-2 {
    background: linear-gradient(135deg, var(--pos-brand) 0%, var(--pos-brand-2) 100%) !important;
    border-color: transparent !important;
    box-shadow: var(--pos-shadow-hover);
}
main:has(.product-list) .align-bottom.bg-gray-100 .mt-1 p.text-sm,
main:has(.product-list) .align-bottom.bg-gray-100 .mt-1 strong {
    color: #ffffff !important;
}
/* Discount (Apply) link */
main:has(.product-list) .align-bottom.bg-gray-100 a {
    color: var(--pos-brand) !important;
    font-weight: 700;
}
main:has(.product-list) .align-bottom.bg-gray-100 a:hover { color: #0369a1 !important; }

/* ---- Pagination / per-page / cols controls ------------------------------ */
main:has(.product-list) .btn.btn-app,
main:has(.product-list) .btn.btn-red {
    border-radius: 12px !important;
    font-weight: 700;
    transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.15s ease;
}
main:has(.product-list) .btn.btn-app:hover,
main:has(.product-list) .btn.btn-red:hover {
    transform: translateY(-1px);
    box-shadow: var(--pos-shadow-hover);
    filter: brightness(1.03);
}
main:has(.product-list) .form-input.rounded-none {
    border-radius: 12px !important;
    background: #f8fafc !important;
}

/* ---- Modals (payment / discount / notes / customers / tables) ----------- */
main:has(.product-list) .btn.btn-green {
    border-radius: 12px !important;
    font-weight: 700;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    main:has(.product-list) * { transition: none !important; }
}


/* ---- POS toolbar: Submit button is always GREEN ------------------------- */
main:has(.product-list) .grid.gap-2 > .pos-submit-btn,
main:has(.product-list) .pos-submit-btn {
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%) !important;
    box-shadow: 0 6px 16px -6px rgba(22, 163, 74, 0.6) !important;
    color: #ffffff !important;
}
main:has(.product-list) .pos-submit-btn .content-title-icon,
main:has(.product-list) .pos-submit-btn .text-xs {
    color: #ffffff !important;
}
main:has(.product-list) .pos-submit-btn:hover {
    filter: brightness(1.08) saturate(1.1);
    box-shadow: 0 12px 26px -8px rgba(22, 163, 74, 0.55) !important;
}
