/* ═══════════════════════════════════════════
   Food Ordering System — Styles
   ร้านข้าวแกงเล็กๆ Mobile-First
   ═══════════════════════════════════════════ */

:root {
    --primary: #ff6f00;
    --primary-light: #ffe0b2;
    --primary-dark: #e65100;
    --bg: #fafafa;
    --card-bg: #ffffff;
    --text: #333333;
    --text-light: #777777;
    --border: #eeeeee;
    --success: #4caf50;
    --danger: #f44336;
    --info: #2196f3;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --max-width: 480px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Thai', 'Noto Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    padding-bottom: 100px;
    -webkit-font-smoothing: antialiased;
}

/* ─── Header ─── */
.shop-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    padding: 10px 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.shop-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.shop-header h1 {
    font-size: 1rem;
    line-height: 1.3;
    word-break: break-word;
}

.shop-info {
    flex: 1;
    min-width: 0;
}

.shop-details {
    display: flex;
    flex-wrap: wrap;
    column-gap: 12px;
    row-gap: 1px;
    margin-top: 2px;
}

.shop-address {
    font-size: 0.72rem;
    opacity: 0.85;
}

.shop-hours {
    font-size: 0.7rem;
    opacity: 0.8;
}

.header-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.btn-status {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    line-height: 1.3;
    text-decoration: none;
    display: inline-block;
}

.btn-status:hover {
    background: rgba(255,255,255,0.3);
}

