/* ═══════════════════════════════════════════════════════
   TravelingBasket App — Mobile-First Stylesheet
   ═══════════════════════════════════════════════════════ */

/* ── Onboarding ──────────────────────────────────── */
.tb-onboarding-slides {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    min-height: 0
}

.tb-onboarding-slide {
    flex: 0 0 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
    transition: transform .3s ease;
    transform: translateX(0)
}

.tb-onboarding-slide.not-first {
    display: none
}

.tb-onboarding-slide h1 {
    font-size: 24px;
    margin-top: 24px;
    margin-bottom: 8px
}

.tb-onboarding-slide p {
    color: var(--tb-muted);
    font-size: 15px;
    line-height: 1.6;
    max-width: 280px
}

.tb-onboarding-icon {
    font-size: 64px;
    line-height: 1
}

.tb-onboarding-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 16px
}

.tb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tb-border);
    transition: background .3s, width .3s
}

.tb-dot.active {
    background: var(--tb-accent);
    width: 24px;
    border-radius: 4px
}

.tb-onboarding-actions {
    padding: 16px
}

/* ── Auth ────────────────────────────────────────── */
.tb-auth-header {
    text-align: center;
    padding: 24px 0
}

.tb-auth-header h2 {
    font-size: 22px;
    margin-bottom: 4px
}

.tb-auth-header p {
    color: var(--tb-muted);
    font-size: 14px
}

.tb-auth-tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--tb-border)
}

.tb-auth-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: var(--tb-muted);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .2s, border-color .2s
}

.tb-auth-tab.active {
    color: var(--tb-accent);
    border-bottom-color: var(--tb-accent)
}

.tb-auth-form {
    display: none
}

.tb-auth-form.active {
    display: block
}

.tb-label {
    display: block;
    font-size: 13px;
    color: var(--tb-muted);
    margin-bottom: 4px;
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: .05em
}

.tb-label:first-child {
    margin-top: 0
}

.tb-auth-error {
    color: var(--tb-danger);
    font-size: 13px;
    margin-top: 8px;
    display: none
}

.tb-auth-error:not(:empty) {
    display: block
}

/* ── Product Cards ───────────────────────────────── */
.tb-product-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--tb-surface);
    border-radius: var(--tb-radius)
}

.tb-product-card-image {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    background: var(--tb-border);
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px
}

.tb-product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.tb-product-card-info {
    flex: 1;
    min-width: 0
}

.tb-product-card-info h3 {
    font-size: 16px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.tb-product-card-info p {
    font-size: 13px;
    color: var(--tb-muted)
}

.tb-meta {
    font-size: 12px;
    color: var(--tb-muted)
}

/* ── Lists ───────────────────────────────────────── */
.tb-list-card {
    padding: 16px;
    background: var(--tb-surface);
    border-radius: var(--tb-radius);
    margin-bottom: 12px;
    cursor: pointer;
    transition: background .2s
}

.tb-list-card:active {
    background: var(--tb-border)
}

.tb-list-card h3 {
    font-size: 16px;
    margin-bottom: 4px
}

.tb-list-card p {
    font-size: 13px;
    color: var(--tb-muted)
}

/* ── List Items ──────────────────────────────────── */
.tb-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--tb-surface);
    border-radius: var(--tb-radius);
    margin-bottom: 8px;
    transition: opacity .2s
}

.tb-list-item.have {
    opacity: .5
}

.tb-list-item-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--tb-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .2s, background .2s
}

.tb-list-item-check.checked {
    background: var(--tb-success);
    border-color: var(--tb-success)
}

.tb-list-item-check.checked::after {
    content: '✓';
    font-size: 14px;
    color: #fff;
    font-weight: 700
}

.tb-list-item-info {
    flex: 1;
    min-width: 0
}

.tb-list-item-info h4 {
    font-size: 14px;
    margin-bottom: 2px
}

.tb-list-item-info p {
    font-size: 12px;
    color: var(--tb-muted)
}

.tb-list-item-delete {
    background: none;
    border: none;
    color: var(--tb-danger);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px
}

/* ── Store Picker ────────────────────────────────── */
.tb-store-option {
    padding: 12px;
    background: var(--tb-surface);
    border-radius: var(--tb-radius);
    margin-bottom: 8px;
    cursor: pointer;
    border: 1px solid var(--tb-border);
    transition: border-color .2s
}

.tb-store-option:active {
    border-color: var(--tb-accent)
}

.tb-store-option h4 {
    font-size: 14px;
    margin-bottom: 2px
}

.tb-store-option p {
    font-size: 12px;
    color: var(--tb-muted)
}

/* ── Route Summary ───────────────────────────────── */
.tb-route-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px
}

.tb-route-summary-row.total {
    font-weight: 700;
    font-size: 16px;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--tb-border)
}

.tb-route-stop {
    margin-bottom: 8px
}

.tb-route-stop-header {
    padding: 12px;
    background: var(--tb-surface);
    border-radius: var(--tb-radius) var(--tb-radius) 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer
}

.tb-route-stop-header .tb-stop-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--tb-accent);
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0
}

.tb-route-stop-items {
    padding: 12px;
    background: var(--tb-border);
    border-radius: 0 0 var(--tb-radius) var(--tb-radius);
    display: none
}

.tb-route-stop-items.open {
    display: block
}

.tb-route-stop-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--tb-border)
}

.tb-route-stop-item:last-child {
    border: none
}

/* ── Search Results ──────────────────────────────── */
.tb-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--tb-border);
    cursor: pointer;
    transition: background .2s
}

.tb-search-result:active {
    background: var(--tb-surface)
}

.tb-search-result-image {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--tb-border);
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px
}

.tb-search-result-info {
    flex: 1;
    min-width: 0
}

.tb-search-result-info h4 {
    font-size: 14px;
    margin-bottom: 2px
}

.tb-search-result-info p {
    font-size: 12px;
    color: var(--tb-muted)
}

.tb-search-result-add {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--tb-accent);
    color: #0f172a;
    border: none;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center
}

/* ── Product Detail ──────────────────────────────── */
.tb-product-detail-header {
    text-align: center;
    margin-bottom: 20px
}

.tb-product-detail-header .tb-product-card-image {
    width: 120px;
    height: 120px;
    margin: 0 auto 12px;
    font-size: 64px
}

.tb-product-detail-header h2 {
    font-size: 20px;
    margin-bottom: 4px
}

.tb-price-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px
}

.tb-price-history-table th,
.tb-price-history-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--tb-border)
}

.tb-price-history-table th {
    color: var(--tb-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .05em
}

/* ── Leaflet Marker Overrides ───────────────────── */
.leaflet-div-icon {
    background: transparent !important;
    border: none !important
}

.tb-map-start,
.tb-map-stop {
    width: auto !important;
    height: auto !important
}

.tb-error {
    color: var(--tb-danger);
    font-size: 13px;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(248, 113, 113, 0.1);
    border-radius: 8px
}

.tb-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--tb-muted)
}

.tb-empty-icon {
    font-size: 48px;
    margin-bottom: 12px
}

/* ── Offline Banner ──────────────────────────────── */
.tb-offline-banner {
    background: var(--tb-warning);
    color: #0f172a;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    font-weight: 600;
    display: none
}

.tb-offline-banner.visible {
    display: block
}

/* ── Desktop overrides ───────────────────────────── */
@media (min-width:769px) {
    #tb-app.desktop {
        max-width: 800px
    }

    .tb-scanner-hint {
        font-size: 14px
    }
}