/* ── Kontener główny ────────────────────────────────────────── */

#calculator-container {
    font-size: 15px;
    margin-top: 24px;
}

#calculator-container a {
    border-bottom: none !important;
}

/* ── Formularz – selektory ──────────────────────────────────── */

#ct-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

#ct-selects {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 4px;
    flex: 1 1 auto;
}

.ct-sep {
    font-size: 20px;
    font-weight: 700;
    color: #555;
    padding-bottom: 6px;
    line-height: 1;
    align-self: flex-end;
}

.ct-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ct-field label {
    font-size: 11px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
}

.ct-field label small {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.ct-select {
    height: 46px;
    min-width: 80px;
    padding: 0 10px;
    font-size: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    appearance: auto;
}

.ct-select:focus {
    outline: none;
    border-color: #c11f1f;
    box-shadow: 0 0 0 2px rgba(193, 31, 31, 0.15);
}

/* ── Przycisk szukaj ────────────────────────────────────────── */

#ct-search {
    height: 46px;
    padding: 0 24px;
    background: #c11f1f;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    flex-shrink: 0;
}

#ct-search:hover,
#ct-search:focus {
    background: #a01818;
    outline: none;
}

#ct-search:active {
    transform: translateY(1px);
}

/* ── Wyniki ─────────────────────────────────────────────────── */

#ct-results {
    margin-top: 28px;
}

/* Loading */
.ct-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
    padding: 16px 0;
    font-size: 14px;
}

.ct-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: #c11f1f;
    border-radius: 50%;
    animation: ct-spin 0.65s linear infinite;
    flex-shrink: 0;
}

@keyframes ct-spin {
    to { transform: rotate(360deg); }
}

.ct-no-results {
    color: #666;
    font-style: italic;
    padding: 8px 0;
}

/* Siatka wyników */
.ct-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.ct-results-col h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #555;
    margin: 0 0 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #eee;
}

/* Tabela zamienników */
.ct-table {
    width: 100%;
    border-collapse: collapse;
}

.ct-group-row td {
    padding: 14px 0 4px;
}

.ct-diameter-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    background: #f0f0f0;
    color: #444;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.04em;
}

.ct-tire-row td {
    padding: 5px 0;
    vertical-align: middle;
    border-bottom: 1px solid #f5f5f5;
}

.ct-tire-row:last-child td {
    border-bottom: none;
}

/* Link do sklepu */
a.tire-link {
    color: #c11f1f;
    font-weight: 600;
    text-decoration: none;
    font-size: 15px;
    border-bottom: 1px dotted #c11f1f !important;
}

a.tire-link:hover {
    color: #a01818 !important;
    border-bottom-style: solid !important;
}

/* Odchyłka % */
.ct-diff {
    font-size: 12px;
    color: #999;
    padding-left: 6px;
    white-space: nowrap;
}

/* Tooltip prędkości */
.ct-info-wrap {
    position: relative;
    display: inline-block;
}

.ct-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e8e8e8;
    color: #666;
    font-size: 11px;
    cursor: pointer;
    font-style: normal;
    user-select: none;
    vertical-align: middle;
    margin-left: 4px;
    transition: background 0.15s;
    flex-shrink: 0;
}

.ct-info-btn:hover {
    background: #c11f1f;
    color: #fff;
}

.ct-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: #fff;
    font-size: 12px;
    line-height: 1.8;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
}

.ct-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #222;
}

.ct-info-wrap:hover .ct-tooltip,
.ct-info-wrap.active .ct-tooltip {
    display: block;
}

/* ── Responsive ─────────────────────────────────────────────── */

/* Tablet i mobile – jedna kolumna wyników */
@media (max-width: 640px) {
    .ct-results-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    #ct-search {
        width: 100%;
        justify-content: center;
    }

    #ct-selects {
        gap: 6px;
    }

    .ct-select {
        min-width: 70px;
    }
}

/* Bardzo małe ekrany – selektory pełna szerokość */
@media (max-width: 380px) {
    #ct-form {
        flex-direction: column;
        align-items: stretch;
    }

    #ct-selects {
        justify-content: space-between;
    }

    .ct-select {
        flex: 1;
        min-width: 0;
    }

    /* Tooltip: zakotwiczony do lewej na małych ekranach */
    .ct-tooltip {
        left: 0;
        transform: none;
    }

    .ct-tooltip::after {
        left: 14px;
        transform: none;
    }
}
