:root {
    --bg: #f5f5f7;
    --card: rgba(255, 255, 255, 0.82);
    --text: #111111;
    --secondary: #86868b;
    --border: rgba(0, 0, 0, 0.07);
    --green: #16a34a;
    --red: #dc2626;
    --blue: #0071e3;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Vazirmatn", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button {
    font-family: inherit;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: auto;
}


/* ---------------- HEADER ---------------- */

.topbar {
    height: 90px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;

    font-size: 22px;
    font-weight: 700;
}

.brand-icon {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #111;
    color: white;

    border-radius: 11px;

    font-size: 18px;
}


.icon-button {
    width: 40px;
    height: 40px;

    border: 1px solid var(--border);
    background: rgba(255,255,255,.7);

    border-radius: 50%;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 18px;

    transition: .2s;
}

.icon-button:hover {
    transform: rotate(30deg);
    background: white;
}


/* ---------------- MARKET ---------------- */

.market-section {
    padding-top: 20px;
    padding-bottom: 80px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 24px;
}

.section-header h1 {
    margin: 0;

    font-size: 28px;
    font-weight: 700;
}

.section-header span {
    color: var(--secondary);
    font-size: 12px;
}


/* ---------------- CARDS ---------------- */

.cards {
    display: grid;

    grid-template-columns:
        repeat(auto-fill, minmax(190px, 1fr));

    gap: 14px;
}

.market-card {
    position: relative;

    min-height: 175px;

    padding: 20px;

    background: var(--card);

    border: 1px solid var(--border);

    border-radius: 22px;

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    cursor: pointer;

    transition:
        transform .2s ease,
        box-shadow .2s ease,
        border-color .2s ease;
}

.market-card:hover {
    transform: translateY(-3px);

    border-color: rgba(0,0,0,.12);

    box-shadow:
        0 12px 35px rgba(0,0,0,.07);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 25px;
}

.card-name {
    font-size: 15px;
    font-weight: 600;
}

.card-symbol {
    font-size: 11px;
    color: var(--secondary);

    direction: ltr;
}

.card-price {
    font-size: 25px;
    font-weight: 700;

    letter-spacing: -1px;

    direction: ltr;
    text-align: right;
}

.card-unit {
    color: var(--secondary);

    font-size: 11px;

    margin-right: 5px;
}

.card-change {
    margin-top: 8px;

    font-size: 12px;
    font-weight: 600;

    direction: ltr;
    text-align: right;
}

.positive {
    color: var(--green);
}

.negative {
    color: var(--red);
}

.neutral {
    color: var(--secondary);
}


/* ---------------- ADD CARD ---------------- */

.add-card {
    min-height: 175px;

    border: 1.5px dashed rgba(0,0,0,.15);

    border-radius: 22px;

    background: rgba(255,255,255,.3);

    cursor: pointer;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 10px;

    color: var(--secondary);

    transition: .2s;
}

.add-card:hover {
    background: rgba(255,255,255,.65);
    color: var(--text);
}

.add-card i {
    font-size: 25px;
}


/* ---------------- LOADING ---------------- */

.loading-card {
    min-height: 175px;

    grid-column: 1 / -1;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 12px;

    color: var(--secondary);
}

.spinner {
    width: 18px;
    height: 18px;

    border: 2px solid #ddd;
    border-top-color: #111;

    border-radius: 50%;

    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* ---------------- MODALS ---------------- */

.modal {
    position: fixed;
    inset: 0;

    z-index: 100;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;

    background: rgba(0,0,0,.35);

    backdrop-filter: blur(10px);
}

.modal-box,
.chart-box {
    position: relative;
    z-index: 2;

    background: rgba(255,255,255,.94);

    border: 1px solid rgba(255,255,255,.8);

    border-radius: 26px;

    box-shadow:
        0 30px 80px rgba(0,0,0,.18);
}


/* ---------------- ADD MODAL ---------------- */

.modal-box {
    width: min(520px, 100%);
    padding: 22px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.close-button {
    border: 0;
    background: #f1f1f3;

    width: 34px;
    height: 34px;

    border-radius: 50%;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
}

.available-items {
    display: grid;

    grid-template-columns: repeat(2, 1fr);

    gap: 10px;
}

.available-item {
    border: 1px solid var(--border);

    background: #fafafa;

    padding: 13px;

    border-radius: 14px;

    cursor: pointer;

    text-align: right;

    transition: .15s;
}

.available-item:hover {
    background: #f0f0f2;
}

.available-item small {
    display: block;

    color: var(--secondary);

    margin-top: 3px;
}


/* ---------------- CHART ---------------- */

.chart-box {
    width: min(850px, 100%);

    padding: 25px;
}

.chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.chart-name {
    display: block;

    font-size: 17px;
    font-weight: 600;

    margin-bottom: 5px;
}

.chart-price-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.chart-price-row strong {
    font-size: 27px;
}

#chartChange {
    font-size: 13px;
    font-weight: 600;
}

.range-buttons {
    display: flex;
    gap: 6px;

    margin: 25px 0 15px;
}

.range-button {
    border: 0;

    background: #f1f1f3;

    color: #666;

    padding: 7px 13px;

    border-radius: 10px;

    font-size: 12px;

    cursor: pointer;
}

.range-button.active {
    background: #111;
    color: white;
}

.chart-container {
    position: relative;

    width: 100%;
    height: 330px;
}

.chart-status {
    text-align: center;

    color: var(--secondary);

    font-size: 12px;

    margin-top: 10px;
}


/* ---------------- MOBILE ---------------- */

@media (max-width: 600px) {

    .container {
        width: min(100% - 20px, 1180px);
    }

    .topbar {
        height: 75px;
    }

    .market-section {
        padding-top: 10px;
    }

    .section-header h1 {
        font-size: 24px;
    }

    .cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .market-card,
    .add-card {
        min-height: 155px;
        padding: 15px;
        border-radius: 18px;
    }

    .card-price {
        font-size: 20px;
    }

    .card-top {
        margin-bottom: 20px;
    }

    .chart-box {
        padding: 18px;
        border-radius: 22px;
    }

    .chart-container {
        height: 270px;
    }

    .available-items {
        grid-template-columns: 1fr 1fr;
    }
}