/* White Swan - Southern Fried Chicken */
/* Light mode (default) + Dark mode via data-theme="dark" */
/* Colour scheme: Charcoal grey from logo + gold accents */

:root {
    --gold: #d4af37;
    --gold-dark: #b8960c;
    --gold-light: #e8c84a;
    --charcoal: #5a5a5a;
    --charcoal-dark: #3d3d3d;
    --bg-body: #f5f5f5;
    --bg-header: #5a5a5a;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-panel: #ffffff;
    --text-primary: #333333;
    --text-secondary: #5a5a5a;
    --text-muted: #999999;
    --text-on-header: #ffffff;
    --border: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.18);
    --in-order-bg: rgba(212, 175, 55, 0.1);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.12);
    --success: #4caf50;
    --error: #e53935;
}

[data-theme="dark"] {
    --bg-body: #1a1a1a;
    --bg-header: #2a2a2a;
    --bg-card: #2a2a2a;
    --bg-input: #333333;
    --bg-panel: #222222;
    --text-primary: #f0f0f0;
    --text-secondary: #cccccc;
    --text-muted: #888888;
    --text-on-header: #ffffff;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.18);
    --in-order-bg: rgba(212, 175, 55, 0.12);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.4);
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    transition: background-color 0.3s, color 0.3s;
}

/* ===== Header ===== */
.header {
    background-color: var(--bg-header);
    padding: 16px 16px 14px;
    padding-top: calc(16px + env(safe-area-inset-top, 0));
    text-align: center;
    border-bottom: 3px solid var(--gold);
    position: sticky;
    top: 0;
    z-index: 50;
    transition: background-color 0.3s;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 8px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.logo {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.header-text h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.subtitle {
    font-family: 'Playfair Display', serif;
    font-size: 0.8rem;
    color: var(--gold);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.tagline {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    max-width: 480px;
    margin: 0 auto 4px;
    font-style: italic;
}

.serving-time {
    font-size: 0.72rem;
    color: var(--gold);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle:active {
    background: rgba(255, 255, 255, 0.25);
}

.theme-icon {
    font-size: 1.1rem;
    line-height: 1;
    color: #ffffff;
    transition: transform 0.3s;
}

/* ===== Layout ===== */
.layout {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 120px);
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px;
    flex: 1;
}

/* ===== Menu Sections ===== */
.menu-section {
    margin-top: 20px;
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--charcoal);
    padding-bottom: 6px;
    border-bottom: 2px solid var(--gold);
    margin-bottom: 4px;
    transition: color 0.3s;
}

[data-theme="dark"] .section-title {
    color: var(--gold);
}

.section-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 4px;
}

/* ===== Menu Items ===== */
.menu-items {
    display: flex;
    flex-direction: column;
}

.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    gap: 10px;
    transition: background-color 0.2s, padding 0.2s, margin 0.2s;
}

.menu-item.in-order {
    background-color: var(--in-order-bg);
    margin: 0 -10px;
    padding: 10px;
    border-radius: 8px;
    border-bottom-color: transparent;
}

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

.item-name {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    transition: color 0.3s;
}

.item-desc {
    display: block;
    font-size: 0.73rem;
    color: var(--text-muted);
    margin-top: 1px;
    transition: color 0.3s;
}

.item-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.item-price {
    font-weight: 700;
    color: var(--charcoal);
    font-size: 0.9rem;
    min-width: 48px;
    text-align: right;
    transition: color 0.3s;
}

[data-theme="dark"] .item-price {
    color: var(--gold);
}

/* ===== Quantity Controls ===== */
.qty-controls {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    transition: background-color 0.3s, border-color 0.3s;
}

.qty-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: var(--charcoal);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, color 0.3s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

[data-theme="dark"] .qty-btn {
    color: var(--gold);
}

.qty-btn:active {
    background: var(--in-order-bg);
}

.qty-btn.minus {
    border-radius: 8px 0 0 8px;
}

.qty-btn.plus {
    border-radius: 0 8px 8px 0;
}

.qty-count {
    min-width: 26px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: color 0.3s;
}

/* ===== Order Panel ===== */
/* Mobile: fixed bottom bar */
.order-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-panel);
    border-top: 3px solid var(--gold);
    z-index: 100;
    transition: transform 0.3s ease, background-color 0.3s;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: var(--shadow-lg);
    transform: translateY(100%);
}

.order-panel.visible {
    transform: translateY(0);
}

.panel-sticky {
    display: flex;
    flex-direction: column;
    max-height: 70vh;
}

.panel-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
    gap: 8px;
}

.panel-title {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--charcoal);
    transition: color 0.3s;
}

[data-theme="dark"] .panel-title {
    color: var(--gold);
}

.panel-badge {
    background: var(--gold);
    color: #000;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.panel-chevron {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: transform 0.3s;
}

.panel-chevron.open {
    transform: rotate(180deg);
}

.panel-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: none;
    flex: 1;
}

.panel-body.open {
    display: flex;
    flex-direction: column;
}

.panel-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.panel-empty-sub {
    font-size: 0.75rem;
    margin-top: 4px;
}

.panel-items-list {
    padding: 0 16px;
    flex: 1;
}

.panel-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.panel-item-name {
    color: var(--text-primary);
    flex: 1;
    transition: color 0.3s;
}

.panel-item-qty {
    color: var(--text-muted);
    margin: 0 8px;
    font-size: 0.8rem;
}

