/* Shelf Audit — mobile-first styles */

:root {
    --brand: #0a5c36;
    --brand-light: #e6f2ec;
    --text: #1a1a1a;
    --text-sub: #666;
    --bg: #f5f5f4;
    --card: #fff;
    --done: #0a5c36;
    --error: #b3261e;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

header {
    background: var(--brand);
    color: #fff;
    padding: max(env(safe-area-inset-top), 12px) 16px 12px;
    position: sticky;
    top: 0;
    z-index: 10;
}

header h1 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

#store-label {
    font-size: 0.8rem;
    opacity: 0.85;
}

main {
    padding: 16px;
    max-width: 640px;
    margin: 0 auto;
}

h2 {
    font-size: 1rem;
    color: var(--text-sub);
    font-weight: 600;
}

.card-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.tappable { cursor: pointer; }
.tappable:active { background: var(--brand-light); }

.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.card-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.card-sub {
    font-size: 0.8rem;
    color: var(--text-sub);
}

.status-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #ccc;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #fff;
}

.card.done .status-icon {
    background: var(--done);
    border-color: var(--done);
}

.card.done .card-title { color: var(--text-sub); }

.chevron { flex-shrink: 0; }

#progress-wrap { margin-bottom: 14px; }

#progress-bar {
    height: 8px;
    background: #ddd;
    border-radius: 4px;
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    width: 0;
    background: var(--brand);
    transition: width 0.3s ease;
}

#progress-text {
    font-size: 0.8rem;
    color: var(--text-sub);
    margin-top: 6px;
}

button.primary {
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

button.primary:active { opacity: 0.85; }

#toast {
    position: fixed;
    bottom: max(env(safe-area-inset-bottom), 16px);
    left: 50%;
    transform: translateX(-50%);
    background: #323232;
    color: #fff;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    max-width: 90vw;
    text-align: center;
    z-index: 20;
}

#toast.error { background: var(--error); }

.chip {
    flex-shrink: 0;
    background: var(--brand-light);
    color: var(--brand);
    border: 1px solid var(--brand);
    border-radius: 14px;
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

#findings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 30;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

/* The hidden attribute must beat the display:flex above */
#findings-overlay[hidden] { display: none; }

#findings-panel {
    background: var(--card);
    border-radius: 16px 16px 0 0;
    max-width: 640px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px 16px max(env(safe-area-inset-bottom), 20px);
    position: relative;
}

#findings-panel h3 {
    margin: 0 32px 10px 0;
    font-size: 1rem;
}

#findings-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--bg);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
}

.findings-summary {
    background: var(--brand-light);
    border-left: 3px solid var(--brand);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.finding-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.finding {
    border: 1px solid #e5e5e3;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.finding-type { font-weight: 600; font-size: 0.85rem; }
.finding-product { font-size: 0.9rem; }
.finding-note { font-size: 0.8rem; color: var(--text-sub); }

.findings-footer {
    margin: 14px 0 0;
    font-size: 0.8rem;
    color: var(--text-sub);
    text-align: center;
}

.tab-bar {
    display: flex;
    gap: 6px;
    border-bottom: 2px solid #e5e5e3;
    margin-bottom: 12px;
}

.tab {
    background: none;
    border: none;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-sub);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

.review-photo {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 10px;
}

.tab-hint {
    font-size: 0.8rem;
    color: var(--text-sub);
}

.tab-hint a { color: var(--brand); }

.planogram-frame {
    width: 100%;
    height: 60vh;
    border: 1px solid #e5e5e3;
    border-radius: 8px;
}
