/**
 * ====================================================================
 * ☕ CAFE & RESTORAN POS - ULTRA MODERN & SYMMETRICAL CSS SUITE
 * ====================================================================
 */

:root {
    --pos-primary: #2563eb;
    --pos-primary-hover: #1d4ed8;
    --pos-primary-light: #eff6ff;
    --pos-primary-soft: rgba(37, 99, 235, 0.12);
    --pos-success: #059669;
    --pos-success-hover: #047857;
    --pos-success-light: #ecfdf5;
    --pos-warning: #d97706;
    --pos-warning-light: #fffbeb;
    --pos-danger: #dc2626;
    --pos-danger-light: #fef2f2;
    --pos-dark: #0f172a;
    --pos-slate: #1e293b;
    --pos-ink: #111827;
    --pos-cream: #fffdf8;
    --pos-gray-bg: #f8fafc;
    --pos-card-border: #e2e8f0;
    --pos-card-border-strong: #cbd5e1;
    --pos-radius: 18px;
    --pos-radius-sm: 10px;
    --pos-radius-lg: 28px;
    --pos-shadow-sm: 0 10px 24px rgba(15,23,42,0.05);
    --pos-shadow-md: 0 18px 40px rgba(15,23,42,0.08);
    --pos-shadow-lg: 0 26px 60px rgba(15,23,42,0.12);
}

.pos-shell {
    padding: 18px 10px 110px 10px;
    background:
        radial-gradient(circle at top left, rgba(14, 165, 233, 0.10), transparent 28%),
        radial-gradient(circle at right 20%, rgba(16, 185, 129, 0.10), transparent 24%),
        linear-gradient(180deg, #f8fbff 0%, #f6f8fb 50%, #fbfbfd 100%);
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

/* ====================================================================
   1. HERO BANNER
   ==================================================================== */
.pos-hero-banner {
    background:
        linear-gradient(125deg, rgba(8, 15, 32, 0.97) 0%, rgba(20, 35, 61, 0.95) 45%, rgba(27, 52, 92, 0.92) 100%);
    border-radius: var(--pos-radius-lg);
    padding: 28px 30px;
    color: #fff;
    box-shadow: var(--pos-shadow-lg);
    position: relative;
    overflow: hidden;
    margin-bottom: 22px;
    border: 1px solid rgba(255,255,255,0.08);
}
.pos-hero-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 340px;
    height: 340px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.pos-hero-banner::before {
    content: '';
    position: absolute;
    inset: auto auto -80px -60px;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.20) 0%, transparent 68%);
    pointer-events: none;
}
.pos-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.9fr);
    gap: 24px;
    align-items: stretch;
    position: relative;
    z-index: 1;
}
.pos-hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
}
.pos-hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-content: center;
}
.pos-hero-mini-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
    max-width: 520px;
}
.pos-hero-mini-stat {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.10);
    backdrop-filter: blur(6px);
}
.pos-hero-mini-stat .label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.65);
    margin-bottom: 4px;
}
.pos-hero-mini-stat strong {
    font-size: 1rem;
    color: #fff;
}

.pos-quick-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    min-height: 54px;
    padding: 12px 18px;
    border-radius: 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 24px rgba(0,0,0,0.16);
    border: 1px solid rgba(255,255,255,0.15);
    text-align: center;
}
.pos-quick-nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.2);
}

/* ====================================================================
   2. KPI METRIC CARDS
   ==================================================================== */
.pos-stat-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
    border: 1px solid rgba(203,213,225,0.9);
    border-radius: 22px;
    padding: 20px 22px;
    box-shadow: var(--pos-shadow-sm);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
}
.pos-stat-card::after {
    content: '';
    position: absolute;
    inset: auto -20px -30px auto;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, transparent 72%);
}
.pos-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--pos-shadow-md);
    border-color: #cbd5e1;
}
.pos-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}
.pos-stat-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #64748b;
    margin-bottom: 4px;
}
.pos-stat-value {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

/* ====================================================================
   3. SECTION TABS & CONTROLS
   ==================================================================== */
.pos-section-bar {
    background: rgba(255,255,255,0.94);
    border: 1px solid rgba(203,213,225,0.85);
    border-radius: 22px;
    padding: 14px 18px;
    box-shadow: var(--pos-shadow-sm);
    margin-bottom: 20px;
    backdrop-filter: blur(8px);
}
.pos-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin: 6px 2px 12px;
}
.pos-section-heading.compact {
    margin-top: 2px;
}
.pos-section-heading h3 {
    margin: 0;
    color: var(--pos-ink);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}
.pos-section-heading p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 0.82rem;
}
.pos-pill-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 0.86rem;
    font-weight: 700;
    border-radius: 30px;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
    transition: all 0.18s ease;
    border: 1px solid transparent;
    user-select: none;
}
.pos-pill-tab:hover {
    background: #e2e8f0;
    color: #1e293b;
}
.pos-pill-tab.active {
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}
.pos-pill-tab .badge-count {
    background: rgba(255,255,255,0.25);
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 0.75rem;
}
.pos-pill-tab:not(.active) .badge-count {
    background: #cbd5e1;
    color: #334155;
}

