/* GroceryPal — project-specific styles, layered on top of /projects/projects.css */
/* Base font for elderly-friendly readability: min 18px throughout */

/* ── Layout ── */
main {
    max-width: 860px;
}

.tagline {
    font-size: 18px;
    margin-bottom: 4px;
}

/* ── IO bar ── */
.io-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 24px;
}

.small-btn {
    font-size: 14px;
    padding: 8px 16px;
}

.status-line {
    font-family: Monaco, monospace;
    font-size: 14px;
    color: #555;
}

/* ── Step sections ── */
.step-section {
    background: white;
    border: 2px solid black;
    padding: 28px 32px;
    margin-bottom: 24px;
}

.step-heading {
    font-size: 24px;
    font-family: Monaco, monospace;
    margin: 0 0 24px 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: black;
    color: white;
    font-size: 22px;
    font-family: Monaco, monospace;
    flex-shrink: 0;
}

/* ── Form elements ── */
.form-row {
    margin-bottom: 18px;
}

.form-row label {
    display: block;
    font-size: 18px;
    margin-bottom: 8px;
    font-weight: bold;
}

.optional {
    font-weight: normal;
    font-size: 14px;
    color: #666;
}

.big-input {
    font-family: Monaco, monospace;
    font-size: 18px;
    padding: 12px 16px;
    border: 2px solid black;
    background: white;
    width: 100%;
    box-sizing: border-box;
}

.big-input:focus {
    outline: 3px solid #0066cc;
    outline-offset: 1px;
}

.narrow-input {
    width: 160px;
}

.big-select {
    font-family: Monaco, monospace;
    font-size: 18px;
    padding: 12px 16px;
    border: 2px solid black;
    background: white;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
}

.big-select:focus {
    outline: 3px solid #0066cc;
    outline-offset: 1px;
}

.big-btn {
    font-size: 18px;
    padding: 14px 28px;
    min-height: 52px;
    cursor: pointer;
}

.secondary-btn {
    background: white;
    color: #444;
    border-color: #888;
}

.secondary-btn:hover {
    background: #f0f0f0;
    color: black;
}

.danger-btn {
    background: white;
    color: #cc0000;
    border-color: #cc0000;
}

.danger-btn:hover {
    background: #cc0000;
    color: white;
}

.form-msg {
    font-size: 16px;
    margin-top: 8px;
    min-height: 22px;
    color: #555;
}

.form-msg.error {
    color: #cc0000;
}

.form-msg.success {
    color: #166534;
}

.hint {
    font-size: 15px;
    color: #555;
    margin: 6px 0 0 0;
}

/* ── Catalog search results ── */
.search-row {
    margin-bottom: 12px;
}

.catalog-results {
    border: 2px solid black;
    background: white;
    display: none;
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.catalog-results.visible {
    display: block;
}

.catalog-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    font-size: 18px;
}

.catalog-result-item:last-child {
    border-bottom: none;
}

.catalog-result-item:hover {
    background: #f0f0f0;
}

.catalog-result-item.already-added {
    color: #888;
    cursor: default;
}

.catalog-result-item.already-added:hover {
    background: white;
}

/* Suggestions sourced from the live deals database */
.deal-result-item {
    border-left: 3px solid #ca8a04;
}
.size-unknown-item {
    border-left-color: #cbd5e1;
}
.size-unknown {
    font-size: 12px;
    color: #64748b;
    font-style: italic;
    margin-left: 6px;
}
.unit-price-note {
    font-size: 12px;
    color: #0f766e;
    margin-left: 6px;
    white-space: nowrap;
}

.result-name {
    flex: 1;
}

.result-category {
    font-size: 14px;
    color: #888;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 2px;
}

.result-price-range {
    font-size: 15px;
    color: #166534;
    white-space: nowrap;
}

.catalog-empty-msg {
    padding: 14px 16px;
    font-size: 16px;
    color: #888;
}

/* ── Shopping list ── */
.shopping-list {
    margin-bottom: 20px;
}

.list-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid black;
    background: white;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.list-item-name {
    flex: 1;
    font-size: 18px;
    min-width: 140px;
}

