/* AP Generator — Styles */
/* Design System: Trust & Authority (shared with Calculator) */

/* ===== Step Transitions ===== */
.step-content {
    display: none;
    opacity: 0;
    transform: translateY(12px);
}
.step-content.active {
    display: block;
    animation: stepFadeIn 0.3s ease forwards;
}
@keyframes stepFadeIn {
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Stepper ===== */
.step-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: #94A3B8;
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.step-btn:hover { color: #475569; background: #F1F5F9; }
.step-btn.active { color: #0369A1; background: #E0F2FE; font-weight: 600; }
.step-btn.completed { color: #059669; }
.step-btn.completed .step-num {
    background: #059669;
    color: white;
}
.step-btn.completed .step-num::after {
    content: '\2713';
    font-size: 14px;
}
.step-btn.completed .step-num-text { display: none; }
.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 600;
    background: #E2E8F0;
    color: #64748B;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.step-btn.active .step-num {
    background: #0369A1;
    color: white;
    box-shadow: 0 0 0 4px rgba(3,105,161,0.15);
}
.step-line {
    flex-shrink: 0;
    width: 24px;
    height: 2px;
    background: #E2E8F0;
    transition: background 0.3s;
}
.step-line.done { background: #059669; }
.step-label { display: none; }
@media (min-width: 640px) {
    .step-label { display: inline; }
}

/* Progress bar under stepper */
.stepper-progress {
    height: 3px;
    background: #E2E8F0;
    position: relative;
    overflow: hidden;
}
.stepper-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0369A1, #38BDF8);
    transition: width 0.4s ease;
    border-radius: 0 2px 2px 0;
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    pointer-events: auto;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 3.5s forwards;
    max-width: 360px;
}
.toast-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.toast-error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.toast-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.toast-info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}

/* ===== Editable table cells ===== */
.editable-cell {
    cursor: text;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 60px;
    transition: background 0.15s, box-shadow 0.15s;
    border-bottom: 1px dashed #CBD5E1;
}
.editable-cell:hover {
    background: #EFF6FF;
    border-bottom-color: #0369A1;
}
.editable-cell:focus {
    outline: 2px solid #0369A1;
    outline-offset: -2px;
    background: #fff;
    border-bottom-color: transparent;
}
.editable-cell[data-field="placement"],
.editable-cell[data-field="mounting"],
.editable-cell[data-field="printing"] {
    border-bottom-color: #93C5FD;
}
.editable-hint {
    font-size: 11px;
    color: #94A3B8;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.editable-hint svg { width: 14px; height: 14px; }

/* Price cells */
.price-cell { font-variant-numeric: tabular-nums; }

/* ===== Table Improvements ===== */
/* Zebra stripes */
#merged-tbody tr:nth-child(even),
#pricing-tbody tr:nth-child(even),
#filter-tbody tr:nth-child(even) {
    background: #F8FAFC;
}
/* Hover */
#merged-tbody tr:hover,
#pricing-tbody tr:hover,
#filter-tbody tr:hover {
    background: #EFF6FF !important;
}
/* Sticky table headers */
.table-sticky thead {
    position: sticky;
    top: 52px; /* below stepper nav */
    z-index: 10;
    background: #F8FAFC;
}

/* Duplicate highlight */
.row-duplicate { background: #FFFBEB !important; }
.row-duplicate td:first-child { border-left: 3px solid #F59E0B; }

/* Best price highlight */
.row-best-price { background: #ECFDF5 !important; }

/* ===== Brand Cards ===== */
.brand-card .text-center { transition: all 0.2s ease; }
.brand-card.selected .text-center {
    border-color: #0369A1;
    background: rgba(3, 105, 161, 0.05);
    box-shadow: 0 0 0 3px rgba(3,105,161,0.12);
}

/* ===== Checkbox ===== */
input[type="checkbox"] {
    accent-color: #0369A1;
}

/* ===== Photo thumbnail ===== */
.photo-thumb {
    width: 48px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #E2E8F0;
    transition: transform 0.15s, box-shadow 0.15s;
}
.photo-thumb:hover {
    transform: scale(1.5);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10;
    position: relative;
}

/* Gallery photo */
.gallery-photo {
    aspect-ratio: 7/5;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid #E2E8F0;
    transition: transform 0.2s, box-shadow 0.2s;
}
.gallery-photo:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* ===== Format filter chips ===== */
.format-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid #E2E8F0;
    background: white;
    color: #475569;
    transition: all 0.15s;
    user-select: none;
}
.format-chip:hover { border-color: #0369A1; color: #0369A1; }
.format-chip.active {
    background: #0369A1;
    color: white;
    border-color: #0369A1;
}
.format-chip .chip-count {
    font-size: 12px;
    background: rgba(0,0,0,0.1);
    padding: 1px 6px;
    border-radius: 10px;
}
.format-chip.active .chip-count {
    background: rgba(255,255,255,0.25);
}

/* ===== Delete row button ===== */
.btn-delete-row {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94A3B8;
    cursor: pointer;
    border: none;
    background: transparent;
    transition: all 0.15s;
}
.btn-delete-row:hover {
    background: #FEF2F2;
    color: #DC2626;
}

/* ===== Lightbox ===== */
#lightbox.active {
    display: flex;
}

/* ===== Drop zone animation ===== */
#drop-zone.drag-over {
    border-color: #0369A1;
    background: rgba(3,105,161,0.05);
    transform: scale(1.01);
}
#drop-zone {
    transition: all 0.2s ease;
}

/* File card entrance */
.file-card-enter {
    animation: fileCardIn 0.3s ease;
}
@keyframes fileCardIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== Scrollbar ===== */
.overflow-x-auto::-webkit-scrollbar { height: 6px; }
.overflow-x-auto::-webkit-scrollbar-track { background: #F1F5F9; border-radius: 3px; }
.overflow-x-auto::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
.overflow-x-auto::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ===== Mobile Responsive ===== */
@media (max-width: 639px) {
    /* Header compact */
    header .font-display { font-size: 16px; }
    header p { font-size: 10px; }
    header .w-10 { width: 32px; height: 32px; font-size: 14px; }

    /* Stepper: compact fit all 5 */
    #stepper {
        gap: 0;
        justify-content: center;
    }
    .step-btn { padding: 4px 2px; font-size: 11px; gap: 0; min-width: 0; }
    .step-num { width: 24px; height: 24px; font-size: 10px; }
    .step-line { width: 6px; flex-shrink: 1; }

    /* Headings */
    .step-content h2 { font-size: 1.25rem; }
    .step-content p { font-size: 13px; }

    /* Tables: smaller text, horizontal scroll */
    table { font-size: 11px; }
    th, td { padding: 3px 5px !important; white-space: nowrap; }

    /* Bottom nav */
    #btn-prev, #btn-next { padding: 8px 14px; font-size: 13px; }

    /* Pricing cards */
    .grid.grid-cols-1.md\\:grid-cols-3 { gap: 8px; }
}

/* ===== Sortable table headers ===== */
th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 20px !important;
}
th.sortable:hover { background: #E2E8F0; }
th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #94A3B8;
}
th.sortable.sort-asc::after { content: '↑'; color: #0369A1; }
th.sortable.sort-desc::after { content: '↓'; color: #0369A1; }

/* Search input */
.table-search {
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 6px 12px 6px 32px;
    font-size: 13px;
    outline: none;
    width: 250px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394A3B8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") 8px center / 16px no-repeat;
    transition: border-color 0.15s;
}
.table-search:focus { border-color: #0369A1; }

/* City summary chips */
.city-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    background: #F1F5F9;
    color: #475569;
    border: 1px solid #E2E8F0;
}
.city-chip .city-total {
    font-weight: 600;
    color: #0369A1;
}

/* ===== Print ===== */
@media print {
    .no-print { display: none !important; }
}