/* ====================================================================
   4. INTERACTIVE TABLE GRID & CARDS
   ==================================================================== */
.pos-table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 18px;
}

.pos-table-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(250,251,253,0.96) 100%);
    border: 1px solid rgba(203,213,225,0.85);
    border-radius: 24px;
    padding: 18px;
    box-shadow: var(--pos-shadow-sm);
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 220px;
    position: relative;
    overflow: hidden;
}
.pos-table-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--pos-shadow-md);
}
.pos-table-card::after {
    content: '';
    position: absolute;
    right: -24px;
    bottom: -24px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.75), rgba(255,255,255,0));
    pointer-events: none;
}

.pos-table-card.status-available {
    border-top: 4px solid #10b981;
    background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 40%);
}
.pos-table-card.status-occupied {
    border-top: 4px solid #3b82f6;
    background: linear-gradient(180deg, #eff6ff 0%, #ffffff 40%);
}
.pos-table-card.status-bill_requested {
    border-top: 4px solid #f59e0b;
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 40%);
    animation: pulseBorder 2s infinite;
}
.pos-table-card.status-preparing {
    border-top: 4px solid #dc2626;
    background: linear-gradient(180deg, #fef2f2 0%, #ffffff 40%);
}
.pos-table-card.status-partial_ready {
    border-top: 4px solid #0ea5e9;
    background: linear-gradient(180deg, #ecfeff 0%, #ffffff 40%);
}
.pos-table-card.status-ready {
    border-top: 4px solid #10b981;
    background: linear-gradient(180deg, #ecfdf5 0%, #ffffff 40%);
}
.pos-table-card.status-reserved {
    border-top: 4px solid #7c3aed;
    background: linear-gradient(180deg, #f5f3ff 0%, #ffffff 40%);
}
@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.pos-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.pos-table-number {
    font-size: 1.18rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.03em;
}
.pos-table-actions-mini {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pos-table-action-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #f1f5f9;
    border: none;
    color: #64748b;
    font-size: 0.75rem;
    transition: all 0.15s ease;
}
.pos-table-action-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}
.pos-table-action-btn.btn-del:hover {
    background: #fee2e2;
    color: #ef4444;
}

.pos-table-body {
    margin: 6px 0;
}
.pos-table-total {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #0f172a;
    margin: 6px 0;
}
.pos-table-meta {
    font-size: 0.75rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pos-table-footer {
    display: flex;
    gap: 6px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
}

/* ====================================================================
   5. POS TOUCH SALES TERMINAL & TICKET ACTIONS
   ==================================================================== */
.pos-terminal-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 18px;
    height: calc(100vh - 85px);
}
@media (max-width: 991px) {
    .pos-terminal-wrapper {
        grid-template-columns: 1fr;
        height: auto;
    }
}

.pos-catalog-panel {
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(249,250,252,0.96) 100%);
    border-radius: 24px;
    border: 1px solid rgba(203,213,225,0.85);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden;
    box-shadow: var(--pos-shadow-sm);
}

.pos-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    overflow-y: auto;
    padding-right: 4px;
}

.pos-product-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid rgba(203,213,225,0.75);
    border-radius: 18px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    user-select: none;
    position: relative;
}
.pos-product-card:hover {
    transform: translateY(-3px) scale(1.015);
    box-shadow: var(--pos-shadow-md);
    border-color: var(--pos-primary);
}
.pos-product-card:active {
    transform: scale(0.97);
}
.pos-product-img {
    width: 100%;
    height: 92px;
    object-fit: cover;
    border-radius: 14px;
    margin-bottom: 10px;
    background: #f8fafc;
}
.pos-product-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.25;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 32px;
}
.pos-product-price {
    font-size: 0.9rem;
    font-weight: 800;
    color: #059669;
    background: #ecfdf5;
    padding: 4px 10px;
    border-radius: 999px;
}

/* Right Ticket Panel */
.pos-ticket-panel {
    background: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(246,248,251,0.98) 100%);
    border-radius: 24px;
    border: 1px solid rgba(203,213,225,0.85);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--pos-shadow-sm);
}
.pos-ticket-header {
    padding: 16px 18px;
    background: linear-gradient(180deg, #fcfdff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--pos-card-border);
}
.pos-ticket-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 12px 16px;
}
.pos-ticket-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}
.pos-ticket-row:last-child {
    border-bottom: none;
}
.pos-ticket-footer {
    padding: 18px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid var(--pos-card-border);
}

/* Symmetrical Action Buttons Grid */
.pos-ticket-actions-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.pos-ticket-actions-grid .btn {
    font-size: 0.82rem;
    font-weight: 700;
    min-height: 72px;
    padding: 10px 6px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: normal;
    border-width: 1.5px;
    text-align: center;
    line-height: 1.2;
}
.pos-ticket-action-wide {
    grid-column: span 3;
}
.pos-ticket-action-compact {
    grid-column: span 2;
    min-height: 64px !important;
    font-size: 0.78rem !important;
}
.pos-ticket-actions-grid .btn i {
    font-size: 1rem;
}