.list-item-category {
    font-size: 14px;
    color: #888;
}

.list-item-frozen-badge {
    font-size: 13px;
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 8px;
    border: 1px solid #93c5fd;
}

.list-price-range {
    font-size: 15px;
    color: #166534;
    white-space: nowrap;
}

.qty-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid black;
}

.qty-btn {
    width: 44px;
    height: 44px;
    font-size: 22px;
    font-family: Monaco, monospace;
    background: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.qty-btn:hover {
    background: black;
    color: white;
}

.qty-display {
    width: 40px;
    text-align: center;
    font-size: 18px;
    font-family: Monaco, monospace;
    border-left: 2px solid black;
    border-right: 2px solid black;
    height: 44px;
    line-height: 44px;
    background: white;
}

.edit-item-btn {
    font-size: 14px;
    padding: 8px 14px;
    min-height: 44px;
    background: white;
    border: 2px solid #888;
    color: #444;
    font-family: Monaco, monospace;
    cursor: pointer;
}

.edit-item-btn:hover {
    background: #f0f0f0;
    border-color: black;
    color: black;
}

.remove-item-btn {
    font-size: 20px;
    width: 44px;
    height: 44px;
    background: white;
    border: 2px solid #cc0000;
    color: #cc0000;
    font-family: Monaco, monospace;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-item-btn:hover {
    background: #cc0000;
    color: white;
}

.empty-msg {
    font-size: 18px;
    color: #888;
    padding: 20px 0;
    text-align: center;
}

/* ── Add item form ── */
.add-item-details {
    margin-top: 8px;
}

.add-item-summary {
    font-size: 18px;
    font-family: Monaco, monospace;
    cursor: pointer;
    padding: 12px 0;
    user-select: none;
    color: #0066cc;
}

.add-item-summary:hover {
    color: #004499;
}

.add-item-form {
    padding: 20px 0 4px 0;
    border-top: 2px solid #ddd;
    margin-top: 8px;
}

/* ── Price grid ── */
.price-grid {
    margin-bottom: 18px;
}

.price-grid-header {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #444;
}

.price-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
}

.chain-label {
    font-size: 16px;
    font-family: Monaco, monospace;
    font-weight: bold;
    width: 100px;
    flex-shrink: 0;
}

.metro-label { color: #c8002d; }
.walmart-label { color: #0071ce; }
.nofrills-label { color: #ffd100; background: #222; padding: 1px 6px; border-radius: 2px; }
.freshco-label { color: #e31837; }
/* Expanded chains */
.foodbasics-label { color: #00833e; }
.loblaws-label { color: #e1251b; }
.rcss-label { color: #0054a4; }
.zehrs-label { color: #d2232a; }
.fortinos-label { color: #006937; }
.valumart-label { color: #e4002b; }
.independent-label { color: #b01116; }
.sobeys-label { color: #00833e; }
.foodland-label { color: #6cb33f; }
.longos-label { color: #7a1f2b; }
.farmboy-label { color: #4a8b2c; }
.highlandfarms-label { color: #1a4d8f; }
/* Make room for longer banner names in the price grid */
.chain-label { width: auto; min-width: 100px; }

.price-input {
    font-family: Monaco, monospace;
    font-size: 18px;
    padding: 10px 14px;
    border: 2px solid black;
    width: 120px;
    background: white;
}

.price-input:focus {
    outline: 3px solid #0066cc;
    outline-offset: 1px;
}

/* ── Address row ── */
.address-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.address-row .big-input {
    flex: 1;
}

.addr-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* ── Travel mode buttons ── */
.mode-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.mode-btn {
    flex: 1;
    min-width: 120px;
    min-height: 80px;
    padding: 14px 10px;
    background: white;
    border: 2px solid black;
    font-family: Monaco, monospace;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.mode-btn:hover {
    background: #f0f0f0;
}

.mode-btn.active {
    background: black;
    color: white;
}

.mode-icon {
    font-size: 28px;
}

.mode-label {
    font-size: 16px;
}

.mode-options {
    padding: 16px 20px;
    border: 2px solid #ccc;
    background: #f9f9f9;
    margin-bottom: 16px;
}

/* ── Frozen row ── */
.frozen-row {
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Find plan button ── */
.find-btn {
    font-size: 20px;
    padding: 18px 40px;
    min-height: 60px;
    margin-bottom: 20px;
}

/* ── Recommendation card ── */
.rec-card {
    background: #f0fdf4;
    border: 2px solid #16a34a;
    padding: 20px 24px;
    margin-bottom: 20px;
    font-size: 20px;
    line-height: 1.6;
}

.rec-card.no-split {
    background: #fefce8;
    border-color: #ca8a04;
}

.rec-card.error {
    background: #fef2f2;
    border-color: #dc2626;
    color: #991b1b;
}

.rec-savings {
    font-weight: bold;
    color: #166534;
    font-size: 22px;
}

.rec-total {
    font-size: 22px;
    font-weight: bold;
}

/* ── Map ── */
#planMap {
    height: 360px;
    border: 2px solid black;
    margin-bottom: 20px;
}

/* ── Per-store lists ── */
.store-list-block {
    border: 2px solid black;
    background: white;
    margin-bottom: 16px;
}

.store-list-header {
    background: black;
    color: white;
    padding: 14px 18px;
    font-size: 20px;
    font-family: Monaco, monospace;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.store-list-address {
    font-size: 14px;
    opacity: 0.8;
    font-weight: normal;
}

.store-list-body {
    padding: 0;
}

.store-list-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid #eee;
    font-size: 18px;
    gap: 12px;
}

.store-list-item-row:last-child {
    border-bottom: none;
}

.store-list-item-name {
    flex: 1;
}

.store-list-item-qty {
    color: #888;
    font-size: 15px;
    flex-shrink: 0;
}

.store-list-item-price {
    font-weight: bold;
    flex-shrink: 0;
    min-width: 70px;
    text-align: right;
}

.store-list-subtotal {
    display: flex;
    justify-content: space-between;
    padding: 14px 18px;
    font-size: 20px;
    font-weight: bold;
    background: #f9f9f9;
    border-top: 2px solid black;
}

.missing-items-note {
    font-size: 15px;
    color: #cc0000;
    padding: 10px 18px;
    background: #fff5f5;
    border-top: 1px solid #fca5a5;
}

/* ── Comparison table ── */
.comparison-section {
    margin-bottom: 24px;
}

.comparison-section h3 {
    font-size: 20px;
    margin: 0 0 12px 0;
}

.table-scroll {
    overflow-x: auto;
    width: 100%;
}

.comp-table {
    border-collapse: collapse;
    font-family: Monaco, monospace;
    font-size: 16px;
    width: 100%;
    min-width: 500px;
}

.comp-table th, .comp-table td {
    border: 1px solid #bbb;
    padding: 10px 14px;
    text-align: left;
    white-space: nowrap;
}

.comp-table th {
    background: #222;
    color: white;
    font-weight: bold;
}

.comp-table tr.best-plan td {
    background: #f0fdf4;
    font-weight: bold;
}

.comp-table tr:hover td {
    background: #f5f5f5;
}

.comp-table tr.best-plan:hover td {
    background: #dcfce7;
}

/* ── Print button ── */
.print-btn {
    margin-top: 8px;
    background: white;
    border-color: #166534;
    color: #166534;
}

.print-btn:hover {
    background: #166534;
    color: white;
}

/* ── Edit modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
}

.modal-box {
    background: white;
    border: 2px solid black;
    padding: 28px 32px;
    width: 100%;
    max-width: 520px;
}

.modal-box h3 {
    font-size: 22px;
    margin: 0 0 20px 0;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* ── Print-only area ── */
.print-only {
    display: none;
}

/* ── @media print ── */
@media print {
    header, main, .print-btn, .io-bar, #editModal {
        display: none !important;
    }
    .print-only {
        display: block;
        font-family: Georgia, serif;
        font-size: 18pt;
        color: black;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    .print-store-block {
        margin-bottom: 32pt;
        page-break-inside: avoid;
    }
    .print-store-name {
        font-size: 22pt;
        font-weight: bold;
        border-bottom: 2pt solid black;
        padding-bottom: 6pt;
        margin-bottom: 10pt;
    }
    .print-store-address {
        font-size: 14pt;
        color: #444;
        margin-bottom: 16pt;
    }
    .print-store-note {
        font-size: 13pt;
        color: #555;
        margin-bottom: 12pt;
        font-style: italic;
    }
    .print-item-row {
        display: flex;
        align-items: flex-start;
        gap: 14pt;
        padding: 8pt 0;
        border-bottom: 1pt solid #ddd;
        font-size: 18pt;
    }
    .print-checkbox {
        width: 18pt;
        height: 18pt;
        border: 2pt solid black;
        flex-shrink: 0;
        margin-top: 2pt;
    }
    .print-item-name {
        flex: 1;
    }
    .print-item-qty {
        color: #555;
        font-size: 14pt;
    }
    .print-item-price {
        font-weight: bold;
        min-width: 60pt;
        text-align: right;
    }
    .print-store-subtotal {
        font-size: 18pt;
        font-weight: bold;
        margin-top: 14pt;
        padding-top: 8pt;
        border-top: 2pt solid black;
        display: flex;
        justify-content: space-between;
    }
    .print-grand-total {
        font-size: 22pt;
        font-weight: bold;
        border-top: 3pt solid black;
        padding-top: 12pt;
        margin-top: 20pt;
        display: flex;
        justify-content: space-between;
    }
    .print-title {
        font-size: 26pt;
        font-weight: bold;
        margin-bottom: 6pt;
    }
    .print-subtitle {
        font-size: 14pt;
        color: #555;
        margin-bottom: 24pt;
    }
}

/* ── Auth bar ── */
.auth-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
}

.auth-label {
    font-size: 14px;
    font-family: Monaco, monospace;
    color: #ccc;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Deals section ── */
.deals-desc {
    font-size: 18px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.deals-badge {
    font-size: 14px;
    background: #fef9c3;
    border: 1px solid #ca8a04;
    color: #92400e;
    padding: 3px 10px;
    font-family: Monaco, monospace;
    white-space: nowrap;
}

.deals-num {
    background: #fef9c3;
    color: #92400e;
    font-size: 22px;
    border: 2px solid #ca8a04;
}

/* ── Deal badge on items ── */
.deal-badge {
    font-size: 13px;
    background: #fef9c3;
    border: 1px solid #ca8a04;
    color: #92400e;
    padding: 1px 7px;
    margin-left: 8px;
    white-space: nowrap;
}

/* ── Flyer drop area ── */
.flyer-drop-area {
    border: 3px dashed black;
    background: white;
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s;
}

.flyer-drop-area.drag-over {
    background: #e0f2fe;
    border-color: #0066cc;
}

.flyer-drop-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.flyer-drop-text {
    font-size: 20px;
    font-family: Monaco, monospace;
    margin-bottom: 6px;
}

.flyer-drop-sub {
    font-size: 15px;
    color: #888;
    margin-bottom: 20px;
}

/* ── Gemini key bar ── */
.gemini-key-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

/* ── Flyer review area ── */
.flyer-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #ddd;
}

.flyer-image-wrap {
    overflow-x: auto;
    border: 2px solid black;
    background: #f5f5f5;
    margin-bottom: 12px;
    max-height: 420px;
    overflow-y: auto;
}

/* ── Candidate table ── */
.candidate-table {
    width: 100%;
    font-size: 15px;
}

.candidate-row.warn td {
    background: #fffbeb;
}

.warn-flag {
    color: #d97706;
    font-size: 16px;
}

.flyer-submit-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    main {
        padding: 0 16px 40px 16px;
    }
    .step-section {
        padding: 20px 18px;
    }
    .mode-btn {
        min-width: 90px;
    }
    .address-row {
        flex-direction: column;
    }
    .addr-btn {
        width: 100%;
    }
    .modal-overlay {
        padding: 20px 12px;
    }
}