.panel-item-price {
    color: var(--charcoal);
    font-weight: 700;
    min-width: 50px;
    text-align: right;
    transition: color 0.3s;
}

[data-theme="dark"] .panel-item-price {
    color: var(--gold);
}

.panel-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 2px solid var(--gold);
    background: var(--charcoal);
    margin-top: auto;
}

[data-theme="dark"] .panel-total {
    background: #111;
}

.panel-total span:first-child {
    font-weight: 700;
    font-size: 1rem;
    color: #ffffff;
}

.panel-total-price {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--gold) !important;
}

/* ===== Order Form ===== */
.order-form-section {
    margin-top: 28px;
    padding-bottom: 120px;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 6px;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    transition: border-color 0.2s, background-color 0.3s, color 0.3s;
    -webkit-appearance: none;
    appearance: none;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d4af37' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

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

.form-group input.invalid,
.form-group select.invalid {
    border-color: var(--error);
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-style: italic;
    transition: color 0.3s;
}

/* ===== Submit Button ===== */
.submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: var(--gold);
    color: #000;
    border: none;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    margin-top: 8px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.submit-btn:hover:not(:disabled) {
    background: var(--gold-light);
}

.submit-btn:active:not(:disabled) {
    background: var(--gold-dark);
}

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

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.hidden {
    display: none !important;
}

/* ===== Success Message ===== */
.success-message {
    text-align: center;
    padding: 60px 20px 100px;
}

.success-icon {
    width: 64px;
    height: 64px;
    background: var(--success);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 20px;
}

.success-message h2 {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    font-size: 1.6rem;
    margin-bottom: 12px;
}

.success-message p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.success-message .submit-btn {
    margin-top: 24px;
    max-width: 300px;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 24px 20px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

.footer p {
    font-family: 'Playfair Display', serif;
    color: var(--charcoal);
    font-size: 0.95rem;
    transition: color 0.3s;
}

[data-theme="dark"] .footer p {
    color: var(--gold);
}

.footer-sub {
    font-family: 'Inter', sans-serif !important;
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
    margin-top: 4px;
}

/* ===== Error Toast ===== */
.error-toast {
    position: fixed;
    top: 20px;
    top: calc(20px + env(safe-area-inset-top, 0));
    left: 50%;
    transform: translateX(-50%);
    background: var(--error);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 200;
    animation: slideDown 0.3s ease;
    max-width: 90%;
    text-align: center;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ===== Desktop: Side Panel Layout ===== */
@media (min-width: 768px) {
    .header {
        padding: 20px 24px 16px;
    }

    .header-text h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .logo {
        width: 52px;
        height: 52px;
    }

    .tagline {
        font-size: 0.8rem;
    }

    .serving-time {
        font-size: 0.78rem;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
    }

    .layout {
        flex-direction: row;
        max-width: 1100px;
        margin: 0 auto;
        gap: 0;
    }

    .container {
        flex: 1;
        max-width: none;
        padding: 0 24px;
        min-width: 0;
    }

    /* Right-side panel on desktop */
    .order-panel {
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        transform: none !important;
        width: 320px;
        min-width: 320px;
        max-height: none;
        border-top: none;
        border-left: 1px solid var(--border);
        box-shadow: none;
        padding-bottom: 0;
        z-index: 1;
        background: var(--bg-panel);
    }

    .panel-sticky {
        position: sticky;
        top: 100px;
        max-height: calc(100vh - 120px);
    }

    .panel-header {
        cursor: default;
    }

    .panel-chevron {
        display: none;
    }

    .panel-body {
        display: flex !important;
        flex-direction: column;
    }

    .panel-items-list {
        max-height: calc(100vh - 310px);
        overflow-y: auto;
    }

    .order-form-section {
        padding-bottom: 40px;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .item-name {
        font-size: 0.92rem;
    }
}

/* ===== Large Desktop ===== */
@media (min-width: 1024px) {
    .header-text h1 {
        font-size: 2rem;
    }

    .logo {
        width: 56px;
        height: 56px;
    }

    .order-panel {
        width: 350px;
        min-width: 350px;
    }
}

/* ===== Small Mobile ===== */
@media (max-width: 374px) {
    .header-text h1 {
        font-size: 1.2rem;
    }

    .subtitle {
        font-size: 0.72rem;
    }

    .item-name {
        font-size: 0.82rem;
    }

    .item-price {
        font-size: 0.82rem;
        min-width: 42px;
    }

    .qty-btn {
        width: 34px;
        height: 34px;
    }

    .item-right {
        gap: 6px;
    }

    .theme-toggle {
        width: 32px;
        height: 32px;
    }

    .theme-icon {
        font-size: 1rem;
    }
}

/* ===== Sauce Selection Modal ===== */
.sauce-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.sauce-modal-overlay.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sauce-modal {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px 24px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.sauce-modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--charcoal);
    margin-bottom: 4px;
}

[data-theme="dark"] .sauce-modal-title {
    color: var(--gold);
}

.sauce-modal-burger {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.sauce-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.sauce-option {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 2px solid var(--border-strong);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.sauce-option:active {
    border-color: var(--gold);
    background: var(--in-order-bg);
}

.sauce-cancel {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Panel sauce sub-lines */
.panel-item-sauces {
    padding: 0 0 6px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.panel-item-sauce {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}
