﻿/* ============================================================
   IMPORT WINE OVERLAY
   ============================================================ */

/* ── Backdrop ── */
.import-overlay-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* ── Panel ── */
.import-overlay {
    background: var(--color-card-bg);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Header ── */
.import-overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    flex-shrink: 0;
}

.import-overlay-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* ── Step indicator ── */
.import-steps {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.25rem;
    gap: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.import-step {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.import-step-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    color: var(--color-dark-text);
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.import-step.active .import-step-dot {
    background: var(--color-primary-button);
    color: #fff;
}

.import-step.done .import-step-dot {
    background: #16a34a;
    color: #fff;
}

.import-step-label {
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0.45;
    transition: opacity 0.2s;
}

.import-step.active .import-step-label {
    opacity: 1;
}

.import-step.done .import-step-label {
    opacity: 0.6;
}

.import-step-line {
    flex: 1;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    margin: 0 0.5rem;
    min-width: 1.5rem;
    transition: background 0.2s;
}

    .import-step-line.done {
        background: #16a34a;
    }

/* ── Body (scrollable) ── */
.import-overlay-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.import-hint {
    font-size: 0.88rem;
    opacity: 0.55;
    margin: 0;
    line-height: 1.55;
}

/* ── Footer ── */
.import-overlay-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: auto;
    flex-shrink: 0;
}

/* ── Type selection cards ── */
.import-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.import-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 1rem;
    border-radius: 8px;
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    background: var(--color-primary-bg);
    color: inherit;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

    .import-type-card:hover {
        border-color: rgba(0, 0, 0, 0.25);
        background: var(--color-tertiary-button-hover);
    }

    .import-type-card.selected {
        border-color: var(--color-primary-button);
        background: var(--color-primary-bg);
        box-shadow: 0 0 0 3px rgba(var(--color-primary-button-rgb, 100, 60, 180), 0.1);
    }

.import-type-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.import-type-title {
    font-size: 0.88rem;
    font-weight: 700;
}

.import-type-desc {
    font-size: 0.78rem;
    opacity: 0.5;
    line-height: 1.45;
}

/* ── Dropzone ── */
.import-dropzone {
    border: 2px dashed rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
    cursor: default;
}

    .import-dropzone.drag-over {
        border-color: var(--color-primary-button);
        background: rgba(0, 0, 0, 0.03);
    }

.import-dropzone-icon {
    font-size: 2rem;
    line-height: 1;
}

.import-dropzone-label {
    font-size: 0.88rem;
    opacity: 0.6;
}

/* ── CSV column mapper ── */
.csv-mapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.csv-mapper-header {
    display: flex;
    gap: 0.5rem;
    background: var(--color-primary-bg);
    border-radius: 6px 6px 0 0;
    padding: 0.5rem 0.75rem;
}

.csv-mapper-col-label {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.csv-mapper-preview {
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0 0 6px 6px;
    overflow: hidden;
}

.csv-mapper-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.csv-mapper-cell {
    flex: 1;
    font-size: 0.78rem;
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.csv-mapper-fields {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.csv-mapper-field-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.csv-mapper-field-label {
    font-size: 0.82rem;
    font-weight: 600;
    width: 90px;
    flex-shrink: 0;
}

.csv-mapper-select {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: var(--color-primary-bg);
    color: inherit;
    font-size: 0.85rem;
}

/* ── Parsing spinner ── */
.import-parsing {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem 0;
}

.import-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--color-primary-button);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.import-parsing-label {
    font-size: 0.9rem;
    opacity: 0.5;
}

/* ── Review topbar ── */
.review-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 0.25rem;
}

.review-pills {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.review-pill {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
}

    .review-pill.green {
        background: #f0fdf4;
        color: #15803d;
        border: 1px solid #bbf7d0;
    }

    .review-pill.yellow {
        background: #fffbeb;
        color: #92400e;
        border: 1px solid #fde68a;
    }

    .review-pill.red {
        background: #fef2f2;
        color: #b91c1c;
        border: 1px solid #fecaca;
    }

/* ── Collapsible sections ── */
.review-section {
    display: flex;
    flex-direction: column;
}

.review-collapse-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0.6rem 0;
    cursor: pointer;
    color: inherit;
    width: 100%;
    text-align: left;
    margin-bottom: 0.5rem;
}

.review-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.7;
}

.review-section-count {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.4;
    margin-left: 0.1rem;
}

.review-row-excluded td,
.review-row-excluded {
    opacity: 0.35;
    text-decoration: line-through;
}

/* ── Needs info rows ── */
.review-needs-info-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.review-needs-info-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 0.85rem;
    background: var(--color-primary-bg);
    border-radius: 7px;
    flex-wrap: wrap;
}

.review-needs-info-wine {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
    min-width: 160px;
}

