/* ==========================================================================
   SekizPOS - Apple Design & Motion System (macOS / iOS Physics)
   Ultra-Smooth Spring Easing, Glassmorphism & Micro-Interactions
   ========================================================================== */

:root {
    --apple-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --apple-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
    --apple-spring-bouncy: cubic-bezier(0.34, 1.56, 0.64, 1);
    --apple-snappy: cubic-bezier(0.2, 0.9, 0.2, 1);
    
    --apple-glass-bg: rgba(255, 255, 255, 0.82);
    --apple-glass-border: rgba(255, 255, 255, 0.7);
    --apple-glass-blur: blur(24px) saturate(190%);
    
    --apple-shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --apple-shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
    --apple-shadow-hover: 0 16px 36px -6px rgba(0, 0, 0, 0.09), 0 6px 14px -3px rgba(0, 0, 0, 0.04);
    --apple-shadow-modal: 0 25px 60px -12px rgba(0, 0, 0, 0.22), 0 12px 24px -6px rgba(0, 0, 0, 0.08);
}

/* 1. TYPOGRAPHY & SMOOTHING */
body, input, button, textarea, select {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.012em;
}

/* 2. APPLE SPRING BUTTON INTERACTIONS */
button, .btn-touch, .apple-btn, a[class*="rounded"] {
    transition: transform 0.22s var(--apple-spring), 
                box-shadow 0.25s var(--apple-ease), 
                background-color 0.2s var(--apple-ease), 
                border-color 0.2s var(--apple-ease),
                opacity 0.2s var(--apple-ease) !important;
}

button:active, .btn-touch:active, .apple-btn:active {
    transform: scale(0.955) !important;
}

/* 3. CARD HOVER & LIFT SYSTEM */
.apple-hover, .white-card, .table-card, .tenant-card, .category-pill, .product-card {
    transition: transform 0.28s var(--apple-ease), 
                box-shadow 0.3s var(--apple-ease), 
                border-color 0.25s var(--apple-ease) !important;
}

.apple-hover:hover, .table-card:hover {
    transform: translateY(-3px) scale(1.006);
    box-shadow: var(--apple-shadow-hover) !important;
}

/* 4. APPLE GLASSMORPHISM SURFACES */
.apple-glass {
    background: var(--apple-glass-bg) !important;
    backdrop-filter: var(--apple-glass-blur) !important;
    -webkit-backdrop-filter: var(--apple-glass-blur) !important;
    border: 1px solid var(--apple-glass-border) !important;
}

.apple-glass-dark {
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(24px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* 5. SMOOTH PAGE & ELEMENT ENTRANCE ANIMATIONS */
@keyframes appleFadeUp {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.99);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes appleScaleIn {
    0% {
        opacity: 0;
        transform: scale(0.94);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes appleModalPop {
    0% {
        opacity: 0;
        transform: scale(0.92) translateY(16px);
    }
    60% {
        transform: scale(1.015) translateY(-2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes appleShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes applePillPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.92); opacity: 0.6; }
}

.apple-animate-in {
    animation: appleFadeUp 0.45s var(--apple-ease) forwards;
}

.apple-scale-in {
    animation: appleScaleIn 0.35s var(--apple-spring) forwards;
}

/* Staggered load delays for lists and grids */
.stagger-1 { animation: appleFadeUp 0.4s var(--apple-ease) 0.04s both; }
.stagger-2 { animation: appleFadeUp 0.4s var(--apple-ease) 0.08s both; }
.stagger-3 { animation: appleFadeUp 0.4s var(--apple-ease) 0.12s both; }
.stagger-4 { animation: appleFadeUp 0.4s var(--apple-ease) 0.16s both; }
.stagger-5 { animation: appleFadeUp 0.4s var(--apple-ease) 0.20s both; }

/* 6. MODAL & DIALOG SYSTEM */
.apple-modal-enter {
    animation: appleModalPop 0.38s var(--apple-spring-bouncy) forwards;
}

/* 7. APPLE CUSTOM FLUID SCROLLBAR */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 9999px;
    transition: background 0.2s var(--apple-ease);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.8);
}

/* 8. APPLE SEGMENTED CONTROL SLIDERS */
.apple-segmented-pill {
    transition: all 0.25s var(--apple-spring);
}

/* 9. TACTILE SELECTION RIPPLE */
.apple-ripple {
    position: relative;
    overflow: hidden;
}
.apple-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 10%, transparent 60%);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s var(--apple-ease), opacity 0.3s var(--apple-ease);
}
.apple-ripple:active::after {
    transform: translate(-50%, -50%) scale(2);
    opacity: 1;
    transition: 0s;
}

