/* Recent quick-add chips */
.recent-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.recent-chips::-webkit-scrollbar { display: none; }

.recent-chip {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.recent-chip:active {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
}

.recent-chip-cal {
    color: var(--text-dim);
    font-size: 11px;
}

/* Capture Mode Tabs — matches + menu style */
.capture-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 16px;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

.capture-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border: none;
    background: none;
    padding: 8px 4px;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 500;
    transition: color 0.2s;
}

.capture-tab.active {
    color: var(--text);
}

.capture-tab-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
}

.capture-tab:active .capture-tab-icon {
    transform: scale(0.9);
}

.capture-tab-icon svg {
    width: 22px;
    height: 22px;
}

.capture-tab.active .capture-tab-icon {
    box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
}


/* Capture panels */
.capture-panel { display: none; }
.capture-panel.active { display: block; }

/* Manual form */
.manual-form-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.manual-row {
    display: flex;
    gap: 8px;
}

.manual-row input[type="text"] { flex: 1; }

.manual-macros input {
    flex: 1;
    min-width: 0;
}

#manual-lookup-btn {
    white-space: nowrap;
    padding: 8px 12px;
}

#manual-lookup-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Photo */
.photo-section { text-align: center; }

.photo-input-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    background: var(--bg-input);
    border: 2px dashed var(--border-strong);
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-muted);
    transition: border-color 0.2s, background 0.2s;
}

.photo-input-label:hover {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

#photo-input { display: none; }

#photo-preview {
    display: none;
    width: 100%;
    border-radius: 12px;
    margin: 12px auto;
    object-fit: contain;
}

/* Camera views */
#photo-viewfinder,
#menu-viewfinder {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

#photo-video,
#menu-video {
    display: none;
    width: 100%;
    background: #000;
}

.photo-shutter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.9;
    padding: 0;
    z-index: 2;
    transition: opacity 0.15s, transform 0.15s;
}

.photo-shutter:active {
    opacity: 1;
    transform: translateX(-50%) scale(0.9);
}

#barcode-reader {
    border-radius: 12px;
    overflow: hidden;
}

#barcode-reader video {
    border-radius: 12px;
}

#barcode-result {
    text-align: center;
    color: var(--text-dim);
    margin: 8px 0;
    font-size: 13px;
}

/* Voice */
.voice-section { text-align: center; }

#voice-btn {
    padding: 16px 32px;
    font-size: 16px;
    border-radius: 50px;
}

#voice-btn.listening {
    background: #ef4444;
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
    70% { box-shadow: 0 0 0 12px rgba(239,68,68,0); }
    100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

#voice-indicator {
    display: none;
    text-align: center;
    color: #ef4444;
    font-size: 13px;
    margin-top: 8px;
    animation: blink 1s infinite;
}

@keyframes blink {
    50% { opacity: 0.5; }
}

#voice-transcript {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: 8px;
    min-height: 40px;
    font-size: 14px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Pending items review */
.pending-header {
    font-size: 15px;
    margin-bottom: 8px;
    color: var(--text);
}

.confidence {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.confidence-high { background: rgba(16,185,129,0.2); color: #10b981; }
.confidence-medium { background: rgba(245,158,11,0.2); color: #f59e0b; }
.confidence-low { background: rgba(239,68,68,0.2); color: #ef4444; }

.pending-notes {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
}

.pending-item {
    background: var(--bg-input);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 6px;
}

.pending-item label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text);
}

.item-name { font-weight: 500; }
.item-portion { color: var(--text-dim); font-size: 12px; }

.unit-select {
    width: calc(100% - 22px);
    margin-left: 22px;
    margin-top: 4px;
    padding: 5px 8px;
    font-size: 12px;
    color: var(--text);
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    cursor: pointer;
    appearance: auto;
}

.item-macros {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
    padding-left: 22px;
    display: flex;
    cursor: pointer;
    gap: 6px;
    flex-wrap: wrap;
}

.item-macros .macro-cal {
    font-weight: 600;
    color: var(--text);
}

.macro-edit-hint {
    color: var(--text-dim);
    opacity: 0.4;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 2px;
    font-size: 10px;
    font-style: italic;
}

.macro-edit-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 10px;
    align-items: center;
    max-width: 200px;
}

.macro-edit-label {
    font-size: 12px;
    color: var(--text-dim);
    text-align: right;
}

.macro-edit-unit {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: var(--text-dim);
}

.macro-edit-input {
    width: 60px;
    padding: 4px 6px;
    font-size: 13px;
    color: var(--text);
    background: var(--bg-elevated);
    border: 1px solid var(--accent);
    border-radius: 4px;
    text-align: right;
    -moz-appearance: textfield;
}

.macro-edit-input::-webkit-inner-spin-button,
.macro-edit-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-stepper {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding-left: 22px;
}

.qty-stepper-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.qty-stepper-btn:active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.qty-display {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    min-width: 32px;
    text-align: center;
}

.qty-presets {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.qty-preset {
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.qty-preset.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

#pending-actions {
    display: none;
    gap: 8px;
    margin-top: 12px;
    justify-content: flex-end;
}

/* Small phone responsive */
@media (max-width: 374px) {
    .capture-tabs { gap: 4px; }
    .capture-tab { font-size: 10px; padding: 6px 2px; }
    .capture-tab-icon { width: 40px; height: 40px; }
    .capture-tab-icon svg { width: 18px; height: 18px; }
    .qty-stepper { flex-wrap: wrap; }
    .qty-presets { margin-left: 0; }
}

/* Menu Chat */
#menu-chat-messages {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0;
}

.menu-chat-bubble {
    max-width: 90%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.menu-chat-bubble.user {
    align-self: flex-end;
    background: rgba(6, 182, 212, 0.15);
    color: var(--text);
    border-bottom-right-radius: 4px;
}

.menu-chat-bubble.ai {
    align-self: flex-start;
    background: var(--bg-input);
    color: var(--text-secondary);
    border-bottom-left-radius: 4px;
}

.menu-chat-text {
    margin-bottom: 8px;
}

.menu-chat-item {
    background: var(--bg);
    border-radius: 8px;
    padding: 8px 10px;
    margin-top: 6px;
}

.menu-chat-item label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text);
    font-size: 14px;
}

.menu-chat-reason {
    font-size: 12px;
    color: #22d3ee;
    margin: 3px 0 2px 22px;
    font-style: italic;
}

.menu-chat-macros {
    font-size: 11px;
    color: var(--text-dim);
    margin-left: 22px;
}

.menu-chat-input-bar {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.menu-chat-input-bar input {
    flex: 1;
}

.menu-chat-loading {
    color: var(--text-dim);
    font-style: italic;
}

#menu-chat-actions {
    display: none;
    gap: 8px;
    justify-content: center;
}
