/* ==========================================
   CSS VARIABLES (THEME CONFIGURATION)
   ========================================== */
:root {
    /* Typography */
    --font-primary: 'Montserrat', sans-serif;
    --font-secondary: 'Helvetica Neue', Helvetica, Arial, sans-serif;

    /* Primary Colors */
    --color-primary: #1a1a1a;       /* Main text, primary buttons, active states */
    --color-primary-inverse: #ffffff; /* Text on primary buttons */
    
    /* Accent Colors */
    --color-accent: #e74c3c;        /* Badges, delete text */
    --color-accent-bg: #fff0f0;     /* Delete button background */
    
    /* Secondary Text Colors */
    --color-text-dark: #4a4a4a;     /* Menu links */
    --color-text-medium: #777777;   /* Product descriptions */
    --color-text-light: #888888;    /* Inactive tabs, subtle info */

    /* Backgrounds */
    --bg-main: #ffffff;             /* Headers, cards, menus */
    --bg-page: #fcfcfc;             /* Full screen notes, page background */
    --bg-surface-1: #fafafa;        /* Hover states */
    --bg-surface-2: #f5f5f5;        /* Quantity controls */
    --bg-surface-3: #f0f0f0;        /* Popups, thumbnails, borders */
    
    /* Borders & Overlays */
    --border-light: #eaeaea;        /* Header dividers */
    --border-dark: #cccccc;         /* Dashed QR borders */
    --overlay-dark: rgba(0, 0, 0, 0.7);

    /* Shadows */
    --shadow-sm: 0 -5px 15px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.2);
    --shadow-xl: 0 25px 50px rgba(0,0,0,0.3);
    --shadow-menu: 0 15px 20px rgba(0,0,0,0.03);

    /* Animation Curves */
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.2s ease;
    --transition-snap: 0.1s ease-in;
}

/* --- RESET & BASE --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-primary);
}

/* --- UTILITY CLASSES --- */
body.no-scroll {
    overflow: hidden;
}

/* --- HEADER STYLES --- */
.main-header {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    background-color: var(--bg-main);
    position: sticky; 
    top: 0; 
    z-index: 100;
    font-family: var(--font-secondary);
    border-bottom: 1px solid var(--border-light); 
}

.header-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-primary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.burger-btn {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    z-index: 101; 
}

.burger-btn span {
    display: block;
    width: 28px;
    height: 2px; 
    background-color: var(--color-primary);
    transition: all var(--transition-smooth);
}

/* --- SLIDE-DOWN MENU STYLES --- */
.dropdown-menu {
    position: fixed; 
    top: 80px; 
    left: 0;
    width: 100%;
    background-color: var(--bg-main);
    display: flex;
    flex-direction: column;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
    z-index: 99; 
    box-shadow: var(--shadow-menu);
}

.dropdown-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.menu-link {
    padding: 20px 24px;
    text-decoration: none;
    color: var(--color-text-dark);
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.menu-link:hover {
    background-color: var(--bg-surface-1);
    color: var(--color-primary);
}

.menu-link.home-btn {
    font-weight: 600;
    color: var(--color-text-light);
    font-size: 13px; 
    border-bottom: 1px solid var(--bg-surface-3);
}

/* --- CATEGORY SLIDER STYLES --- */
.category-slider-container {
    background-color: var(--bg-main);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 80px; 
    z-index: 90;
}

.category-slider {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 0 24px;
    gap: 24px;
    -ms-overflow-style: none;  
    scrollbar-width: none;  
}

.category-slider::-webkit-scrollbar { 
    display: none; 
}

.cat-btn {
    background: none;
    border: none;
    padding: 16px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
}

.cat-btn.active {
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
    font-weight: 600;
}

/* --- MENU CONTENT & PRODUCTS --- */
.menu-content {
    padding: 24px;
    min-height: calc(100vh - 130px);
}

.category-section {
    display: none; 
    animation: fadeIn var(--transition-smooth);
}

.category-section.active {
    display: block; 
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- PRODUCT CARD STYLES --- */
.product-card {
    display: flex;
    background: var(--bg-main);
    border-radius: 12px;
    margin-bottom: 32px;
    align-items: center;
    gap: 16px;
}

.product-img-wrapper {
    position: relative;
    line-height: 0;
}

.template-img {
    width: 100%;
}

.thumbnail-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.product-img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    border-radius: 8px;
    background-color: var(--bg-surface-3);
}

.product-info {
    flex: 1;
}

.product-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary);
    margin: 0 0 4px 0;
}