/* 10. APPLE TOOLBAR & CONTROL CENTER COMPONENTS */
.apple-nav-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(190%);
    -webkit-backdrop-filter: blur(20px) saturate(190%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.7);
}

.apple-segmented-bar {
    background: rgba(226, 232, 240, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(203, 213, 225, 0.5);
    border-radius: 9999px;
    padding: 3px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.apple-segmented-item {
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    transition: all 0.2s var(--apple-spring);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border: 1px solid transparent;
}

.apple-segmented-item:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.5);
}

.apple-segmented-item.active {
    background: #ffffff;
    color: #0f172a;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    border-color: rgba(226, 232, 240, 0.8);
}

.apple-status-island {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 9999px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.apple-toolbar-btn {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    padding: 7px 12px;
    transition: all 0.2s var(--apple-spring);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.apple-toolbar-btn:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.apple-toolbar-btn:active {
    transform: scale(0.95);
}

.apple-toolbar-btn-danger {
    background: rgba(255, 241, 242, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(254, 205, 211, 0.8);
    color: #e11d48;
}

.apple-toolbar-btn-danger:hover {
    background: #ffe4e6;
    color: #be123c;
    border-color: #fda4af;
}

.apple-squircle-logo {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   TOUCH POS TERMINAL ENHANCEMENTS (13", 14", 15" - 1024x768 / 1280x800 / 1366x768)
   ========================================================================== */
@media (max-width: 1366px) or (max-height: 800px) {
    /* Compact Header on 1024x768 / 1366x768 POS screens */
    header {
        height: 48px !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .apple-segmented-bar {
        padding: 2px !important;
        gap: 3px !important;
    }

    .apple-segmented-bar button, .apple-segmented-bar a {
        padding: 4px 10px !important;
        font-size: 11px !important;
        min-height: 32px !important;
        white-space: nowrap !important;
    }

    .apple-toolbar-btn {
        padding: 4px 8px !important;
        font-size: 11px !important;
        border-radius: 8px !important;
        min-height: 32px !important;
    }

    /* Side by side cart & menu for desktop / tablet */
    @media (min-width: 768px) {
        #orderView {
            flex-direction: row !important;
        }
        #orderCartCol {
            width: 320px !important;
        }
    }

    /* Table cards compact touch grid */
    .table-card {
        min-height: 105px !important;
        padding: 8px 10px !important;
        border-radius: 14px !important;
    }

    .table-card h3 {
        font-size: 12px !important;
        line-height: 1.2 !important;
    }

    /* Product cards compact touch tiles */
    .product-card {
        min-height: 110px !important;
        padding: 6px 8px !important;
        border-radius: 12px !important;
    }

    .product-card .relative {
        height: 55px !important;
    }

    .product-card h3 {
        font-size: 11px !important;
        line-height: 1.2 !important;
    }

    /* Payment Modal 1024x768 Zero-Scroll Fitting */
    #paymentModal {
        padding: 8px !important;
    }

    #paymentModal > div {
        max-height: 96vh !important;
        max-width: 880px !important;
    }

    #paymentModal .pay-method-btn {
        min-height: 32px !important;
        height: 32px !important;
        padding: 2px 8px !important;
        font-size: 11px !important;
    }

    #paymentModal .col-span-2 button,
    #paymentModal .col-span-3 button {
        height: 28px !important;
        min-height: 28px !important;
        font-size: 10px !important;
    }

    #paymentModal .col-span-7 button {
        height: 32px !important;
        min-height: 32px !important;
        font-size: 16px !important;
    }

    #paymentModal input#payAmountInput {
        font-size: 18px !important;
        height: 26px !important;
    }

    #modalPayReceiptItems {
        max-height: 110px !important;
    }

    /* Modals overall height safety */
    .fixed.inset-0 > div {
        max-height: 94vh !important;
    }
}

/* Touch hardware optimizations (no scroll bounce, instant tap) */
html, body {
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button, input, select, a, textarea {
    touch-action: manipulation;
}

