/* ============ VARIABLES ============ */
:root {
    --bg-color: #f9dba4;
    --card-bg: #ffffff;
    --primary: #ff9900;
    --primary-dark: #e68a00;
    --text: #2d2d2d;
    --text-light: #666666;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --radius: 16px;
}

/* ============ RESET & BASE ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
}

/* ============ LOADING BAR ============ */
.loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 153, 0, 0.2);
    z-index: 9999;
}

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

.loading-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    transition: width 0.15s ease;
}

/* ============ HEADER ============ */
.menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 100;
    flex-shrink: 0;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 10px;
}

.back-btn svg {
    width: 20px;
    height: 20px;
}

.header-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
}

.page-indicator {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    min-width: 60px;
    text-align: right;
}

/* ============ CATEGORIES ============ */
.categories-wrapper {
    background: white;
    padding: 10px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.categories {
    display: flex;
    gap: 8px;
    padding: 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.categories::-webkit-scrollbar {
    display: none;
}

.category-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    border: none;
    background: #f5f5f5;
    border-radius: 20px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

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

/* ============ MENU CONTAINER ============ */
.menu-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    overflow: hidden;
    position: relative;
}

/* ============ SLIDER ============ */
.slider {
    width: 100%;
    height: 100%;
    max-width: 500px;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Constrain by aspect ratio to fit A4 menu pages */
@supports (aspect-ratio: 210 / 297) {
    .slider {
        aspect-ratio: 210 / 297;
        height: auto;
        max-height: 100%;
    }
}

.slider-track {
    display: flex;
    height: 100%;
    transition: transform 0.3s ease-out;
}

.slide {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    position: relative;
    background: white;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: white;
}

.slide img.loading {
    opacity: 0;
}

.slide img.loaded {
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* ============ PAGE LOADING ============ */
.page-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
}

.page-progress-container {
    width: 60%;
    max-width: 180px;
    text-align: center;
}

.page-progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.page-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 3px;
    transition: width 0.1s ease;
}

.page-progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

/* ============ PAGE NUMBER ============ */
.page-number {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 8px;
    border-radius: 10px;
}

/* ============ NAVIGATION ============ */
.nav-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 50;
    pointer-events: none;
}

.nav-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    pointer-events: auto;
}

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

.nav-btn:not(:disabled):active {
    transform: scale(0.92);
    background: var(--primary);
}

.nav-btn:not(:disabled):active svg {
    color: white;
}

.nav-btn svg {
    width: 22px;
    height: 22px;
    color: var(--text);
}

/* ============ SWIPE HINT ============ */
.swipe-hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 50;
    animation: fadeInOut 3s ease forwards;
}

.swipe-hint.hidden {
    display: none;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* ============ VENUE MODAL ============ */
.venue-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.venue-modal.hidden {
    display: none;
}

.venue-modal-content {
    background: white;
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 340px;
    text-align: center;
    position: relative;
}

.venue-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.venue-modal-close svg {
    width: 18px;
    height: 18px;
    color: var(--text-light);
}

.venue-modal h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text);
}

.venue-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 16px;
    border: 2px solid #eee;
    border-radius: 14px;
    background: white;
    cursor: pointer;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.venue-btn:last-child {
    margin-bottom: 0;
}

.venue-btn:hover {
    border-color: var(--primary);
}

.venue-btn-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.venue-btn-text {
    text-align: left;
}

.venue-btn-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
}

.venue-btn-address {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

/* ============ RESPONSIVE ============ */

/* Small phones */
@media (max-width: 380px) {
    .menu-header {
        padding: 8px 10px;
    }
    
    .back-btn {
        font-size: 12px;
        padding: 6px 8px;
    }
    
    .header-title {
        font-size: 13px;
    }
    
    .page-indicator {
        font-size: 12px;
        min-width: 50px;
    }
    
    .categories {
        padding: 0 10px;
    }
    
    .category-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .menu-container {
        padding: 8px;
    }
    
    .nav-btn {
        width: 42px;
        height: 42px;
    }
    
    .nav-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* Medium phones */
@media (max-width: 480px) {
    .menu-header {
        padding: 10px 12px;
    }
    
    .header-title {
        font-size: 14px;
    }
    
    .slider {
        border-radius: 8px;
    }
}

/* Very short screens (landscape or small devices) */
@media (max-height: 600px) {
    .menu-container {
        padding: 6px;
    }
    
    .categories-wrapper {
        padding: 6px 0;
    }
    
    .category-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .nav-controls {
        bottom: 10px;
        gap: 15px;
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
    }
    
    .nav-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .swipe-hint {
        bottom: 60px;
        padding: 8px 16px;
        font-size: 12px;
    }
}

/* Very short screens */
@media (max-height: 500px) {
    .menu-header {
        padding: 6px 10px;
    }
    
    .back-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .categories-wrapper {
        padding: 4px 0;
    }
    
    .menu-container {
        padding: 4px;
    }
}

/* Large screens / tablets */
@media (min-width: 768px) {
    .slider {
        max-width: 450px;
    }
    
    .nav-btn {
        width: 54px;
        height: 54px;
    }
    
    .nav-btn svg {
        width: 26px;
        height: 26px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .slider {
        max-width: 500px;
    }
}
