/* =====================================================
   ViraApp - استایل اصلی
   طراحی موبایل-فرست مشابه اسکرین‌شات‌ها
   ===================================================== */

@import url('https://cdn.fontcdn.ir/Font/Persian/Vazirmatn/Vazirmatn.css');
@font-face {
    font-family: "iran";
    src: url('./iran.woff2');
}

body,*{
    font-family: "iran";
}
:root {
    --primary-green: #16a34a;
    --primary-green-dark: #15803d;
    --primary-green-light: #dcfce7;
    --primary-green-bg: #f0fdf4;

    --primary-red: #dc2626;
    --primary-red-dark: #b91c1c;
    --primary-red-light: #fee2e2;
    --primary-red-bg: #fef2f2;

    --bg-pink: #fff5f5;
    --bg-white: #ffffff;
    --bg-gray: #f9fafb;
    --bg-dark: #1f2937;
    --bg-header: #111827;

    --text-dark: #111827;
    --text-gray: #6b7280;
    --text-light: #9ca3af;

    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--bg-pink);
    color: var(--text-dark);
    direction: rtl;
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-green); text-decoration: none; }
a:hover { color: var(--primary-green-dark); }

/* ---------- Layout ---------- */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg-pink);
    min-height: 100vh;
    padding-bottom: 80px;
    position: relative;
}

.admin-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

/* ---------- Header ---------- */
.top-header {
    background: var(--bg-header);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}
.top-header .balance { font-weight: 700; direction: ltr; }
.top-header .time { direction: ltr; }

.page-header {
    padding: 16px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    font-weight: 700;
    font-size: 16px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 12px;
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-size: 15px;
    font-weight: 700;
    padding: 16px 16px 8px 16px;
    text-align: right;
    color: var(--text-dark);
}

/* ---------- قیمت کارت ها ---------- */
.market-section {
    padding: 0 12px;
    margin-bottom: 16px;
}
.market-header {
    display: flex;
    justify-content: space-between;
    padding: 8px 8px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 14px;
}
.market-header .buy-label { color: var(--primary-green-dark); }
.market-header .sell-label { color: var(--primary-red-dark); }
.market-header a { font-size: 12px; }

.price-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.price-box {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform .15s;
}
.price-box:hover { transform: translateY(-2px); }
.price-box .mesghal {
    font-size: 15px;
    font-weight: 800;
    display: block;
    direction: ltr;
    letter-spacing: .3px;
}
.price-box .gram {
    font-size: 11px;
    opacity: 0.85;
    display: block;
    direction: ltr;
    margin-top: 3px;
}

.price-box.buy {
    background: var(--primary-green);
    color: #fff;
}
.price-box.sell {
    background: var(--primary-red);
    color: #fff;
}
.price-box.disabled {
    background: #e5e7eb !important;
    color: #9ca3af !important;
    cursor: not-allowed;
}

.market-label {
    padding: 0 8px;
    font-weight: 700;
    color: var(--text-dark);
    text-align: center;
    font-size: 14px;
}

/* ---------- Buy form (expanded) ---------- */
.buy-form-inline {
    background: #ecfdf5;
    border: 2px solid var(--primary-green);
    border-radius: var(--radius-md);
    padding: 10px;
    margin: 0 4px;
}
.buy-form-inline .price-line {
    background: var(--primary-green);
    color: #fff;
    text-align: center;
    padding: 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-weight: 700;
    direction: ltr;
    font-size: 14px;
}
.input-with-buttons {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 6px;
}
.input-with-buttons input {
    flex: 1;
    border: none;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    padding: 8px;
    outline: none;
    background: transparent;
    font-family: inherit;
    direction: ltr;
}
.round-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.round-btn.plus { background: var(--primary-green); }
.round-btn.minus { background: var(--primary-red); }

.confirm-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--primary-green);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    margin-top: 4px;
    transition: background .15s;
}
.confirm-btn:hover { background: var(--primary-green-dark); }
.confirm-btn.red { background: var(--primary-red); }
.confirm-btn.red:hover { background: var(--primary-red-dark); }

/* ---------- Coin section ---------- */
.coin-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 6px 12px;
    gap: 8px;
    margin-bottom: 8px;
}
.coin-row .price-box { padding: 12px; }
.coin-row .price-box .mesghal { font-size: 14px; }

/* ---------- Balance card ---------- */
.balance-card {
    background: #111827;
    color: #fff;
    margin: 12px;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}
.balance-card .item .label { color: #9ca3af; margin-bottom: 4px; }
.balance-card .item.gold .val { color: var(--primary-green-light); font-weight: 800; }
.balance-card .item.cash .val { color: #fecaca; font-weight: 800; direction: ltr; }

/* ---------- Bottom Nav ---------- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,.05);
}
.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-gray);
    font-size: 11px;
    padding: 4px 12px;
    cursor: pointer;
}
.bottom-nav .nav-item.active { color: var(--primary-green); }
.bottom-nav .nav-item i { font-size: 20px; margin-bottom: 4px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-gray);
    margin-bottom: 6px;
    font-weight: 600;
}
.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    outline: none;
    transition: border-color .15s;
}
.form-control:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(22,163,74,.1);
}
.form-control.error { border-color: var(--primary-red); }

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all .15s;
    text-align: center;
    text-decoration: none;
}
.btn-primary { background: var(--primary-green); color: #fff; }
.btn-primary:hover { background: var(--primary-green-dark); color: #fff; }
.btn-danger { background: var(--primary-red); color: #fff; }
.btn-danger:hover { background: var(--primary-red-dark); color: #fff; }
.btn-secondary { background: #f3f4f6; color: var(--text-dark); }
.btn-block { display: block; width: 100%; }
.btn-outline { background: transparent; border: 2px solid var(--primary-green); color: var(--primary-green); }

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 13px;
}
.alert-success { background: var(--primary-green-light); color: var(--primary-green-dark); }
.alert-danger { background: var(--primary-red-light); color: var(--primary-red-dark); }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-backdrop.active { display: flex; }
.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: modalIn .2s;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(.95); }
    to { opacity: 1; transform: scale(1); }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.modal-title { font-weight: 700; font-size: 16px; }
.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    color: var(--text-gray);
    padding: 4px;
}

.modal-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}
.modal-row:last-child { border: none; }
.modal-row .label { color: var(--text-gray); }
.modal-row .value { font-weight: 700; direction: ltr; }

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}
.modal-actions button { flex: 1; }

/* ---------- Tables (admin) ---------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.data-table th {
    background: #f9fafb;
    padding: 12px;
    text-align: right;
    font-weight: 700;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-gray);
}
.data-table td {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
}
.data-table tr:hover { background: #fafafa; }
.data-table tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: var(--primary-green-light); color: var(--primary-green-dark); }
.badge-rejected { background: var(--primary-red-light); color: var(--primary-red-dark); }
.badge-cancelled { background: #e5e7eb; color: #4b5563; }
.badge-normal { background: #e5e7eb; color: #4b5563; }
.badge-partner { background: #dbeafe; color: #1e40af; }
.badge-vip { background: #fef3c7; color: #92400e; }
.badge-exclusive { background: #f3e8ff; color: #6b21a8; }

/* ---------- Admin Layout ---------- */
.admin-nav {
    background: var(--bg-header);
    color: #fff;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-radius: var(--radius-md);
}
.admin-nav .brand { font-weight: 800; font-size: 18px; }
.admin-nav .menu { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-nav .menu a {
    color: #d1d5db;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: all .15s;
}
.admin-nav .menu a:hover, .admin-nav .menu a.active {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.stat-card .stat-label { color: var(--text-gray); font-size: 12px; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 22px; font-weight: 800; direction: ltr; }
.stat-card.green .stat-value { color: var(--primary-green-dark); }
.stat-card.red .stat-value { color: var(--primary-red-dark); }
.stat-card.blue .stat-value { color: #1e40af; }

/* ---------- Login page ---------- */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.login-box {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.login-box h2 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-dark);
    font-size: 20px;
}
.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 32px;
}

/* ---------- Loader ---------- */
.loader {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Order tracker (timer) ---------- */
.order-status {
    padding: 10px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 700;
    margin-top: 10px;
}
.order-status.pending {
    background: #fef3c7;
    color: #92400e;
}
.order-status.approved {
    background: var(--primary-green-light);
    color: var(--primary-green-dark);
}
.order-status.rejected {
    background: var(--primary-red-light);
    color: var(--primary-red-dark);
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-success { color: var(--primary-green-dark); }
.text-danger { color: var(--primary-red-dark); }
.hidden { display: none !important; }

.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }

@media (max-width: 640px) {
    .admin-container { padding: 12px; }
    .admin-nav { flex-direction: column; gap: 8px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .data-table { font-size: 11px; }
    .data-table th, .data-table td { padding: 8px 6px; }
}

/* ---------- Preview table (CSV) ---------- */
.preview-table tr.valid { background: #f0fdf4; }
.preview-table tr.invalid { background: #fef2f2; }
.preview-table tr.invalid td { color: var(--primary-red-dark); }

/* ---------- Persian digits helper ---------- */
.fa-digits { font-feature-settings: "tnum"; direction: ltr; unicode-bidi: bidi-override; }
