/* ============================================================
   Trip Comparison – Porównywarka Wypraw
   Horizontal row layout – hero-search design language
   ============================================================ */

.sa-tc {
    width: 100%;
    margin: 40px 0;
}

/* --- Header bar (title + sort) --- */
.sa-tc__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.64);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    position: relative;
    z-index: 51;
}

.sa-tc__title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: #111;
    flex-shrink: 0;
}

/* --- Search field --- */
.sa-tc__search-field {
    flex: 1;
    max-width: 400px;
}

.sa-tc__search-input {
    width: 100%;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.88);
    color: #111;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.sa-tc__search-input::placeholder {
    color: #666;
    opacity: 1;
}

.sa-tc__search-input:focus {
    outline: none;
    border-color: var(--primary-light-trans-60);
    box-shadow: 0 0 0 3px var(--primary-light-trans-20);
    background-color: #fff;
}

.sa-tc__sort {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sa-tc__sort-label {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
}

.sa-tc__sort-select {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 10px;
    padding: 8px 32px 8px 12px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.88);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.sa-tc__sort-select:focus {
    outline: none;
    border-color: var(--primary-light-trans-60);
    box-shadow: 0 0 0 3px var(--primary-light-trans-20);
    background-color: #fff;
}

/* --- Table wrapper --- */
.sa-tc__table-wrap {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

/* --- List of rows --- */
.sa-tc__list {
    display: flex;
    flex-direction: column;
}

/* --- Single row (each trip) --- */
.sa-tc__row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    transition: background-color 0.2s ease;
}

.sa-tc__row:last-child {
    border-bottom: none;
}

.sa-tc__row:hover {
    background: var(--primary-light-trans-10);
}

/* Current trip row */
/* Border style (default) */
.sa-tc__row--current {
    border: 2px solid var(--primary);
    border-radius: 16px;
}
.sa-tc__row--current:hover {
    border-color: var(--primary);
}

/* Background style variant */
.sa-tc--bg-style .sa-tc__row--current {
    border: none;
    border-radius: 16px;
    background: var(--primary-light-trans-10);
}
.sa-tc--bg-style .sa-tc__row--current:hover {
    background: var(--primary-light-trans-20);
}

/* --- Thumbnail --- */
.sa-tc__thumb {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
}

.sa-tc__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0;
}

/* --- Info column (name + location + tags) --- */
.sa-tc__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sa-tc__name {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    line-height: 1.3;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.sa-tc__badge {
    display: inline-block;
    flex-shrink: 0;
    font-size: var(--text-xs, 10px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 2px 7px;
    border-radius: 6px;
    background-color: var(--primary-semi-light, rgba(74, 124, 255, 0.12));
    color: var(--base-ultra-dark, #3b6cf5);
    white-space: nowrap;
    vertical-align: middle;
    line-height: 1.4;
}

.sa-tc__loc {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #4b5563;
}

.sa-tc__loc-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.6;
}

.sa-tc__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.sa-tc__tag {
    display: inline-block;
    font-size: var(--text-xs, 11px);
    font-weight: 500;
    padding: 0px 6px;
    border-radius: 8px;
    background-color: var(--primary-semi-light, rgba(15, 23, 42, 0.05));
    color: var(--base-ultra-dark, #555);
}

/* --- Data cells (metrics in a row) – desktop only inline --- */
.sa-tc__cells {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

.sa-tc__cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 90px;
    padding: 4px 8px;
    text-align: center;
}

.sa-tc__cell--date {
    width: 110px;
}

.sa-tc__cell-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
    white-space: nowrap;
}

.sa-tc__cell-val {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    white-space: nowrap;
}

/* Best value highlight */
.sa-tc__cell-val--best {
    color: #16a34a;
}

/* --- Difficulty dots --- */
.sa-tc__dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.sa-tc__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.1);
}

.sa-tc__dot--on {
    background: var(--primary);
}

/* --- Arrow --- */
.sa-tc__arrow {
    flex-shrink: 0;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    transition: color 0.2s ease, transform 0.2s ease;
}

.sa-tc__row:hover .sa-tc__arrow {
    color: var(--primary);
    transform: translateX(2px);
}

/* ============================================================
   Responsive – Tablet (<=960px)
   Cells move below the info block as a clean 5-col grid row.
   Thumb + info stay side by side at the top.
   ============================================================ */
@media (max-width: 960px) {
    .sa-tc__header {
        flex-wrap: wrap;
    }

    .sa-tc__search-field {
        order: 3;
        flex: 1 1 100%;
        width: 100%;
        max-width: none;
    }

    .sa-tc__row {
        display: grid;
        grid-template-columns: 56px 1fr auto;
        grid-template-rows: auto auto;
        gap: 0 12px;
        align-items: center;
        padding: 12px 14px;
    }

    /* Thumb: top-left */
    .sa-tc__thumb {
        grid-column: 1;
        grid-row: 1;
        width: 56px;
        height: 56px;
    }

    /* Info: top-center */
    .sa-tc__info {
        grid-column: 2;
        grid-row: 1;
    }

    /* Arrow: top-right */
    .sa-tc__arrow {
        grid-column: 3;
        grid-row: 1;
    }

    /* Cells: full-width row below, aligned grid */
    .sa-tc__cells {
        grid-column: 1 / -1;
        grid-row: 2;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(15, 23, 42, 0.06);
    }

    .sa-tc__cell {
        width: auto;
        padding: 0 4px;
    }

    .sa-tc__cell--date {
        width: auto;
    }
}

