/* ==========================================
   1. تنظیمات پایه و متغیرهای دارک سایبرپانکی
   ================================---------- */
:root {
    --bg-main: #07090e;
    --bg-sidebar: #0b0f17;
    --card-bg: #111827;
    --card-bg-hover: #1f2937;
    --primary-color: #10b981; /* سبز نئونی صرافی‌ها */
    --primary-hover: #059669;
    --danger-color: #ef4444;
    --text-color: #f9fafb;
    --text-muted: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(16, 185, 129, 0.4);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazirmatn', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden; /* جلوگیری کامل از اسکرول افقی کل صفحه */
    width: 100%;
}

.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
    overflow-x: hidden;
}

/* ==========================================
   2. منوی کناری (Sidebar)
   ================================---------- */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 25px 20px;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 35px;
    color: var(--text-color);
    white-space: nowrap;
}

.sidebar-logo span, .sidebar-logo i {
    color: var(--primary-color);
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.sidebar-menu li.active a,
.sidebar-menu li a:hover {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--primary-color);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.user-mini {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-mini img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--primary-color);
}

.user-mini h4 {
    font-size: 14px;
    font-weight: 700;
}

.user-mini span {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==========================================
   3. محتوای اصلی داشبورد و هدر
   ================================---------- */
.main-content {
    margin-right: 260px;
    flex-grow: 1;
    padding: 30px;
    width: calc(100% - 260px);
    overflow-x: hidden;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 15px 25px;
    border-radius: 16px;
    margin-bottom: 30px;
    gap: 15px;
    flex-wrap: wrap;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 10px;
    width: 350px;
    max-width: 100%;
}

.header-search i {
    color: var(--text-muted);
}

.header-search input {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 14px;
    width: 100%;
    outline: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.wallet-balance-badge {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.notification-btn {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
}

.notification-btn:hover {
    border-color: var(--primary-color);
}

.notification-btn .dot {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 8px;
    height: 8px;
    background-color: var(--danger-color);
    border-radius: 50%;
}

/* ==========================================
   4. کارت‌های آماری بالای صفحه
   ================================---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.up {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--primary-color);
}

.stat-icon.down {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
}

.stat-info span {
    font-size: 12px;
    color: var(--text-muted);
}

.stat-info h3 {
    font-size: 18px;
    font-weight: 800;
    margin: 3px 0;
}

.trend-up {
    font-size: 11px;
    color: var(--primary-color);
    font-weight: 600;
}

.trend-down {
    font-size: 11px;
    color: var(--danger-color);
    font-weight: 600;
}

/* ==========================================
   5. بخش نمودار و فرم معامله
   ================================---------- */
.trading-section {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card, .trade-box, .markets-section {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 25px;
    border-radius: 16px;
    width: 100%;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
    flex-wrap: wrap;
}

.coin-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btc-icon {
    font-size: 32px;
    color: #f7931a;
}

.coin-title h2 {
    font-size: 18px;
    font-weight: 800;
}

.coin-title span {
    font-size: 12px;
    color: var(--text-muted);
}

.chart-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.chart-actions button {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.chart-actions button.active,
.chart-actions button:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.canvas-wrapper {
    height: 270px;
    width: 100%;
    position: relative;
}

/* فرم معامله سریع */
.trade-tabs {
    display: flex;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active.buy-active {
    background-color: var(--primary-color);
    color: white;
}

.tab-btn.active.sell-active {
    background-color: var(--danger-color);
    color: white;
}

.trade-form .form-group {
    margin-bottom: 15px;
}

.trade-form label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.trade-form select,
.trade-form input {
    width: 100%;
    padding: 12px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 14px;
    outline: none;
}

.trade-form input:focus, .trade-form select:focus {
    border-color: var(--primary-color);
}

.total-calc {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-main);
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.total-calc strong {
    color: var(--primary-color);
}

.btn-trade {
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-trade.buy {
    background-color: var(--primary-color);
    color: white;
}

.btn-trade.buy:hover {
    background-color: var(--primary-hover);
}

.btn-trade.sell {
    background-color: var(--danger-color);
    color: white;
}

.trade-msg {
    margin-top: 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
}

/* ==========================================
   6. جدول بازارها و فوتر
   ================================---------- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
    flex-wrap: wrap;
}

.section-header h3 {
    font-size: 18px;
    font-weight: 800;
}

.section-header span {
    font-size: 12px;
    color: var(--text-muted);
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.crypto-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    font-size: 14px;
}

.crypto-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.crypto-table td {
    padding: 16px 15px;
    border-bottom: 1px solid var(--border-color);
}

.coin-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.coin-name-cell i {
    font-size: 22px;
}

.coin-name-cell span {
    display: flex;
    flex-direction: column;
    font-size: 13px;
}

.coin-name-cell strong {
    font-size: 11px;
    color: var(--text-muted);
}

.text-success { color: var(--primary-color); font-weight: 600; }
.text-danger { color: var(--danger-color); font-weight: 600; }

.btn-mini {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--primary-color);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-mini:hover {
    background-color: var(--primary-color);
    color: white;
}

/* فوتر داشبورد */
.dashboard-footer {
    text-align: center;
    padding: 25px 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 40px;
    background-color: var(--card-bg);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.dashboard-footer .footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.dashboard-footer .team-name {
    color: var(--primary-color);
    font-weight: 700;
}

.dashboard-footer .footer-links {
    display: flex;
    gap: 15px;
    font-size: 12px;
    margin-top: 4px;
}

.dashboard-footer .footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.dashboard-footer .footer-links a:hover {
    color: var(--primary-color);
}


/* ==========================================
   7. سیستم ریسپانسیو و واکنش‌گرا (موبایل و تبلت)
   ================================---------- */

@media (max-width: 992px) {
    .sidebar {
        width: 75px;
        padding: 20px 10px;
    }
    .sidebar-logo span, 
    .sidebar-menu span, 
    .sidebar-footer .user-mini span, 
    .sidebar-footer .user-mini h4 {
        display: none;
    }
    .sidebar-logo {
        justify-content: center;
        margin-bottom: 25px;
    }
    .sidebar-menu li a {
        justify-content: center;
        font-size: 18px;
        padding: 14px;
    }
    .sidebar-footer {
        display: flex;
        justify-content: center;
    }
    .user-mini img {
        width: 38px;
        height: 38px;
    }
    .main-content {
        margin-right: 75px;
        width: calc(100% - 75px);
        padding: 20px;
    }
    .trading-section {
        grid-template-columns: 1fr;
    }
    .header-search {
        width: 220px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: 65px;
        top: auto;
        bottom: 0;
        right: 0;
        flex-direction: row;
        padding: 10px 15px;
        border-left: none;
        border-top: 1px solid var(--border-color);
        background-color: rgba(11, 15, 23, 0.98);
        backdrop-filter: blur(12px);
        z-index: 1000;
    }
    .sidebar-logo, 
    .sidebar-footer {
        display: none;
    }
    .sidebar-menu {
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        width: 100%;
        gap: 0;
    }
    .sidebar-menu li a {
        padding: 8px 12px;
        font-size: 20px;
        border-radius: 8px;
    }
    .main-content {
        margin-right: 0;
        width: 100%;
        padding: 12px;
        /* فضای خالی زیاد در پایین صفحه برای اینکه فوتر و محتوا زیر منوی شناور موبایل نروند */
        padding-bottom: 110px; 
    }
    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }
    .header-search {
        width: 100%;
    }
    .header-actions {
        justify-content: space-between;
        width: 100%;
        gap: 8px;
    }
    .wallet-balance-badge {
        font-size: 12px;
        padding: 6px 10px;
        flex-grow: 1;
        justify-content: center;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat-card {
        padding: 12px;
        gap: 8px;
    }
    .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }
    .stat-info h3 {
        font-size: 14px;
    }
    .chart-card, .trade-box, .markets-section {
        padding: 15px;
    }

    /* تنظیمات جدول در موبایل برای فیت شدن کامل بدون اسکرول افقی */
    .crypto-table {
        min-width: 100%;
    }
    .crypto-table th, .crypto-table td {
        padding: 10px 8px;
        font-size: 12px;
    }
    .crypto-table th:nth-child(3),
    .crypto-table td:nth-child(3) {
        display: none; 
    }

    /* استایل شیک و فشرده فوتر در موبایل */
    .dashboard-footer {
        padding: 18px 12px;
        margin-top: 25px;
        border-radius: 12px;
        font-size: 11px;
        gap: 6px;
    }
    .dashboard-footer .footer-links {
        gap: 10px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .chart-actions button {
        padding: 5px 8px;
        font-size: 11px;
    }
    .canvas-wrapper {
        height: 200px;
    }
}