/* =====================================================================
   Currency Converter (/currency-converter) — page-only styles.
   Builds on site.css tokens and classes (.calculator-header, .result-card, .result-details, .calculate-button).
   ===================================================================== */

.cc-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.25rem 0;
}

.cc-title {
    align-items: flex-start;
    background: white;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-bottom: none;
}

    .cc-title .calculator-header-icon {
        color: var(--primary-blue);
        line-height: 1;
    }

    .cc-title .calculator-description {
        margin-top: 0.35rem;
    }

.cc-grid {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 1.5rem;
    align-items: start;
}

.cc-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    min-width: 0;
}

.cc-amount {
    font-size: 1.35rem;
    font-weight: 600;
}

.cc-field-error:empty {
    display: none;
}

.cc-field-error {
    margin-top: 0.35rem;
    font-size: 0.9rem;
}

/* ---- From / swap / To: stacked on every screen size, swap centred between them ---- */
.cc-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.75rem;
}

    .cc-pair .form-group {
        margin-bottom: 0;
    }

.cc-swap {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border-gray);
    background: var(--light-gray);
    color: var(--primary-blue);
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.3s;
    justify-self: center;
}

    .cc-swap:hover:not(:disabled),
    .cc-swap:focus-visible {
        background: var(--primary-blue);
        color: white;
        outline: none;
        box-shadow: 0 0 0 3px rgba(2, 70, 132, 0.2);
    }

    .cc-swap.cc-swapped {
        transform: rotate(180deg);
    }

    .cc-swap:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* ---- Searchable currency combobox ---- */
.cc-combo {
    position: relative;
}

.cc-combo-input {
    padding-right: 2.25rem;
    text-overflow: ellipsis;
    cursor: pointer;
    background: white;
}

    .cc-combo-input:focus {
        cursor: text;
    }

    .cc-combo-input:disabled {
        background: var(--light-gray);
        cursor: wait;
    }

    .cc-combo-input::placeholder {
        color: var(--text-dark);
        opacity: 1;
    }

    .cc-combo-input:focus::placeholder {
        color: var(--placeholder-gray);
    }

.cc-combo-caret {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
}

.cc-combo-list {
    position: absolute;
    z-index: 1000;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    width: max-content;
    max-width: min(380px, calc(100vw - 2rem));
    max-height: 320px;
    overflow-y: auto;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    background: white;
    border: 1px solid var(--border-gray);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

    .cc-combo[data-combo="to"] .cc-combo-list {
        left: auto;
        right: 0;
    }

    .cc-combo-list .cc-group {
        padding: 0.5rem 0.85rem 0.25rem;
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: #6c757d;
    }

    .cc-combo-list .cc-option {
        display: flex;
        align-items: baseline;
        gap: 0.6rem;
        padding: 0.5rem 0.85rem;
        cursor: pointer;
        line-height: 1.3;
    }

        .cc-combo-list .cc-option[aria-selected="true"] {
            font-weight: 600;
        }

        .cc-combo-list .cc-option.cc-active {
            background: #e7f3ff;
        }

    .cc-combo-list .cc-option-code {
        flex: 0 0 3.2rem;
        font-weight: 700;
        color: var(--primary-blue);
    }

    .cc-combo-list .cc-option-name {
        flex: 1 1 auto;
        min-width: 0;
    }

    .cc-combo-list .cc-option-symbol {
        flex: 0 0 auto;
        color: #6c757d;
    }

    .cc-combo-list .cc-empty {
        padding: 0.75rem 0.85rem;
        color: #6c757d;
    }

.cc-hint {
    margin: 1.25rem 0 0;
    font-size: 0.9rem;
    color: #6c757d;
}

/* ---- Result ---- */
.cc-result-section .results-header {
    margin-bottom: 1.25rem;
}

.cc-result-card {
    margin-bottom: 1.25rem;
}

.cc-result-value {
    font-size: 2.25rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.cc-rate-line {
    margin-top: 0.75rem;
    font-size: 1rem;
    opacity: 0.92;
    overflow-wrap: anywhere;
}

#ccResult[aria-busy="true"] .cc-result-card {
    opacity: 0.75;
}

.cc-notice {
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: 6px;
    border: 1px solid #b3d9ff;
    background: #e7f3ff;
    color: #004085;
    font-size: 0.95rem;
}

    .cc-notice.cc-notice-warning {
        border-color: #ffe08a;
        background: #fff8e1;
        color: #664d03;
    }

.cc-result-section .detail-value {
    text-align: right;
}

.cc-status-badge {
    display: inline-block;
    padding: 0.1rem 0.55rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    vertical-align: 1px;
}

    .cc-status-badge.cc-live {
        background: #d1e7dd;
        color: #0f5132;
    }

    .cc-status-badge.cc-cached {
        background: #e7f3ff;
        color: #004085;
    }

    .cc-status-badge.cc-fallback {
        background: #fff3cd;
        color: #664d03;
    }

.cc-refresh:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cc-refresh.cc-loading i {
    display: inline-block;
    animation: cc-spin 0.9s linear infinite;
}

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

.cc-disclaimer {
    margin: 1rem 0 0;
    font-size: 0.82rem;
    color: #6c757d;
}

/* ---- Tablet ---- */
@media (max-width: 991.98px) {
    .cc-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---- Phone ---- */
@media (max-width: 575.98px) {
    .cc-page {
        padding: 1rem 1rem 0;
    }

    .cc-title,
    .cc-card {
        padding: 1.25rem;
    }

        .cc-title h2 {
            font-size: 1.35rem;
        }

    .cc-pair {
        row-gap: 0.5rem;
    }

    .cc-result-value {
        font-size: 1.75rem;
    }

    .cc-result-section .detail-row {
        gap: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cc-swap,
    .cc-refresh.cc-loading i {
        transition: none;
        animation: none;
    }
}
