/* =========================================
   1. RESET & VARIABLES (Vercel/Next.js Theme)
   ========================================= */
:root {
    /* Core Colors - PHP injeta --store-color dinamicamente */
    /* Fallback para preto se não carregar */
    --store-color: #000000; 
    
    /* Neutral Scale */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-surface: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    
    --border-light: #e2e8f0;
    --border-hover: #cbd5e1;
    
    /* Semantic */
    --success: #10b981;
    --danger: #ef4444;
    
    /* Layout */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-float: 0 10px 40px -10px rgba(0, 0, 0, 0.2);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'SF Mono', 'Roboto Mono', monospace;
}

#qr-nocs-app * {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

#qr-nocs-app {
    font-family: var(--font-sans);
    color: var(--text-primary);
    line-height: 1.5;
    background-color: var(--bg-body);
    min-height: 100vh;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 0 50px rgba(0,0,0,0.05);
    position: relative;
    padding-bottom: 120px;
}

/* =========================================
   2. HEADER & STORE INFO
   ========================================= */
.qr-header {
    background: var(--bg-card);
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
}

.qr-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}

.qr-logo, .qr-logo-placeholder {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 1px solid var(--border-light);
    flex-shrink: 0;
}

.qr-logo-placeholder {
    background: var(--store-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
}

.qr-info h1 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px 0;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.qr-phone {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 6px 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.qr-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.qr-badge.open { background: #dcfce7; color: #15803d; }
.qr-badge.closed { background: #fee2e2; color: #b91c1c; }
.qr-badge.loading { background: var(--bg-surface); color: var(--text-secondary); }

/* =========================================
   3. CATEGORY NAV (Sticky)
   ========================================= */
.qr-cat-nav {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 90;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.qr-cat-nav::-webkit-scrollbar { display: none; }

.qr-cat-link {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.qr-cat-link.active {
    background: var(--store-color);
    color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* =========================================
   4. MENU LIST
   ========================================= */
#qr-menu-list { padding: 24px 20px; }
.qr-menu-section { margin-bottom: 40px; }

.qr-cat-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 16px 0;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.qr-items-grid { display: grid; gap: 16px; }

.qr-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    gap: 16px;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.1s;
}

.qr-item-card:active {
    transform: scale(0.98);
    border-color: var(--border-hover);
}

.qr-item-info { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.qr-item-name { font-size: 15px; font-weight: 600; margin: 0 0 4px 0; color: var(--text-primary); }
.qr-item-desc { font-size: 13px; color: var(--text-secondary); margin: 0 0 10px 0; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qr-item-price { font-size: 14px; font-weight: 600; color: var(--store-color); }

.qr-item-thumb {
    width: 96px;
    height: 96px;
    border-radius: var(--radius-sm);
    background-size: cover;
    background-position: center;
    background-color: var(--bg-surface);
    flex-shrink: 0;
}

.qr-loader-container { text-align: center; padding: 60px 0; color: var(--text-secondary); }

.qr-spinner {
    width: 24px; height: 24px; border: 2px solid var(--border-light);
    border-top-color: var(--store-color); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================
   5. MODAL
   ========================================= */
.qr-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1000; display: flex; align-items: flex-end; justify-content: center;
    visibility: hidden; opacity: 0; transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.qr-modal.visible { visibility: visible; opacity: 1; }

.qr-modal-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
}

.qr-modal-content {
    background: var(--bg-card); width: 100%; max-width: 600px;
    max-height: 92vh; border-radius: 24px 24px 0 0;
    position: relative; z-index: 1001;
    display: flex; flex-direction: column;
    transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
}
.qr-modal.visible .qr-modal-content { transform: translateY(0); }

@media(min-width: 768px) {
    .qr-modal { align-items: center; }
    .qr-modal-content { border-radius: 24px; max-height: 85vh; transform: translateY(20px); opacity: 0; }
    .qr-modal.visible .qr-modal-content { transform: translateY(0); opacity: 1; }
}

.qr-close-modal {
    position: absolute; top: 16px; right: 16px; width: 32px; height: 32px;
    border-radius: 50%; border: none; background: rgba(0,0,0,0.05);
    color: var(--text-primary); font-size: 20px; display: flex; 
    align-items: center; justify-content: center; cursor: pointer; z-index: 10;
}

.qr-modal-header { position: relative; flex-shrink: 0; }
.qr-modal-img { width: 100%; height: 220px; object-fit: cover; }
.qr-modal-header h3 { padding: 20px 24px 0; margin: 0; font-size: 22px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
#qr-item-description { padding: 8px 24px 20px; font-size: 15px; color: var(--text-secondary); line-height: 1.5; border-bottom: 1px solid var(--border-light); }

.qr-modal-body { overflow-y: auto; padding: 24px; flex: 1; -webkit-overflow-scrolling: touch; }

/* --- OPÇÕES (RÁDIO E CHECKBOX) --- */
.qr-section-title {
    font-size: 12px; font-weight: 700; color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 0.05em;
    margin: 24px 0 12px;
}
.qr-section-title:first-child { margin-top: 0; }

.qr-options-list { display: flex; flex-direction: column; gap: 8px; }

.qr-radio-option, .qr-checkbox-option {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px; background: var(--bg-card);
    border: 1px solid var(--border-light); border-radius: var(--radius-md);
    cursor: pointer; transition: all 0.2s;
}

.qr-radio-option:active, .qr-checkbox-option:active {
    background-color: var(--bg-surface); transform: scale(0.99);
}

.qr-radio-option:has(input:checked), .qr-checkbox-option:has(input:checked) {
    border-color: var(--store-color); background-color: #fafafa;
}

.qr-radio-option input, .qr-checkbox-option input {
    accent-color: var(--store-color); width: 20px; height: 20px;
}

.qr-checkbox-option input[type="checkbox"] {
    margin-right: 12px; border-radius: 4px;
}

.opt-info { margin-left: 12px; flex: 1; display: flex; flex-direction: column; }
.opt-name { font-weight: 600; font-size: 15px; color: var(--text-primary); }
.opt-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.opt-price { font-weight: 600; font-size: 14px; color: var(--text-primary); }

/* --- CONTROLE DE PESO GRANULAR (SELF-SERVICE) --- */
.qr-weight-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.qr-weight-row:last-child {
    border-bottom: none;
}

.w-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 15px;
}

.w-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-w-mini {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background: #fff;
    color: var(--store-color);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
}

.btn-w-mini:active {
    background: var(--bg-surface);
    transform: scale(0.95);
}

.w-val {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 15px;
    min-width: 45px;
    text-align: center;
    color: var(--text-primary);
}

/* Pizza Split Select */
#qr-pizza-split-select {
    width: 100%; padding: 14px; font-size: 15px;
    border: 1px solid var(--border-light); border-radius: var(--radius-md);
    background: #fff; color: var(--text-primary); appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
}

#qr-pizza-split-select:focus {
    outline: none; border-color: var(--store-color);
}

.qr-field-group { margin-top: 24px; }
.qr-field-group label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; color: var(--text-primary); }
textarea#qr-item-obs {
    width: 100%; border: 1px solid var(--border-light); border-radius: var(--radius-md);
    padding: 14px; font-family: inherit; font-size: 15px; resize: none; height: 100px;
    background: var(--bg-surface); transition: background 0.2s;
}
textarea#qr-item-obs:focus { background: #fff; border-color: var(--store-color); outline: none; }

/* =========================================
   6. FOOTER & FLOAT CART
   ========================================= */
.qr-modal-footer {
    padding: 16px 24px 32px; background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    display: flex; gap: 16px; align-items: center; flex-shrink: 0;
}

.qr-qty-control {
    display: flex; align-items: center; background: var(--bg-surface);
    border-radius: 99px; padding: 4px; height: 52px; flex-shrink: 0;
}

.qr-qty-control button {
    width: 40px; height: 100%; border: none; border-radius: 50%;
    background: #fff; font-size: 18px; font-weight: 600; color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); cursor: pointer;
}
.qr-qty-control button:active { background: var(--border-light); }

#qr-item-qty {
    width: 36px; text-align: center; font-weight: 600; font-size: 16px;
    font-variant-numeric: tabular-nums;
}

.btn-primary {
    flex: 1; height: 52px; background: var(--store-color); color: #fff;
    border: none; border-radius: 99px; font-weight: 600; font-size: 16px;
    cursor: pointer; display: flex; justify-content: space-between; padding: 0 24px;
    align-items: center; transition: transform 0.1s, background 0.2s;
}
.btn-primary:active { transform: scale(0.97); filter: brightness(0.9); }

.qr-cart-float {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    width: calc(100% - 40px); max-width: 560px;
    background: var(--store-color); color: #fff;
    padding: 14px 24px; border-radius: 99px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: var(--shadow-float); z-index: 900; cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.qr-cart-float.hidden { transform: translate(-50%, 200%); }

.qr-cart-summary { display: flex; align-items: center; gap: 12px; }
.qr-cart-count {
    background: rgba(255,255,255,0.2); width: 28px; height: 28px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
}
.qr-cart-text { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.qr-cart-value { font-weight: 700; font-size: 16px; }

.qr-no-scroll { overflow: hidden; }
.skeleton-nav { height: 40px; width: 100%; background: var(--bg-surface); border-radius: 20px; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }