/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-dark);
    box-shadow: 0 6px 20px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.btn-icon {
    padding: 10px;
    border-radius: 50%;
    aspect-ratio: 1;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 12px;
}

.btn-lg {
    padding: 16px 28px;
    font-size: 16px;
}

.btn-full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 15px;
    transition: all var(--transition);
    outline: none;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .form-input {
    padding-left: 44px;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 20px;
    pointer-events: none;
}

.input-wrapper .input-action {
    position: absolute;
    right: 14px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
    transition: color var(--transition);
}

.input-wrapper .input-action:hover {
    color: var(--text-primary);
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
}

/* ===== CHIPS / BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge-available {
    background: var(--status-available-bg);
    color: var(--status-available);
}

.badge-occupied {
    background: var(--status-occupied-bg);
    color: var(--status-occupied);
}

.badge-bill {
    background: var(--status-bill-bg);
    color: var(--status-bill);
}

.badge-accent {
    background: rgba(227, 90, 43, 0.15);
    color: var(--accent);
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 16px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    transition: all var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font-main);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.nav-item .material-icons {
    font-size: 24px;
    transition: color var(--transition);
}

.nav-item.active {
    color: var(--accent);
}

.nav-item.active .material-icons {
    color: var(--accent);
}

.nav-item:hover {
    color: var(--text-primary);
}

/* FAB */
.fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px var(--accent-glow);
    transition: all var(--transition);
    font-size: 24px;
}

.fab:hover {
    background: var(--accent-dark);
    transform: scale(1.05);
}

/* ===== TABLE CARD ===== */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.table-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    border-color: var(--border-accent);
}

.table-card.available {
    border-left: 3px solid var(--status-available);
}

.table-card.occupied {
    border-left: 3px solid var(--status-occupied);
}

.table-card.bill_requested {
    border-left: 3px solid var(--status-bill);
}

.table-card-number {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-display);
}

.table-card-status {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.table-card-status.available {
    color: var(--status-available);
}

.table-card-status.occupied {
    color: var(--status-occupied);
}

.table-card-status.bill_requested {
    color: var(--status-bill);
}

.table-card-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.table-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.table-card-badge.available {
    background: var(--status-available);
}

.table-card-badge.occupied {
    background: var(--status-occupied);
}

.table-card-badge.bill_requested {
    background: var(--status-bill);
}

/* ===== PRODUCT CARD ===== */
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
}

.product-card-img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    background: var(--bg-secondary);
}

.product-card-img-placeholder {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 32px;
}

.product-card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.product-card-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.product-card-price {
    font-size: 15px;
    font-weight: 800;
    color: var(--accent);
    font-family: var(--font-display);
}

.product-card-add {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all var(--transition);
    box-shadow: 0 2px 8px var(--accent-glow);
}

.product-card-add:hover {
    background: var(--accent-dark);
    transform: scale(1.1);
}

.product-card.out-of-stock {
    opacity: 0.6;
    cursor: not-allowed;
}

.product-card-out-overlay {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    min-width: 260px;
    max-width: 400px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-elevated);
    animation: slideDown 0.3s ease;
    pointer-events: all;
    font-size: 14px;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.warning {
    border-left: 3px solid var(--warning);
}

.toast.info {
    border-left: 3px solid var(--info);
}

.toast-icon {
    font-size: 20px;
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error .toast-icon {
    color: var(--danger);
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 500;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.center-modal {
    align-items: center;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 24px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-overlay.center-modal .modal {
    border-radius: var(--radius-lg);
    max-width: 400px;
}

.modal-handle {
    width: 40px;
    height: 4px;
    background: var(--border-color);
    border-radius: var(--radius-full);
    margin: 0 auto 20px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 24px;
    transition: color var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ===== SECTION HEADER ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-display);
}

/* ===== DIVIDER ===== */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

/* ===== ORDER ITEM ROW ===== */
.order-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.order-item-row:last-child {
    border-bottom: none;
}

.order-item-qty-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all var(--transition);
}

.qty-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.order-item-qty {
    font-size: 16px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.order-item-info {
    flex: 1;
}

.order-item-name {
    font-size: 14px;
    font-weight: 600;
}

.order-item-note {
    font-size: 12px;
    color: var(--text-muted);
}

.order-item-price {
    font-weight: 700;
    color: var(--accent);
    font-size: 15px;
}

/* ===== TOGGLE SWITCH ===== */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle input:checked+.toggle-slider {
    background: rgba(227, 90, 43, 0.2);
    border-color: var(--accent);
}

.toggle input:checked+.toggle-slider:before {
    transform: translateX(20px);
    background: var(--accent);
}

/* ===== ANIMATIONS ===== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(60px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    75% {
        transform: translateX(8px);
    }
}

/* Loading spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

    100% {
        background-position: -200% 0;
    }
}

/* ===== CHIP FILTER TABS ===== */
.filter-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-tab {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-family: var(--font-main);
}

.filter-tab.active,
.filter-tab:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ===== KPI CARD ===== */
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kpi-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.kpi-value {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-display);
}

.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== AVATAR ===== */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== APP LAYOUT ===== */
.app-container {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    max-width: 540px;
    margin: 0 auto;
    position: relative;
}

.page-content {
    flex: 1;
    padding: 16px;
    padding-bottom: 80px;
    overflow-y: auto;
}

.view {
    display: none;
}

.view.active {
    display: flex;
    flex-direction: column;
}

/* ===== APP HEADER ===== */
.app-header {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: 20px;
    font-weight: 800;
    font-family: var(--font-display);
}

.header-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== SEARCH BAR ===== */
.search-bar-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.search-bar {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all var(--transition);
    font-family: var(--font-main);
}

.search-bar:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-bar::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 20px;
    pointer-events: none;
}

/* ===== FLOATING ORDER SUMMARY ===== */
.order-float {
    position: fixed;
    bottom: 72px;
    left: 16px;
    right: 16px;
    max-width: 508px;
    margin: 0 auto;
    background: var(--accent);
    border-radius: var(--radius-full);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    box-shadow: 0 8px 24px var(--accent-glow);
    transition: all var(--transition);
    z-index: 90;
    animation: slideUp 0.3s ease;
}

.order-float:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px var(--accent-glow);
}

.order-float-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.order-float-badge {
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-full);
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}

.order-float-total {
    font-size: 17px;
    font-weight: 800;
    font-family: var(--font-display);
}

/* ===== CHECKOUT TOTAL BOX ===== */
.checkout-total-box {
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}

.checkout-total-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.checkout-total-amount {
    font-size: 40px;
    font-weight: 900;
    font-family: var(--font-display);
}

/* ===== PAYMENT METHOD BUTTON ===== */
.payment-btn {
    flex: 1;
    padding: 20px 16px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 600;
}

.payment-btn .material-icons {
    font-size: 32px;
}

.payment-btn.selected {
    border-color: var(--accent);
    background: rgba(227, 90, 43, 0.1);
    color: var(--text-primary);
}

.payment-btn.selected .material-icons {
    color: var(--accent);
}