@font-face {
  font-family: 'Baloo Bhaijaan 2';
  src: url('https://quamtex.ir/fonts/webfonts/baloo-bhaijaan-2-latin-500-normal.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Baloo Bhaijaan 2';
  src: url('https://quamtex.ir/fonts/webfonts/baloo-bhaijaan-2-arabic-500-normal.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
    --primary: #112548;
    --primary-light: #334e7c;
    --accent: #3376A3;
    --bg-page: #f1f5f9;
    --bg-card: #ffffff;
    --border-light: #e2e8f0;
    --text-muted: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
}

body {
  background-color: var(--bg-page);
  font-family: 'Baloo Bhaijaan 2', Arial, sans-serif;
  color: var(--primary);
  margin: 0;
}

.main-container {
  display: flex;
  flex-direction: row;
}

.main-content {
  padding: clamp(1rem, 2vw, 2rem);
  margin: clamp(0.5rem, 1.5vw, 1.5rem);
  background-color: #ffffff;
  border-radius: 24px;
  font-size: clamp(0.938rem, 0.842rem + 0.426vw, 1.188rem);
  text-align: center;
  /* مدرن‌سازی سایه کانتینر اصلی */
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: var(--primary);
  width: 100%;
}
/* هدر صفحه */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: clamp(1.5rem, 2.5vw, 2.2rem);
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 0;
}

/* کارت اصلی کریپتو */
.crypto-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 2rem;
}

/* سیستم گرید برای سطرها */
.crypto-row {
    display: grid;
    grid-template-columns: 60px 1.5fr 1fr 1fr 1fr;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s ease;
}

.crypto-row:last-child {
    border-bottom: none;
}

.crypto-row:hover:not(.header-row) {
    background-color: #f8fafc;
}

/* استایل هدر جدول */
.header-row {
    background-color: var(--primary);
    color: white;
    font-weight: bold;
    font-size: 0.95rem;
    border-bottom: none;
}

/* استایل سلول‌ها */
.col-rank {
    display: flex;
    justify-content: center;
}

.rank-badge {
    background-color: rgba(0,0,0,0.1);
    color: inherit;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.85rem;
}

.header-row .rank-badge {
    background: none;
}

.col-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    color: var(--primary);
}

.coin-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.col-price-usd, .col-price-irt {
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-weight: 500;
    direction: ltr; /* اعداد انگلیسی بهتر نمایش داده شوند */
    text-align: center;
}

.col-change {
    display: flex;
    justify-content: flex-end; /* تراز به چپ در RTL */
    padding-left: 10px;
}

.col-change span {
    background-color: var(--text-muted);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    min-width: 80px;
    text-align: center;
    direction: ltr;
    transition: background 0.3s;
}

    /* 2. تبدیل هر ردیف به یک کارت */
/* فوتر آپدیت */
.footer-row {
    padding: 15px;
    background-color: #f8fafc;
    text-align: center;
    border-top: 1px solid var(--border-light);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* کارت توضیحات */
.description-card {
    background-color: #fff4f4; /* تم قرمز خیلی ملایم برای هشدار */
    border: 1px solid #fed7d7;
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: right;
    position: relative;
    overflow: hidden;
    direction: rtl;
}

.description-card::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background-color: var(--danger);
}

.section-title {
    color: var(--danger);
    font-size: 1.4rem;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.text-content {
    font-size: 0.95rem;
    color: var(--primary);
    opacity: 0.9;
}

/* --- حالت موبایل (Responsive) --- */
@media (max-width: 768px) {

    .crypto-row {
        display: grid;
        background: #ffffff;
        margin-bottom: 10px;
        padding: 15px;
        border-radius: 16px;
        border: 1px solid var(--border-light);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 10px 18px;
        padding-bottom: 5px;
        grid-template-areas:
        "name change"
        "price-usd price-usd"
        "price-irt price-irt";
    }

    .col-name {
        grid-area: name;
        font-size: 1.1rem;
        margin: 0;
        border: none;
        padding: 0;
        justify-content: flex-start;
    }

    .col-change {
        width: 100%;
        text-align: right;
    }
    

    .col-price-usd ,.col-price-irt {
        grid-area: price-usd;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background-color: #f8fafc;
        padding: 10px;
        border-radius: 10px;
        font-size: 1rem;
        color: var(--primary);
        text-align: left;
        justify-content: center;
    }

    .col-rank {
        display: none;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .coin-icon {
        width: 35px;
        height: 35px;
    }
    .header-row {
        display: none;
    }
    
    .col-price-irt {
        grid-column: 2/3;
    }
        .col-price-usd {
        grid-column: 1/2;
    }
}








/* استایل دکمه بروزرسانی */
.refresh-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); /* گرادینت آبی جذاب */
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.5);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.refresh-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(59, 130, 246, 0.6);
}

.refresh-btn:active {
    transform: translateY(0);
}

.refresh-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* انیمیشن چرخش آیکون */
.refresh-icon {
    transition: transform 0.5s ease;
}

.spin-anim {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* تنظیمات مخصوص موبایل */
@media (max-width: 768px) {
    .refresh-btn {
        width: 70%; /* در موبایل دکمه تمام عرض می‌شود */
        padding: 14px; /* ارتفاع کمی بیشتر برای لمس راحت‌تر */
        font-size: 1.1rem;
    }
    
    .page-header {
        padding: 0 15px; /* فاصله از کناره‌ها در موبایل */
    }
}