/* Green Bean PWA — Mobile-first styles */

:root {
    --bg:           #0d1b16;
    --surface:      #1a2e24;
    --surface-2:    #243d31;
    --accent:       #00704A;
    --accent-light: #00a36c;
    --text:         #e8f5e9;
    --text-muted:   #8fc4a8;
    --border:       #2a4035;
    --radius:       12px;
    --header-h:     56px;
}

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

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

/* ── App shell ──────────────────────────────────────────────────────────── */
#app {
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* ── Views ──────────────────────────────────────────────────────────────── */
.view {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    transition: opacity 0.18s ease;
    overflow: hidden;
}

.view.hidden {
    opacity: 0;
    pointer-events: none;
}

.view.active {
    opacity: 1;
    pointer-events: auto;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.app-header {
    display: flex;
    align-items: center;
    background: var(--accent);
    border-bottom: 1px solid rgba(0,0,0,0.2);
    padding: 0 16px;
    flex-shrink: 0;
    position: relative;
    /* iOS notch */
    padding-top: env(safe-area-inset-top, 0);
    height: calc(var(--header-h) + env(safe-area-inset-top, 0));
    min-height: var(--header-h);
}

.version-label {
    position: absolute;
    bottom: 4px;
    right: 12px;
    font-size: 10px;
    color: rgba(255,255,255,0.38);
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 18px;
}

.logo-icon { width: 45px; height: 45px; object-fit: contain; border-radius: 4px; }
.logo-text { color: #fff; letter-spacing: -0.3px; }

.header-count {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Search ─────────────────────────────────────────────────────────────── */
/* ── Update banner ─────────────────────────────────────────────────────── */
.update-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.update-banner.hidden { display: none; }
.update-banner button {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 12px;
    cursor: pointer;
    white-space: nowrap;
}
.update-banner button:hover { background: rgba(255,255,255,0.35); }

.search-bar {
    padding: 12px 16px 8px;
    background: var(--bg);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-bar input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 16px;   /* 16px prevents iOS zoom */
    padding: 10px 14px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus { border-color: var(--accent); }

.search-clear {
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    padding: 9px 13px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.search-clear:hover { color: var(--text); border-color: var(--accent); }

.search-mic {
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 18px;
    line-height: 1;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.search-mic.listening {
    background: var(--accent);
    border-color: var(--accent);
    animation: mic-pulse 0.8s ease-in-out infinite alternate;
}
.search-mic.hidden { display: none; }
@keyframes mic-pulse {
    from { opacity: 1; }
    to   { opacity: 0.55; }
}

/* ── Filter pills ───────────────────────────────────────────────────────── */
.filter-pills {
    display: flex;
    gap: 8px;
    padding: 0 16px 12px;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar { display: none; }

/* ── Tag chips ──────────────────────────────────────────────────────────── */
.tag-chips {
    display: flex;
    gap: 7px;
    padding: 0 16px 10px;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}

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

.tag {
    flex-shrink: 0;
    background: transparent;
    border: 1.5px solid var(--accent);
    border-radius: 20px;
    color: var(--accent-light);
    font-size: 13px;
    padding: 5px 13px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
    transition: background 0.12s, color 0.12s;
}

.tag.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.pill {
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 14px;
    padding: 7px 15px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* ── Drink list ─────────────────────────────────────────────────────────── */
.drink-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* iOS home bar padding */
    padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
}

.drink-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.drink-item:active { background: var(--surface-2); }

.drink-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--surface-2);
    flex-shrink: 0;
}

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

.drink-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drink-tags {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.chevron {
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

/* ── Empty / error states ───────────────────────────────────────────────── */
.empty-state, .error {
    text-align: center;
    color: var(--text-muted);
    font-size: 15px;
    padding: 56px 24px;
    line-height: 1.6;
}

.hidden { display: none !important; }

/* ── PDF Overlay ────────────────────────────────────────────────────────── */
.pdf-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    background: #000;
}

.pdf-overlay-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    flex-shrink: 0;
    padding-top: env(safe-area-inset-top, 0);
    height: calc(var(--header-h) + env(safe-area-inset-top, 0));
    min-height: var(--header-h);
}

.pdf-close-btn {
    background: none;
    border: none;
    color: var(--accent-light);
    font-size: 17px;
    cursor: pointer;
    padding: 8px 4px;
    -webkit-appearance: none;
    flex-shrink: 0;
    touch-action: manipulation;
}

.pdf-overlay-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-img-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #111;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.card-full-img {
    display: block;
    width: 100%;
    height: auto;
}

/* ── Card view ──────────────────────────────────────────────────────────── */
.card-header {
    gap: 10px;
}

.back-btn {
    background: none;
    border: none;
    color: var(--accent-light);
    font-size: 17px;
    cursor: pointer;
    padding: 8px 4px;
    -webkit-appearance: none;
    flex-shrink: 0;
    touch-action: manipulation;
}

.card-header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    gap: 18px;
    padding-bottom: 16px;
}

.card-footer {
    flex-shrink: 0;
    padding: 12px 16px;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.card-img {
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.55);
    background: var(--surface-2);
    display: block;
}

.card-meta {
    text-align: center;
    width: 100%;
}

.card-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.card-tags {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 6px;
}

.pdf-btn {
    display: block;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    padding: 15px 28px;
    border-radius: 10px;
    border: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    text-align: center;
    width: 100%;
    max-width: 420px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s;
}

.pdf-btn:active { background: var(--accent-light); }

/* ── PDF Overlay ─────────────────────────────────────────────────────── */
.pdf-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 200;
    display: flex;
    flex-direction: column;
}
.pdf-overlay.hidden { display: none; }
.pdf-overlay-bar {
    flex-shrink: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top, 10px));
    display: flex;
    align-items: center;
}
.pdf-close-btn {
    background: none;
    border: none;
    color: var(--accent-light);
    font-size: 17px;
    cursor: pointer;
    padding: 6px 4px;
    -webkit-appearance: none;
    touch-action: manipulation;
}
.pdf-frame {
    flex: 1;
    border: none;
    width: 100%;
    background: var(--bg);
}