/* ====================================================================
   6. KDS (KITCHEN DISPLAY SYSTEM)
   ==================================================================== */
.pos-kds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.pos-kds-ticket {
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
    border-radius: 24px;
    border: 1px solid rgba(203,213,225,0.85);
    box-shadow: var(--pos-shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}
.pos-kds-header {
    background: linear-gradient(135deg, #0f172a 0%, #172554 100%);
    color: #ffffff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pos-kds-items {
    padding: 14px;
    flex-grow: 1;
    overflow-y: auto;
    max-height: 380px;
}
.pos-kds-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed #e2e8f0;
}
.pos-kds-item-row.done {
    opacity: 0.45;
    text-decoration: line-through;
}

/* ====================================================================
   7. PAYMENT & QUICK CASH
   ==================================================================== */
.pos-cash-preset-btn {
    font-size: 0.92rem;
    font-weight: 800;
    min-height: 50px;
    padding: 10px 0;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #cbd5e1;
    color: #1e293b;
    transition: all 0.15s ease;
}
.pos-cash-preset-btn:hover {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
}

.pos-payment-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 6px;
    font-size: 0.82rem;
}
.waiter-top-strip {
    background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(248,250,252,0.92) 100%);
    padding: 8px 10px;
    border-radius: 18px;
    border: 1px solid rgba(203,213,225,0.7);
}
.waiter-order-top {
    border-radius: 0 0 18px 18px;
}
.waiter-table-card {
    border-radius: 20px !important;
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.waiter-table-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--pos-shadow-md) !important;
}

.bg-purple {
    background-color: #7c3aed !important;
}
.text-purple {
    color: #7c3aed !important;
}
.bg-purple-subtle {
    background-color: #f3e8ff !important;
}
.border-purple-subtle {
    border-color: #d8b4fe !important;
}

@media (max-width: 1200px) {
    .pos-hero-grid {
        grid-template-columns: 1fr;
    }
    .pos-hero-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .pos-ticket-actions-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .pos-shell {
        padding-inline: 6px;
        padding-top: 10px;
    }
    .pos-hero-banner {
        padding: 16px;
        border-radius: 18px;
        margin-bottom: 14px;
    }
    .pos-hero-mini-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        margin-top: 12px;
    }
    .pos-hero-mini-stat {
        padding: 8px 10px;
        border-radius: 12px;
    }
    .pos-hero-mini-stat .label {
        font-size: 0.65rem;
    }
    .pos-hero-mini-stat strong {
        font-size: 0.85rem;
    }
    .pos-hero-actions {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .pos-quick-nav-btn {
        min-height: 42px;
        padding: 8px 10px;
        font-size: 0.78rem;
        border-radius: 12px;
    }
    .pos-stat-card {
        border-radius: 16px;
        padding: 12px 14px;
    }
    .pos-stat-value {
        font-size: 1.15rem;
    }
    #posFloorSectionPills {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .pos-pill-tab {
        white-space: nowrap;
        flex-shrink: 0;
    }
    .pos-table-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .pos-table-card {
        border-radius: 16px;
        padding: 12px;
        min-height: 170px;
    }
    .pos-table-number {
        font-size: 0.95rem;
    }
    .pos-table-total {
        font-size: 1.05rem;
    }
    .pos-ticket-actions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .pos-ticket-action-wide,
    .pos-ticket-action-compact {
        grid-column: span 1;
    }
}
@media (max-width: 480px) {
    .pos-table-grid {
        grid-template-columns: 1fr;
    }
}

/* ====================================================================
   8. THERMAL RECEIPT (80mm) PRINT
   ==================================================================== */
#posPrintArea {
    display: none;
}
@media print {
    body * {
        visibility: hidden !important;
    }
    #posPrintArea, #posPrintArea * {
        visibility: visible !important;
    }
    #posPrintArea {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 80mm;
        margin: 0;
        padding: 4mm;
        font-family: 'Courier New', Courier, monospace;
        font-size: 12px;
        color: #000;
        background: #fff;
    }
    .thermal-slip {
        width: 100%;
        text-align: center;
    }
    .thermal-slip .header {
        font-size: 16px;
        font-weight: bold;
        margin-bottom: 4px;
    }
    .thermal-slip .sub {
        font-size: 11px;
        margin-bottom: 8px;
    }
    .thermal-slip .divider {
        border-top: 1px dashed #000;
        margin: 6px 0;
    }
    .thermal-slip .row-line {
        display: flex;
        justify-content: space-between;
        font-size: 12px;
        margin: 3px 0;
    }
    .thermal-slip .total-line {
        font-size: 15px;
        font-weight: bold;
        margin: 6px 0;
    }
    .thermal-slip .footer {
        font-size: 10px;
        margin-top: 10px;
    }
}