/* ─── Top Nav Breadcrumb ─── */
.top-nav {
    background: #1a1a2e;
    padding: 6px 14px;
    font-size: 0.78rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    border-bottom: 1px solid #2a2f45;
}
.top-nav a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.15s;
    white-space: nowrap;
}
.top-nav a:hover { color: #f1f5f9; }
.top-nav .sep { color: #475569; font-size: 0.7rem; }
.top-nav .current {
    color: #fbbf24;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Shop Banner ─── */
.shop-banner {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    overflow: hidden;
    background: #0f1729;
    border-radius: 0 0 8px 8px;
}
.shop-banner img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* ─── Category Tabs ─── */
.category-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

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

.cat-tab {
    flex-shrink: 0;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fff;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.cat-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    font-weight: 600;
}

/* ─── Menu Grid ─── */
.menu-section {
    padding: 12px 16px;
}

.menu-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
    position: relative;
    transition: transform 0.1s;
}

.menu-item:active {
    transform: scale(0.985);
}

.menu-item.popular {
    border-left: 4px solid var(--primary);
}

.badge-popular {
    position: absolute;
    top: -1px;
    right: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 0 0 6px 6px;
}

.menu-item-info {
    flex: 1;
    min-width: 0;
    padding-right: 8px;
}

.menu-item-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.menu-item-desc {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.menu-item-price {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 1rem;
    margin-top: 4px;
}

.menu-item-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.btn-add {
    width: 38px;
    height: 38px;
    border: 2px solid var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 50%;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    line-height: 1;
}

.btn-add:hover {
    background: var(--primary);
    color: #fff;
}

.item-qty {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    min-height: 1.2em;
}

/* ─── Floating Cart ─── */
.cart-float {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: 0 4px 16px rgba(255,111,0,0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 200;
    cursor: pointer;
    transition: all 0.2s;
    max-width: calc(100% - 32px);
}

.cart-float:active {
    transform: translateX(-50%) scale(0.95);
}

.cart-float-icon {
    font-size: 1.3rem;
}

.cart-float-count {
    background: #fff;
    color: var(--primary-dark);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.cart-float-total {
    font-weight: 700;
    font-size: 0.95rem;
}

/* ─── Modals ─── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 16px 16px 0 0;
    max-width: var(--max-width);
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 16px 20px 24px;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.02); }
}

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

.modal-header h2 {
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 4px;
    line-height: 1;
}

/* ─── Cart Modal ─── */
.cart-items {
    max-height: 50vh;
    overflow-y: auto;
}

.cart-empty {
    text-align: center;
    padding: 40px 0;
    color: #999;
    font-size: 1rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.cart-item-price {
    font-size: 0.8rem;
    color: var(--text-light);
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-qty {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.btn-qty:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.cart-qty {
    font-weight: 700;
    font-size: 1rem;
    min-width: 20px;
    text-align: center;
}

.cart-summary {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 2px solid var(--border);
}

.cart-total-line {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 12px;
}

.cart-grand-total {
    color: var(--primary-dark);
}

/* ─── Buttons ─── */
.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-large {
    padding: 14px;
    font-size: 1.05rem;
}

.btn-secondary {
    width: 100%;
    padding: 10px;
    background: #e8f5e9;
    color: #2e7d32;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-outline {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
}

/* ─── Form ─── */
.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ─── Checkout ─── */
.checkout-items {
    margin: 10px 0;
}

.checkout-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid #eee;
}

/* ─── Payment ─── */
.payment-content {
    text-align: center;
}

.payment-order-info {
    margin-bottom: 16px;
}

.order-no-big {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.order-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 4px;
}

.payment-qr {
    background: #fff;
    border: 3px dashed var(--primary-light);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
}

.payment-qr img {
    max-width: 240px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.payment-instruction {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 14px;
}

.payment-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ─── Status ─── */
.status-form {
    margin-bottom: 14px;
}

.status-divider {
    text-align: center;
    color: #999;
    margin: 8px 0;
    font-size: 0.85rem;
}

.status-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
}

.status-error {
    text-align: center;
    padding: 20px;
    color: var(--danger);
    font-size: 1rem;
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
}

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

.order-badge {
    background: var(--primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1rem;
}

.status-tag {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
}

.status-waiting_payment .status-tag { background: #fff3e0; color: #e65100; }
.status-pending .status-tag { background: #e3f2fd; color: #1565c0; }
.status-preparing .status-tag { background: #f3e5f5; color: #7b1fa2; }
.status-ready .status-tag { background: #e8f5e9; color: #2e7d32; }

.queue-info {
    text-align: center;
    margin-bottom: 14px;
}

.queue-number {
    font-size: 0.9rem;
}

.queue-number strong {
    font-size: 1.4rem;
    color: var(--primary-dark);
}

.queue-ahead {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 4px;
}

.ready-text { color: var(--success) !important; font-weight: 600; }

/* ─── Progress Bar ─── */
.progress-bar {
    display: flex;
    justify-content: space-between;
    margin: 14px 0;
    padding: 0 4px;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.progress-step.done { opacity: 0.7; }
.progress-step.active { opacity: 1; }
.progress-step.done .step-icon,
.progress-step.active .step-icon { transform: scale(1.1); }

.step-icon {
    font-size: 1.3rem;
    transition: transform 0.2s;
}

.step-label {
    font-size: 0.65rem;
    text-align: center;
    color: var(--text-light);
}

.status-items {
    font-size: 0.85rem;
    margin: 10px 0;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
}

.status-items strong {
    display: block;
    margin-bottom: 4px;
}

.status-total {
    font-weight: 700;
    margin-bottom: 10px;
}

/* ─── My Orders List ─── */
.my-order-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin: 6px 0;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.my-order-item:hover {
    background: var(--primary-light);
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
    .shop-header-row { flex-direction: column; }
    .shop-header h1 { max-width: 100%; }
    .shop-address { max-width: 100%; white-space: normal; }
    .header-actions { width: 100%; }
}

@media (min-width: 600px) {
    .shop-header { padding: 12px 20px; }
    .shop-header h1 { font-size: 1.3rem; }
    .category-tabs, .menu-section { padding: 12px 20px; }
    .modal-overlay { align-items: center; }
    .modal-content { border-radius: 16px; max-height: 80vh; }
    .menu-grid { max-width: 600px; margin: 0 auto; }
}

/* ─── Print ─── */
@media print {
    .cart-float, .header-actions, .modal-overlay { display: none !important; }
}
