/* ─── ربات عضوگیر بله — استایل مدرن مینی‌اپ ─── */

:root {
    --primary: #16a34a;
    --primary-2: #059669;
    --primary-soft: #dcfce7;
    --primary-dark: #15803d;
    --bg: #f0f4f3;
    --card: #ffffff;
    --card-border: rgba(15, 40, 30, 0.06);
    --text: #10231a;
    --muted: #64766e;
    --danger: #e5484d;
    --danger-soft: #fdecec;
    --warning: #b97b0e;
    --warning-soft: #fff6e5;
    --info: #2563eb;
    --info-soft: #e8f0fe;
    --field-bg: #f6f8f7;
    --field-border: #dfe7e3;
    --tabbar-bg: rgba(255, 255, 255, 0.86);
    --radius: 20px;
    --shadow: 0 2px 10px rgba(10, 40, 25, 0.06), 0 1px 3px rgba(10, 40, 25, 0.05);
    --shadow-lg: 0 10px 34px rgba(10, 40, 25, 0.14);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d1512;
        --card: #16211c;
        --card-border: rgba(255, 255, 255, 0.06);
        --text: #e8f0ec;
        --muted: #8fa39a;
        --primary-soft: rgba(22, 163, 74, 0.16);
        --danger-soft: rgba(229, 72, 77, 0.14);
        --warning-soft: rgba(245, 166, 35, 0.13);
        --warning: #eab308;
        --info-soft: rgba(37, 99, 235, 0.15);
        --info: #7ba7f7;
        --field-bg: #0f1915;
        --field-border: #2a3a32;
        --tabbar-bg: rgba(18, 27, 23, 0.88);
        --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
        --shadow-lg: 0 10px 34px rgba(0, 0, 0, 0.5);
        --primary-dark: #4ade80;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body { height: 100%; }

body {
    font-family: Vazirmatn, Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    padding-bottom: 96px; /* جا برای تب‌بار شناور */
    overflow-x: hidden;
}

/* هاله رنگی پس‌زمینه */
.bg-glow {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(420px 300px at 85% -60px, rgba(22, 163, 74, 0.18), transparent 70%),
        radial-gradient(380px 280px at -60px 30%, rgba(5, 150, 105, 0.10), transparent 70%);
    pointer-events: none;
}

.icon {
    width: 1.35em;
    height: 1.35em;
    flex-shrink: 0;
}

/* ─── هدر ─── */

.header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    padding-top: calc(14px + env(safe-area-inset-top, 0));
    background: linear-gradient(130deg, var(--primary), var(--primary-2) 90%);
    color: #fff;
    border-bottom-right-radius: 24px;
    border-bottom-left-radius: 24px;
    box-shadow: 0 8px 26px rgba(16, 120, 60, 0.28);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.avatar-ring {
    padding: 2.5px;
    border-radius: 50%;
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.25));
    flex-shrink: 0;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 19px;
}

.header-meta { min-width: 0; }

.user-name {
    font-weight: 800;
    font-size: 15.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.user-sub {
    font-size: 12px;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.coin-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.38);
    backdrop-filter: blur(6px);
    padding: 8px 14px;
    border-radius: 99px;
    font-weight: 800;
    font-size: 15.5px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.coin-badge .icon { color: #ffe9a8; }

/* ─── محتوا ─── */

.content {
    padding: 18px 16px 8px;
    max-width: 560px;
    margin: 0 auto;
    animation: fade-up 0.3s ease;
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.section-title {
    font-size: 17px;
    font-weight: 900;
    margin: 2px 0 10px;
    letter-spacing: -0.2px;
}

.section-desc {
    color: var(--muted);
    font-size: 13px;
    line-height: 2;
    margin-bottom: 16px;
}

.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 12px;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.card:active { transform: scale(0.995); }

.card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.card-title {
    font-weight: 800;
    font-size: 14.5px;
    margin-bottom: 3px;
    overflow-wrap: anywhere;
}

.card-sub {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.9;
}

.reward-chip {
    flex-shrink: 0;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 900;
    font-size: 13.5px;
    padding: 7px 12px;
    border-radius: 12px;
    white-space: nowrap;
}

/* ─── دکمه‌ها ─── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    padding: 11px 16px;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.08s, box-shadow 0.15s;
    text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(130deg, var(--primary), var(--primary-2));
    color: #fff;
    box-shadow: 0 6px 16px rgba(16, 140, 70, 0.3);
}

.btn-outline {
    background: var(--primary-soft);
    color: var(--primary-dark);
    border: none;
}

.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-block  { width: 100%; }
.btn-sm     { padding: 9px 12px; font-size: 13px; border-radius: 12px; }

.btn-group {
    display: flex;
    gap: 8px;
    margin-top: 13px;
}

.btn-group .btn { flex: 1; }

/* ─── فرم ─── */

.field { margin-bottom: 13px; }

.field label {
    display: block;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 7px;
}

.field input, .field select {
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    padding: 12px 14px;
    border: 1.5px solid var(--field-border);
    border-radius: 14px;
    background: var(--field-bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
}

.field input:focus, .field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
    background: var(--card);
}

.hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
    line-height: 1.9;
}

.cost-preview {
    background: var(--warning-soft);
    border: 1px dashed var(--warning);
    color: var(--text);
    border-radius: 14px;
    padding: 11px 13px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.9;
    margin-bottom: 13px;
}

/* ─── پیشرفت سفارش ─── */

.progress {
    height: 9px;
    border-radius: 99px;
    background: var(--field-bg);
    border: 1px solid var(--card-border);
    overflow: hidden;
    margin: 12px 0 7px;
}

.progress-bar {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--primary-2), var(--primary));
    transition: width 0.4s ease;
}

.status-chip {
    font-size: 11.5px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 99px;
    white-space: nowrap;
    flex-shrink: 0;
}

.st-active    { background: var(--primary-soft); color: var(--primary-dark); }
.st-paused    { background: var(--warning-soft); color: var(--warning); }
.st-completed { background: var(--info-soft);    color: var(--info); }
.st-cancelled { background: var(--field-bg);     color: var(--muted); }

/* ─── پکیج‌ها ─── */

.packages-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.package {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 12px 14px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.package::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 70px;
    background: radial-gradient(closest-side, rgba(22, 163, 74, 0.14), transparent);
    pointer-events: none;
}

.package .pkg-coins {
    font-size: 22px;
    font-weight: 900;
    color: var(--primary-dark);
    margin: 7px 0 2px;
}

.package .pkg-title { font-size: 13px; font-weight: 800; }

.package .pkg-price {
    color: var(--muted);
    font-size: 12.5px;
    margin: 7px 0 12px;
}

/* ─── حالت خالی و لودینگ ─── */

.empty {
    text-align: center;
    color: var(--muted);
    padding: 46px 18px;
    font-size: 14px;
    line-height: 2.1;
}

.empty .empty-icon {
    font-size: 44px;
    display: block;
    margin-bottom: 10px;
    filter: grayscale(0.2);
}

.loading-box {
    display: flex;
    justify-content: center;
    padding: 54px 0;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3.5px solid var(--field-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── تب‌بار شناور ─── */

.tabbar {
    position: fixed;
    bottom: calc(10px + env(safe-area-inset-bottom, 0));
    right: 12px;
    left: 12px;
    z-index: 10;
    display: flex;
    max-width: 560px;
    margin: 0 auto;
    background: var(--tabbar-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 2px 7px;
    border: none;
    border-radius: 16px;
    background: transparent;
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 800;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}

.tab .icon {
    width: 22px;
    height: 22px;
    transition: transform 0.18s;
}

.tab.active {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.tab.active .icon { transform: translateY(-1px) scale(1.08); }

/* ─── توست ─── */

.toast {
    position: fixed;
    bottom: calc(86px + env(safe-area-inset-bottom, 0));
    right: 50%;
    transform: translateX(50%);
    z-index: 50;
    background: #1c2a23;
    color: #fff;
    padding: 12px 18px;
    border-radius: 14px;
    font-size: 13.5px;
    font-weight: 700;
    max-width: 88vw;
    text-align: center;
    line-height: 1.9;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: toast-in 0.25s ease;
}

.toast.err { background: var(--danger); }
.toast.ok  { background: var(--primary-dark); color: #fff; }

@media (prefers-color-scheme: dark) {
    .toast.ok { background: #166534; }
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(50%) translateY(10px); }
    to   { opacity: 1; transform: translateX(50%) translateY(0); }
}