.review-needs-info-fields {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ── Not found rows ── */
.review-not-found-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.review-not-found-row {
    background: var(--color-primary-bg);
    border-radius: 7px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    border: 1px solid rgba(0, 0, 0, 0.07);
}

.review-not-found-raw {
    font-size: 0.8rem;
    opacity: 0.5;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.review-not-found-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

.review-not-found-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* ── Done ── */
.import-done {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2.5rem 0;
    text-align: center;
}

.import-done-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.import-done-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.import-done-stats {
    display: flex;
    gap: 2rem;
    margin-top: 0.25rem;
}

.import-done-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.import-done-stat-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--color-primary-button);
}

.import-done-stat-label {
    font-size: 0.78rem;
    opacity: 0.5;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .import-type-grid {
        grid-template-columns: 1fr;
    }

    .import-steps {
        gap: 0;
    }

    .import-step-label {
        display: none;
    }
}

/* ── Shop selector ── */
.shop-selector {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 0.75rem;
    border-top: 1px solid rgba(0,0,0,0.06);
    padding-top: 0.75rem;
}

.shop-selector-label {
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 0.55;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.shop-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.shop-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    border-radius: 7px;
    border: 1.5px solid rgba(0,0,0,0.08);
    background: var(--color-primary-bg);
    color: var(--color-dark-text);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
    width: 100%;
}

    .shop-item:hover {
        border-color: rgba(0,0,0,0.2);
        background: var(--color-tertiary-button-hover);
    }

    .shop-item.shop-item-active {
        border-color: var(--color-primary-button);
        background: var(--color-primary-bg);
        box-shadow: 0 0 0 3px rgba(var(--color-primary-button-rgb, 100,60,180), 0.08);
    }

.shop-item-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.shop-item-name {
    font-size: 0.88rem;
    font-weight: 600;
    flex: 1;
}

.shop-item-hint {
    font-size: 0.75rem;
    opacity: 0.4;
    flex-shrink: 0;
}

/* ── PDF column mapper ── */
.pdf-mapper-table-wrap {
    overflow-x: auto;
    border-radius: 7px;
    border: 1px solid rgba(0,0,0,0.08);
}

.pdf-mapper-table {
    min-width: 100%;
    font-size: 0.8rem;
    table-layout: fixed;
    border-collapse: collapse;
}

    .pdf-mapper-table col.pdf-col-merge-slot {
        width: 22px;
    }

    .pdf-mapper-table col.pdf-col-data-slot {
        width: 120px;
    }

    .pdf-mapper-table th {
        background: var(--color-primary-bg);
        padding: 0.35rem 0.5rem;
        border-bottom: 1px solid rgba(0,0,0,0.07);
        white-space: nowrap;
        overflow: hidden;
    }

.pdf-col-select {
    font-size: 0.75rem;
    padding: 0.25rem 0.4rem;
    width: 100%;
    min-width: 0;
}

.pdf-mapper-cell {
    padding: 0.35rem 0.5rem !important;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.78rem;
    opacity: 0.65;
    transition: background 0.15s, opacity 0.15s;
}

/* Per-role cell tinting */
.pdf-cell-name {
    background: rgba(99,102,241,0.08);
    opacity: 1 !important;
    font-weight: 500;
}

.pdf-cell-producer {
    background: rgba(14,165,233,0.08);
    opacity: 1 !important;
}

.pdf-cell-vintage {
    background: rgba(16,185,129,0.08);
    opacity: 1 !important;
}

.pdf-cell-quantity {
    background: rgba(245,158,11,0.08);
    opacity: 1 !important;
}

.pdf-cell-region {
    background: rgba(239,68,68,0.07);
    opacity: 1 !important;
}

.pdf-cell-varietal {
    background: rgba(139,92,246,0.08);
    opacity: 1 !important;
}

/* Per-role header tinting */
.pdf-col-mapped {
    border-top: 2px solid transparent;
}

.pdf-col-name {
    border-top-color: rgba(99,102,241,0.5);
    background: rgba(99,102,241,0.06);
}

.pdf-col-producer {
    border-top-color: rgba(14,165,233,0.5);
    background: rgba(14,165,233,0.06);
}

.pdf-col-vintage {
    border-top-color: rgba(16,185,129,0.5);
    background: rgba(16,185,129,0.06);
}

.pdf-col-quantity {
    border-top-color: rgba(245,158,11,0.5);
    background: rgba(245,158,11,0.06);
}

.pdf-col-region {
    border-top-color: rgba(239,68,68,0.4);
    background: rgba(239,68,68,0.05);
}

.pdf-col-varietal {
    border-top-color: rgba(139,92,246,0.5);
    background: rgba(139,92,246,0.06);
}

/* Merge button column */
.pdf-merge-btn-th {
    padding: 0 !important;
    width: 18px;
    min-width: 18px;
    background: transparent !important;
    border: none !important;
    vertical-align: middle;
}

