/* ==========================================
   RATE HISTORY
========================================== */

.history-section {
    width: 100%;
    margin: 30px 0;
    background: #f5f7fa;
    border-radius: 22px;
    overflow: hidden;
}


/* =========================
   HEADER
========================= */

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: #031a31;
    color: #fff;
}

.history-title {
    display: flex;
    align-items: center;
    gap: 13px;
}

.history-icon {
    width: 48px;
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 14px;

    background: #e3b84f;
    color: #031a31;

    font-size: 24px;
}

.history-title h2 {
    margin: 0;
    color: #fff;
    font-size: 22px;
    font-weight: bold;
}

.history-title p {
    margin: 4px 0 0;
    color:rgba(255,255,255,.65);
    font-size: 13px;
}


/* =========================
   CURRENCY SELECT
========================= */

#history-currency {
    width: 140px;
    height: 42px;

    padding: 0 12px;

    border: none;
    border-radius: 11px;

    background: #0a2743;
    color: #fff;

    font-family: var(--font-main);
    font-size: 15px;

    outline: none;
    cursor: pointer;
    border:1px solid rgba(255,255,255,.19)
}


/* =========================
   PERIOD BUTTONS
========================= */

.history-periods {
    display: flex;
    justify-content: center;
    align-items: center;

    gap: 8px;

    padding: 20px 15px 12px;
}

.history-periods button {
    width: 62px;
    height: 36px;

    border: none;
    border-radius: 10px;

    background: #e9edf2;
    color: #031a31;

    font-family: var(--font-main);
    font-size: 14px;
    font-weight: bold;

    cursor: pointer;

    transition: .25s ease;
}

.history-periods button:hover {
    transform: translateY(-2px);
}

.history-periods button.active {
    background: #031a31;
    color: #e3b84f;
}


/* =========================
   CHART
========================= */

.history-chart-wrapper {
    position: relative;

    width: 100%;
    height: 330px;

    padding: 10px 25px 15px;

    box-sizing: border-box;
}

#rateHistoryChart {
    width: 100% !important;
    height: 100% !important;
}


/* =========================
   CURRENT BUY / SELL
========================= */

.history-current {
    display: flex;
    justify-content: center;
    align-items: center;

    gap: 90px;

    padding: 15px 20px 25px;

    text-align: center;
}

.history-current div {
    min-width: 130px;
}

.history-current span {
    display: block;

    margin-bottom: 5px;

    color: #667085;

    font-size: 14px;
}

.history-current strong {
    display: block;

    color: #031a31;

    font-size: 23px;
    font-weight: bold;
}


/* =========================
   MOBILE
========================= */

@media (max-width: 600px) {

    .history-section {
        width: auto;
        margin: 20px 10px;
        border-radius: 18px;
    }

    .history-header {
        flex-direction: column;
        align-items: stretch;

        gap: 14px;

        padding: 17px;
    }

    .history-title {
        justify-content: center;
    }

    .history-title h2 {
        font-size: 19px;
    }

    .history-title p {
        font-size: 12px;
    }

    .history-icon {
        width: 43px;
        height: 43px;
        font-size: 21px;
    }

    #history-currency {
        width: 100%;
        height: 40px;
    }

    .history-periods {
        justify-content: flex-start;

        overflow-x: auto;

        padding: 17px 12px 10px;

        scrollbar-width: none;
    }

    .history-periods::-webkit-scrollbar {
        display: none;
    }

    .history-periods button {
        flex: 0 0 55px;
        height: 36px;
    }

    .history-chart-wrapper {
        height: 250px;
        padding: 8px 10px 12px;
    }

    .history-current {
        gap: 30px;
        padding: 12px 15px 20px;
    }

    .history-current div {
        min-width: 95px;
    }

    .history-current strong {
        font-size: 20px;
    }

}
/* ==========================================
   HISTORY HEADER - ENGLISH ONLY
========================================== */

html[lang="en"] .history-header {
    direction: ltr;
}

html[lang="en"] .history-title {
    order: 1;
}

html[lang="en"] #history-currency {
    order: 2;
}



/* ==========================================
   RATE HISTORY — MOBILE FINAL
========================================== */

@media (max-width:600px){

    /* -------------------------
       HISTORY BOX
    ------------------------- */

    .history-section{
        width:auto;
        margin:20px 10px;
        border-radius:18px;
        overflow:hidden;
    }


    /* -------------------------
       HEADER
    ------------------------- */

    .history-header{
        display:flex;
        flex-direction:column;
        align-items:stretch;
        gap:13px;

        padding:17px 15px;
    }


    .history-title{
        display:flex;
        align-items:center;
        justify-content:center;
        gap:10px;
    }


    .history-icon{
        width:42px;
        height:42px;

        border-radius:12px;

        font-size:20px;
    }


    .history-title h2{
        font-size:18px;
        line-height:1.3;
    }


    .history-title p{
        margin-top:3px;
        font-size:11px;
    }


    /* -------------------------
       CURRENCY SELECT
    ------------------------- */

    #history-currency{

        display:block;

        width:100%;
        height:42px;

        padding:0 12px;

        border-radius:10px;

        font-size:14px;

        box-sizing:border-box;
    }


    /* -------------------------
       PERIODS
       1Y  3M  1M  7D  1D
       CENTER — NO SCROLL
    ------------------------- */

    .history-periods{

        display:flex;

        flex-direction:row;

        align-items:center;
        justify-content:center;

        gap:6px;

        width:100%;

        padding:15px 8px 10px;

        box-sizing:border-box;

        overflow:visible;

        scrollbar-width:none;
    }


    .history-periods::-webkit-scrollbar{
        display:none;
    }


    .history-periods button{

        flex:0 0 auto;

        width:48px;
        height:34px;

        padding:0;

        border-radius:9px;

        font-size:12px;

        white-space:nowrap;
    }


    /* -------------------------
       CHANGE VISUAL ORDER
       HTML stays untouched
       
       HTML:
       1D
       7D
       1M
       3M
       1Y

       Mobile:
       1Y
       3M
       1M
       7D
       1D
    ------------------------- */

    .history-periods button:nth-child(1){
        order:5;
    }

    .history-periods button:nth-child(2){
        order:4;
    }

    .history-periods button:nth-child(3){
        order:3;
    }

    .history-periods button:nth-child(4){
        order:2;
    }

    .history-periods button:nth-child(5){
        order:1;
    }


    /* -------------------------
       CHART
    ------------------------- */

    .history-chart-wrapper{

        width:100%;

        height:250px;

        padding:8px 10px 12px;

        box-sizing:border-box;
    }


    #rateHistoryChart{
        width:100% !important;
        height:100% !important;
    }


    /* -------------------------
       CURRENT BUY / SELL
    ------------------------- */

    .history-current{

        display:flex;

        align-items:center;
        justify-content:center;

        gap:35px;

        padding:12px 12px 20px;
    }


    .history-current div{
        min-width:90px;
    }


    .history-current span{
        font-size:12px;
        margin-bottom:4px;
    }


    .history-current strong{
        font-size:19px;
    }

}
@media (max-width: 600px) {

    /* خودی IQD ▼ ـەکە هیچ کەم ناکرێتەوە */
    .history-currency-trigger {
        width: 100%;
        height: 42px;
        padding: 0 14px;
        font-size: 14px;
    }

    /* تەنها لیستی currency ـەکان بچووک */
    .history-currency-menu {
        width: 145px;
        max-height: 180px;

        margin-top: 4px;

        border-radius: 8px;

        overflow-y: auto;
    }

    .history-currency-option {
        height: 34px;
        padding: 0 10px;
        font-size: 12px;
    }

}









/* ==========================================
   CUSTOM HISTORY CURRENCY SELECTOR
========================================== */

.history-currency-dropdown {
    position: relative;
    width: 100%;
}


/* IQD ▼ — خودی selector */

.history-currency-trigger {
    width: 100%;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 14px;

    background: #0a2743;
    color: #fff;

    border: 1px solid rgba(255,255,255,.18);
    border-radius: 10px;

    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
}


/* Arrow */

.history-currency-arrow {
    font-size: 14px;
    transition: transform .2s ease;
}


/* Dropdown menu */

.history-currency-menu {
    display: none;

    position: absolute;
    top: calc(100% + 5px);
    right: 0;

    width: 145px;
    max-height: 180px;

    overflow-y: auto;

    background: #0a2743;

    border: 1px solid rgba(255,255,255,.18);
    border-radius: 8px;

    box-shadow: 0 10px 25px rgba(0,0,0,.25);

    z-index: 999;
}


/* Open */

.history-currency-dropdown.open
.history-currency-menu {
    display: block;
}


/* Currency item */

.history-currency-option {
    width: 100%;
    height: 34px;

    display: flex;
    align-items: center;

    padding: 0 10px;

    box-sizing: border-box;

    background: transparent;
    color: #fff;

    border: none;

    font-family: var(--font-main);
    font-size: 12px;

    cursor: pointer;
}


.history-currency-option:hover {
    background: #123957;
}


.history-currency-option.active {
    background: #e3b84f;
    color: #031a31;
    font-weight: 700;
}


/* Hide real select */

.history-currency-dropdown > #history-currency {
    position: absolute;

    width: 1px;
    height: 1px;

    opacity: 0;

    pointer-events: none;
}


/* ==========================================
   MOBILE
========================================== */

@media (max-width: 600px) {

    .history-currency-dropdown {
        width: 100%;
    }

    /* IQD ▼ stays full size */
    .history-currency-trigger {
        width: 100%;
        height: 42px;

        font-size: 14px;
    }

    /* Only the opened list is small */
    .history-currency-menu {
        width: 145px;
        right: 0;
    }

}@media (max-width: 600px) {

    .history-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;

        padding: 15px;
        box-sizing: border-box;
    }

    /* Rate History */
    .history-title {
        order: 1;
        justify-content: center;
    }

    /* EUR selector */
    .history-currency-dropdown {
        order: 2;

        width: 100%;
        margin: 0;

        flex: none;
    }

    .history-currency-trigger {
        width: 100%;
        height: 42px;

        padding: 0 13px;

        box-sizing: border-box;

        border-radius: 10px;
        font-size: 14px;
    }

    /* Dropdown menu */
    .history-currency-menu {
        position: absolute;

        top: calc(100% + 4px);
        left: 0;

        width: 100%;

        max-height: 190px;
        overflow-y: auto;

        z-index: 999;
    }

    .history-currency-option {
        height: 38px;
        font-size: 13px;
    }
}



@media (min-width: 601px) {

    .history-header {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        padding: 18px 24px;
    }

    /* Selector لە چەپ */
    .history-currency-dropdown {
        width: 150px;
        flex: 0 0 150px;
        margin: 0;
    }

    .history-currency-trigger {
        width: 150px;
        height: 40px;
    }

    /* Rate History لە ناوەڕاست */
    .history-title {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);

        display: flex;
        align-items: center;
        gap: 11px;

        margin: 0;
    }

}