/* ============================================================
   Responsive – Small tablet / large phone (<=700px)
   Same grid but tighter spacing.
   ============================================================ */
@media (max-width: 700px) {
    .sa-tc__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 10px 12px;
    }

    .sa-tc__title {
        font-size: 16px;
    }

    .sa-tc__row {
        grid-template-columns: 48px 1fr auto;
        gap: 0 10px;
        padding: 10px 12px;
    }

    .sa-tc__thumb {
        width: 48px;
        height: 48px;
    }

    .sa-tc__name {
        font-size: 14px;
    }

    .sa-tc__loc {
        font-size: 12px;
    }

    .sa-tc__cell-val {
        font-size: 13px;
    }

    .sa-tc__cell-label {
        font-size: 10px;
    }

    .sa-tc__tag {
        font-size: 10px;
    }
}

/* ============================================================
   Responsive – Phone (<=480px)
   Cells reflow into 3+2 layout. Arrow hidden.
   ============================================================ */
@media (max-width: 480px) {
    .sa-tc {
        margin: 24px 0;
    }

    .sa-tc__row {
        grid-template-columns: 44px 1fr;
        grid-template-rows: auto auto;
    }

    .sa-tc__thumb {
        width: 44px;
        height: 44px;
        border-radius: 6px;
    }

    .sa-tc__arrow {
        display: none;
    }

    .sa-tc__cells {
        grid-column: 1 / -1;
        /* 3 on top, 2 on bottom – same-width cells */
        grid-template-columns: repeat(3, 1fr);
        gap: 6px 0;
        margin-top: 8px;
        padding-top: 8px;
    }

    .sa-tc__cell--date {
        /* Date spans 1 col like the rest on this row */
        grid-column: auto;
    }

    .sa-tc__cell {
        padding: 0 2px;
    }

    .sa-tc__badge {
        font-size: 9px;
        padding: 1px 5px;
    }
}

/* ============================================================
   Autocomplete Dropdown (search to add trips)
   ============================================================ */
.sa-tc__search-field {
    position: relative;
}

.sa-tc__autocomplete {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    border: 1px solid rgba(15, 23, 42, 0.08);
    z-index: 50;
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.sa-tc__autocomplete--open {
    display: block;
}

.sa-tc__autocomplete-status {
    padding: 14px 16px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.sa-tc__autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
}

.sa-tc__autocomplete-item:last-child {
    border-bottom: none;
}

.sa-tc__autocomplete-item:hover,
.sa-tc__autocomplete-item--active {
    background: var(--primary-light-trans-10);
}

.sa-tc__autocomplete-thumb {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
}

.sa-tc__autocomplete-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sa-tc__autocomplete-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sa-tc__autocomplete-name {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sa-tc__autocomplete-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}

.sa-tc__autocomplete-price {
    font-weight: 600;
    color: #16a34a;
}

.sa-tc__autocomplete-cat {
    opacity: 0.7;
}

/* ============================================================
   Section Headers (for both "Porównywane" and category sections)
   ============================================================ */
.sa-tc__section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(15, 23, 42, 0.03);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.sa-tc__section-label {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sa-tc__added-counter {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: var(--primary, #0073aa);
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.sa-tc__added-counter--full {
    background: #dc2626;
}

/* ============================================================
   Added Trips Section (user-added from other categories)
   ============================================================ */
.sa-tc__added-section {
    margin-bottom: 0;
}

.sa-tc__added-section .sa-tc__section-header {
    background: var(--primary-light-trans-10, rgba(74, 124, 255, 0.06));
}

.sa-tc__added-list {
    display: flex;
    flex-direction: column;
}

/* Remove button – replaces the arrow, same dimensions */
.sa-tc__remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(15, 23, 42, 0.06);
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    padding: 0;
}

.sa-tc__remove-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.sa-tc__remove-btn svg {
    width: 14px;
    height: 14px;
}

/* ============================================================
   Responsive – Autocomplete & Added Section
   ============================================================ */
@media (max-width: 960px) {
    .sa-tc__autocomplete {
        max-height: 260px;
    }

    .sa-tc__section-header {
        padding: 8px 14px;
    }
}

@media (max-width: 480px) {
    .sa-tc__autocomplete-item {
        padding: 8px 12px;
        gap: 10px;
    }

    .sa-tc__autocomplete-thumb {
        width: 36px;
        height: 36px;
    }

    .sa-tc__autocomplete-name {
        font-size: 13px;
    }

    .sa-tc__remove-btn {
        width: 22px;
        height: 22px;
    }

    .sa-tc__remove-btn svg {
        width: 12px;
        height: 12px;
    }
}

/* ============================================================
   Loading and Empty States
   ============================================================ */
.sa-tc__list--loading {
    position: relative;
    min-height: 200px;
}

.sa-tc__empty {
    padding: 48px 24px;
    text-align: center;
    color: #666;
    font-size: 16px;
}

/* Loading spinner overlay */
.sa-tc__list--loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 3px solid rgba(15, 23, 42, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: sa-tc-spin 0.8s linear infinite;
}

@keyframes sa-tc-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
