/* ============================================
   THE SNACK STAND - Public Styles
   Mobile-first: 375px base
   ============================================ */

:root {
    --color-primary:        #5c7a8a;
    --color-primary-hover:  #485f6b;
    --color-primary-dark:   #2e424d;
    --color-accent:         #b39748;
    --color-accent-light:   #d2c08f;
    --color-earth:          #917a64;
    --color-earth-muted:    #776b60;
    --color-text:           #555555;
    --color-text-light:     #6b6b6b;
    --color-text-dark:      #484848;
    --color-bg-white:       #ffffff;
    --color-bg-light:       #f2f2f2;
    --color-bg-alt:         #eeeff0;
    --color-border:         #e9e9e9;
    --color-success:        #0c9526;
    --color-success-dark:   #04370e;
    --color-danger:         #bf0f06;
    --color-danger-dark:    #5c0703;
    --color-info:           #1594e5;
    --color-info-dark:      #0c5888;
}

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

html {
    font-size: 17px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'raleway', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--color-text);
    background-color: var(--color-bg-light);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'nocturne-serif', Georgia, 'Times New Roman', serif;
    font-weight: normal;
    color: var(--color-text-dark);
    line-height: 1.3;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    color: var(--color-primary-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* Container */
.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
.public-header {
    background: var(--color-primary-dark);
    color: var(--color-bg-white);
    padding: 16px 0;
    text-align: center;
}

.site-title {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.site-title a {
    color: var(--color-bg-white);
}

.site-subtitle {
    font-size: 0.75rem;
    color: var(--color-accent-light);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Main */
.public-main {
    flex: 1;
    padding: 20px 0;
}

/* Footer */
.public-footer {
    background: var(--color-primary-dark);
    color: var(--color-bg-white);
    text-align: center;
    padding: 16px 0;
    font-size: 0.8rem;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-success {
    background: #e6f4ea;
    color: var(--color-success-dark);
    border: 1px solid #b7dfbf;
}

.alert-error {
    background: #fce8e6;
    color: var(--color-danger-dark);
    border: 1px solid #f5c6c2;
}

.alert-info {
    background: #e8f4fd;
    color: var(--color-info-dark);
    border: 1px solid #b6d9f7;
}

.alert-warning {
    background: #fef7e0;
    color: #7a6100;
    border: 1px solid #f5e6a3;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--color-text-dark);
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--color-text-dark);
    background: var(--color-bg-white);
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    min-height: 48px;
    text-decoration: none;
}

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

.btn-primary {
    background: var(--color-primary);
    color: var(--color-bg-white);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    color: var(--color-bg-white);
}

.btn-full {
    width: 100%;
    height: 56px;
    font-size: 1.1rem;
}

.btn-secondary {
    background: var(--color-bg-alt);
    color: var(--color-text-dark);
}

.btn-secondary:hover {
    background: var(--color-border);
}

.btn-danger {
    background: var(--color-danger);
    color: var(--color-bg-white);
}

.btn-danger:hover {
    background: var(--color-danger-dark);
    color: var(--color-bg-white);
}

.btn-success {
    background: var(--color-success);
    color: var(--color-bg-white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: var(--color-bg-white);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    min-height: 36px;
}

/* Cards */
.card {
    background: var(--color-bg-white);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.6s linear infinite;
}

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

/* Page title */
.page-title {
    font-size: 1.4rem;
    color: var(--color-primary);
    margin-bottom: 20px;
}

/* Category headers */
.category-header {
    font-size: 1.1rem;
    color: var(--color-primary);
    padding: 12px 0 8px;
    border-bottom: 2px solid var(--color-accent);
    margin-bottom: 12px;
    position: sticky;
    top: 0;
    background: var(--color-bg-light);
    z-index: 10;
}

/* Menu item cards */
.menu-item-card {
    background: var(--color-bg-white);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    transition: box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.menu-item-card:active {
    box-shadow: 0 0 0 2px var(--color-primary);
}

.menu-item-card.sold-out {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
}

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

.menu-item-name {
    font-family: 'nocturne-serif', Georgia, serif;
    font-size: 1rem;
    color: var(--color-text-dark);
    margin-bottom: 4px;
}

.sold-out .menu-item-name {
    text-decoration: line-through;
}

.menu-item-desc {
    font-size: 0.8rem;
    color: var(--color-earth-muted);
    line-height: 1.4;
}

.menu-item-price {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 1rem;
    white-space: nowrap;
}

.badge-sold-out {
    display: inline-block;
    background: var(--color-danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    margin-top: 4px;
}

/* Floating cart bar */
.cart-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-primary-dark);
    color: white;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    min-height: 60px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.cart-bar.hidden {
    display: none;
}

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

.cart-count {
    background: var(--color-accent);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-total {
    font-weight: 600;
    font-size: 1rem;
}

.cart-bar .btn {
    background: var(--color-accent);
    color: white;
    padding: 10px 20px;
    min-height: 40px;
}

/* Bottom sheet modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: var(--color-bg-white);
    border-radius: 16px 16px 0 0;
    z-index: 201;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-sheet.active {
    transform: translateY(0);
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    margin: 10px auto;
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px 12px;
    border-bottom: 1px solid var(--color-border);
}

.sheet-header h3 {
    font-size: 1.1rem;
}

.sheet-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--color-bg-alt);
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
}

.sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.sheet-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
}

/* Option groups */
.option-group {
    margin-bottom: 20px;
}

.option-group-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-required {
    font-size: 0.7rem;
    color: var(--color-danger);
    font-weight: 700;
    text-transform: uppercase;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
    min-height: 48px;
    cursor: pointer;
    gap: 12px;
}

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

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--color-primary);
}

.option-label {
    flex: 1;
    font-size: 0.95rem;
}

.option-price {
    font-size: 0.85rem;
    color: var(--color-earth-muted);
}

/* Quantity controls */
.qty-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-btn {
    width: 44px;
    height: 44px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-white);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-dark);
}

.qty-btn:active {
    background: var(--color-bg-alt);
}

.qty-value {
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

/* Order status page */
.order-confirmed {
    text-align: center;
    padding: 24px 0;
}

.order-number-display {
    font-size: 2rem;
    font-family: 'nocturne-serif', Georgia, serif;
    color: var(--color-primary);
    margin: 16px 0;
}

.status-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-preparing {
    background: #cce5ff;
    color: #004085;
}

.status-ready {
    background: #d4edda;
    color: var(--color-success-dark);
}

.status-completed {
    background: var(--color-bg-alt);
    color: var(--color-text-light);
}

.status-cancelled {
    background: #fce8e6;
    color: var(--color-danger-dark);
}

/* Sticky footer bar */
.sticky-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--color-bg-white);
    border-top: 1px solid var(--color-border);
    z-index: 50;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
}

/* Cart item cards */
.cart-item-card {
    background: var(--color-bg-white);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.cart-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.cart-item-name {
    font-family: 'nocturne-serif', Georgia, serif;
    font-size: 1rem;
    color: var(--color-text-dark);
}

.cart-item-remove {
    color: var(--color-danger);
    font-size: 0.85rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
}

.cart-item-options {
    font-size: 0.8rem;
    color: var(--color-earth-muted);
    margin-bottom: 8px;
}

.cart-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-item-total {
    font-weight: 700;
    color: var(--color-primary);
}

/* Order summary */
.order-summary {
    margin-top: 20px;
    padding: 16px;
    background: var(--color-bg-white);
    border-radius: 12px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.95rem;
}

.summary-row.total {
    border-top: 2px solid var(--color-text-dark);
    margin-top: 4px;
    padding-top: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text-dark);
}

/* Padding for fixed bottom elements */
.has-cart-bar {
    padding-bottom: 80px;
}

.has-sticky-footer {
    padding-bottom: 90px;
}

/* Add to cart animation */
.add-flash {
    animation: flashGreen 0.4s ease;
}

@keyframes flashGreen {
    0% { box-shadow: 0 0 0 0 rgba(12, 149, 38, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(12, 149, 38, 0.2); }
    100% { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }
}

/* Responsive: center on larger screens */
@media (min-width: 768px) {
    .container {
        padding: 0 24px;
    }
}

@media (min-width: 1024px) {
    body {
        background: var(--color-bg-alt);
    }

    .public-main {
        padding: 32px 0;
    }

    .container {
        max-width: 480px;
    }
}