.pdf-merge-spacer-td {
    padding: 0 !important;
    width: 18px;
    min-width: 18px;
    background: transparent !important;
    border: none !important;
}

.pdf-merge-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 26px;
    margin: 0 auto;
    padding: 0;
    font-size: 0.65rem;
    line-height: 1;
    color: rgba(0,0,0,0.25);
    background: transparent;
    border: 1px dashed rgba(0,0,0,0.15);
    border-radius: 3px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

    .pdf-merge-btn:hover {
        color: #6366f1;
        border-color: #6366f1;
        background: rgba(99,102,241,0.08);
    }

.pdf-col-header-inner {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.pdf-unmerge-btn {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    padding: 0;
    font-size: 0.6rem;
    line-height: 1;
    color: rgba(0,0,0,0.3);
    background: rgba(0,0,0,0.05);
    border: none;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

    .pdf-unmerge-btn:hover {
        color: #ef4444;
        background: rgba(239,68,68,0.1);
    }

/* ── Save profile row ── */
.shop-save-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.6rem 0;
    border-top: 1px solid rgba(0,0,0,0.06);
    margin-top: 0.25rem;
}

.shop-save-label {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

/* ── PDF row picker ── */
.pdf-row-picker-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 340px;
    border-radius: 7px;
    border: 1px solid rgba(0,0,0,0.08);
}

.pdf-row-picker-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    table-layout: auto;
}

.pdf-row-pick-row {
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

    .pdf-row-pick-row:last-child {
        border-bottom: none;
    }

    .pdf-row-pick-row td {
        padding: 0.38rem 0.6rem;
        white-space: nowrap;
    }

    .pdf-row-pick-row:hover {
        background: var(--color-tertiary-button-hover, rgba(0,0,0,0.03));
    }

    .pdf-row-pick-row.selected {
        background: rgba(99,102,241,0.08);
        outline: 1.5px solid rgba(99,102,241,0.45);
        outline-offset: -1px;
    }

.pdf-row-pick-check-cell {
    width: 1.6rem;
    min-width: 1.6rem;
    text-align: center;
    padding: 0.38rem 0.25rem !important;
    vertical-align: middle;
}

.pdf-row-pick-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: var(--color-primary-button, #6366f1);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
}

.pdf-row-pick-cell {
    padding: 0.38rem 0.6rem !important;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.75;
    border-right: 1px solid rgba(0,0,0,0.05);
}

    .pdf-row-pick-cell:last-child {
        border-right: none;
    }

.pdf-row-pick-row.selected .pdf-row-pick-cell {
    opacity: 1;
}

/* ── PDF role chips ── */
.pdf-role-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.3;
}

.pdf-role-chip-name {
    background: rgba(99,102,241,0.15);
    color: #4338ca;
}

.pdf-role-chip-producer {
    background: rgba(14,165,233,0.15);
    color: #0369a1;
}

.pdf-role-chip-vintage {
    background: rgba(16,185,129,0.15);
    color: #065f46;
}

.pdf-role-chip-quantity {
    background: rgba(245,158,11,0.15);
    color: #92400e;
}

.pdf-role-chip-region {
    background: rgba(239,68,68,0.12);
    color: #991b1b;
}

.pdf-role-chip-varietal {
    background: rgba(139,92,246,0.15);
    color: #5b21b6;
}

.pdf-role-chip-remove {
    background: none;
    border: none;
    padding: 0;
    margin-left: 0.1rem;
    font-size: 0.6rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.5;
    color: inherit;
}

    .pdf-role-chip-remove:hover {
        opacity: 1;
    }

/* ── Add role button + dropdown ── */
.pdf-role-add-wrap {
    position: relative;
    display: inline-flex;
}

.pdf-role-add-btn {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    border: 1.5px dashed rgba(0,0,0,0.25);
    background: none;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    color: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, color 0.15s;
}

    .pdf-role-add-btn:hover {
        border-color: #6366f1;
        color: #6366f1;
    }

.pdf-role-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 50;
    background: var(--color-card-bg);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 7px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: 0.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 110px;
}

.pdf-role-dropdown-item {
    background: none;
    border: none;
    padding: 0.2rem 0.3rem;
    border-radius: 5px;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
}

    .pdf-role-dropdown-item:hover {
        background: rgba(0,0,0,0.04);
    }

.pdf-role-add-btn-simple {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.7rem;
    color: rgba(0,0,0,0.35);
    cursor: pointer;
    text-align: left;
    transition: color 0.15s;
}

    .pdf-role-add-btn-simple:hover {
        color: #6366f1;
    }

.field input.field-confidence-matched {
    border-color: #4caf50 !important;
    background: rgba(76, 175, 80, 0.08) !important;
}

.field input.field-confidence-unverified {
    border-color: #f59e0b !important;
    background: rgba(245, 158, 11, 0.08) !important;
}

.field input.field-confidence-missing {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.08) !important;
}