/* ==============================
MAIN CONTAINER (CLS Fixed Footprint)
============================== */
.pro-converter {
    width: 100%;
    max-width: 520px;
    min-height: 403px; /* Exact reserved box space on desktop */
    margin: 0 auto;
    font-family: 'Inter', Arial, sans-serif;
    position: relative;
    z-index: 10;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px #190066;
    contain: layout style; /* Performance & CLS boundary isolation */
}

/* ==============================
CARD
============================== */
.card {
    background: #FFFFFF;
    padding: 40px;
    border-radius: 24px;
    position: relative;
    overflow: visible;
}

/* ==============================
INPUT CONTAINERS
============================== */
.currency-input {
    position: relative;
    margin-bottom: 14px;
    height: 66px; /* Locked box height */
}

.currency-input input {
    width: 100%;
    height: 66px !important; /* Locks height to completely eliminate dynamic font padding shift */
    line-height: 1.2 !important;
    padding: 28px 104px 10px 20px !important; /* Top space for label, right space for trigger */
    font-size: 24px;
    border: 1px solid #777777 !important;
    border-radius: 7px !important;
    outline: none;
    box-sizing: border-box;
}

/* ==============================
SELECT BOX & TRIGGER (CLS Protected)
============================== */
.currency-select {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 94px;
    height: 38px; /* Locked trigger container */
    z-index: 20;
}

.selected {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f5f5f5;
    padding: 7px 6px;
    height: 38px;
    box-sizing: border-box;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
}

/* Fixed Flag Image CLS */
.selected img,
.currency-item img {
    width: 22px;
    height: 16px; /* Fixed height stops layout shifts prior to image load */
    aspect-ratio: 11 / 8;
    object-fit: cover;
    pointer-events: none;
    display: block;
}

.pcc-dropdown-arrow {
    font-size: 9px !important;
    color: #666 !important;
    margin-left: auto;
    line-height: 1 !important;
}

/* ==============================
DROPDOWN (DESKTOP SPECIFIC)
============================== */
.dropdown {
    display: none;
    position: absolute;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e6e6e6;
    box-shadow: 0 20px 45px rgba(0,0,0,.15);
    z-index: 99999;
    box-sizing: border-box;
    width: 300px;
}

/* ==============================
ITEMS & ACTIONS
============================== */
.currency-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    height: 44px; /* Explicit height for smooth virtual rendering */
    box-sizing: border-box;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.currency-item:hover {
    background: #f5f7f9;
}

/* ==============================
SWAP BUTTON
============================== */
.swap-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px; /* Pre-allocated container height */
    margin-bottom: 14px;
}

.swapBtn {
    background: #89b0ff;
    color: #0F172A;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 25px;
    cursor: pointer;
    transition: background 0.3s, color 0.3s, transform 0.3s;
    padding: 0;
    line-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swapBtn:hover {
    color: #89b0ff;
    background: #0F172A;
    transform: rotate(180deg);
}

/* ==============================
TEXT & RATES
============================== */
.rate-line {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 0;
    font-size: 15px;
    min-height: 22px; /* Reserved text space */
    line-height: 1.4;
}

.seo-rate-line {
    text-align: center;
    font-size: 16px;
    margin-bottom: 20px;
    min-height: 24px; /* Reserved text space */
    line-height: 1.4;
}

/* ==============================
CURRENCY SEARCH CONTAINER
============================== */
.currency-search {
    width: 100%;
    height: 48px;
    padding: 14px 16px;
    border: none;
    border-bottom: 1px solid #eee;
    outline: none;
    font-size: 16px;
    box-sizing: border-box;
}

.currency-list {
    max-height: 250px;
    overflow-y: auto;
}

/* ==============================
MARKET SUB-TEXT CONTAINER
============================== */
.pcc-market-subtext-container {
    color: #0F172A !important; 
    font-size: 14px !important; 
    font-style: normal !important; 
    line-height: 1.3 !important; 
    width: 100% !important;
    min-width: 100%;
    min-height: 19px; /* Reserved single-line space on desktop */
    margin: 0 0 16px 0 !important; 
    padding: 0 !important; 
    text-align: left !important; 
    text-transform: none !important; 
    letter-spacing: normal !important; 
    display: block !important; 
    background: transparent !important; 
    border: none !important;
}

/* ==============================
THEME ISOLATION & LABELS
============================== */
.pro-converter,
.pro-converter .seo-rate-line, 
.pro-converter .rate-line,
.pro-converter .code {
    color: #222222 !important;
}

.pro-converter .currency-input input[type="number"] {
    background-color: #ffffff !important;
    background-image: none !important;
    box-shadow: none !important;
    color: #222222 !important;
}

/* Floating Labels */
.pcc-input-label {
    position: absolute;
    left: 20px;
    top: 8px;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #777777 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    line-height: 1 !important;
    pointer-events: none;
    z-index: 15;
}

/* ==============================
📱 MOBILE RESPONSIVE
============================== */
@media (max-width: 600px) {
    .pcc-market-subtext-container {
        min-height: 37px; /* Reserved 2-line wrapped space on mobile screens */
    }
}

@media (max-width: 480px) {
    .pro-converter {
        max-width: 100%;
        min-height: 340px; /* Updated mobile reserved layout height */
    }
    
    .card {
        padding: 16px;
    }

    .currency-input {
        height: 58px;
    }

    .currency-input input {
        height: 58px !important;
        font-size: 20px;
        padding-top: 24px !important;
        padding-bottom: 8px !important;
        padding-right: 90px !important;
    }

    .currency-select,
    .selected {
        height: 34px;
    }

    .selected img {
        width: 20px;
        height: 15px;
    }

    .pcc-input-label {
        left: 20px;
        top: 6px;
        font-size: 11px !important;
    }

    /* Fixed Top-Locked Sheet */
    .dropdown {
        position: fixed !important;
        top: 0 !important; 
        bottom: auto !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: #ffffff !important;
        transform: translateY(100%);
        transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1) !important;
        display: block !important;
        z-index: 999999 !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }

    .dropdown.active {
        transform: translateY(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .currency-list {
        max-height: calc(100vh - 60px) !important;
        padding-bottom: 60px;
    }

    .currency-item {
        padding: 16px 20px !important;
        height: 52px;
        font-size: 16px !important;
    }
}