.product-desc {
    font-size: 12px;
    color: var(--color-text-medium);
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
}

/* --- PRODUCT POPUP --- */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-dark);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-smooth);
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-content {
    background: var(--bg-surface-3);
    width: 90%;
    max-width: 420px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    transform: scale(0.95);
    transition: transform var(--transition-smooth);
    box-shadow: var(--shadow-xl);
    will-change: transform; 
}

.popup-overlay.active .popup-content {
    transform: scale(1) translateY(0);
}

.popup-content.swipe-up-out {
    transform: translateY(-100vh) !important;
    transition: transform var(--transition-snap) !important; 
}

.popup-content.swipe-down-out {
    transform: translateY(100vh) !important;
    transition: transform var(--transition-snap) !important;
}

.popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    font-size: 28px;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.popup-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.popup-body {
    padding: 24px;
}

.popup-title-large {
    font-size: 24px;
    margin: 0 0 8px 0;
    color: var(--color-primary);
}

.popup-price-large {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0 0 16px 0;
}

.popup-desc-large {
    font-size: 15px;
    color: var(--color-text-medium);
    line-height: 1.6;
    margin: 0;
}

/* --- POPUP ACTIONS (QTY & ADD) --- */
.popup-action-row {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    align-items: center;
}

.qty-control {
    display: flex;
    align-items: center;
    background: var(--bg-surface-2);
    border-radius: 12px;
    height: 52px;
    padding: 0 4px;
}

.qty-btn {
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    font-size: 20px;
    color: var(--color-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-display {
    width: 28px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    color: var(--color-primary);
}

.add-note-btn {
    flex: 1; 
    margin-top: 0; 
    height: 52px;
    background-color: var(--color-primary);
    color: var(--color-primary-inverse);
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- FLOATING TABLE NOTE BUTTON (FAB) --- */
.note-fab {
    position: fixed;
    bottom: 30px;
    right: 24px;
    width: 60px;
    height: 60px;
    background-color: var(--color-primary);
    color: var(--color-primary-inverse);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 95; 
    transform: scale(0); 
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

.note-fab.visible {
    transform: scale(1);
}

.note-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--color-accent);
    color: var(--color-primary-inverse);
    font-size: 12px;
    font-weight: bold;
    height: 22px;
    min-width: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-sizing: border-box;
    border: 2px solid var(--bg-page); 
}

/* --- FULL SCREEN TABLE NOTE --- */
.full-screen-note {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh; 
    height: 100dvh; 
    background-color: var(--bg-page);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateY(120%); 
    visibility: hidden; 
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
}

.full-screen-note.active {
    transform: translateY(0);
    visibility: visible;
}

.note-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-main);
}

.note-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
}

.note-close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--color-primary);
    cursor: pointer;
}

.note-items {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.note-item-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; 
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--bg-surface-3);
}

.note-item-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--color-primary);
}

.note-item-qty {
    color: var(--color-text-light);
    font-size: 14px;
    margin-top: 4px;
}

.note-item-price {
    font-weight: 600;
    font-size: 16px;
}

.note-item-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.note-qty-btn {
    background: var(--bg-surface-3);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

.note-qty-value {
    font-weight: 600;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.note-item-delete {
    background: var(--color-accent-bg);
    color: var(--color-accent);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px; 
}

.note-footer {
    background: var(--bg-main);
    padding: 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom)); 
    border-top: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.note-total {
    display: flex;
    justify-content: space-between;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
}

.qr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-1);
    border: 1px dashed var(--border-dark);
    border-radius: 12px;
    height: 180px;
    margin-bottom: 24px;
    color: var(--color-text-light);
}

.clear-note-btn {
    width: 100%;
    padding: 16px;
    background: none;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    cursor: pointer;
}