/* ==========================================================
   استایل پنل مدیریت (Admin Panel)
   فایل: admin.css
   نکته: متغیرهای رنگی (--color-*) از style.css می‌آیند.
   بر خلاف بقیه‌ی صفحات بازی، این صفحه از قاب ثابت ۴۲۰×۷۲۰ استفاده
   نمی‌کند؛ کل عرض/ارتفاع صفحه را می‌گیرد چون یک داشبورد مدیریتی است.
   ========================================================== */

* {
    box-sizing: border-box;
}

.admin-body {
    margin: 0;
    min-height: 100vh;
    background: var(--color-bg-dark);
    font-family: 'Vazirmatn', sans-serif;
    color: var(--color-text);
}

.hidden {
    display: none !important;
}

/* --- حالت «در حال بررسی دسترسی» --- */
.admin-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-size: 15px;
    color: var(--color-text-muted);
}

/* --- چیدمان کلی: سایدبار + محتوای اصلی --- */
.admin-app {
    display: flex;
    min-height: 100vh;
}

/* --- نوار کناری --- */
.admin-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--color-bg-light);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 16px;
    margin-bottom: 26px;
    padding: 0 6px;
}

.admin-brand-icon {
    font-size: 20px;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.admin-nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: right;
    width: 100%;
    transition: background 0.15s ease, color 0.15s ease;
}

.admin-nav-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text);
}

.admin-nav-btn.active {
    background: var(--color-primary);
    color: #fff;
}

.admin-nav-logout {
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 14px;
    color: var(--color-danger);
}

.admin-nav-logout:hover {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-danger);
}

.admin-back-link {
    display: block;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 12px;
    text-decoration: none;
    padding-top: 14px;
}

.admin-back-link:hover {
    color: var(--color-accent);
}

/* --- محتوای اصلی --- */
.admin-main {
    flex: 1;
    padding: 32px 36px;
    overflow-x: auto;
}

.admin-page {
    display: none;
}

.admin-page.active {
    display: block;
}

.admin-page-title {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 22px;
}

/* --- سربرگ بخش‌های داشبورد (مثلاً «آمار لحظه‌ای» / «آمار مالی») --- */
.admin-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 14px;
}

.admin-section-title {
    font-size: 16px;
    font-weight: 800;
    margin: 0;
}

.admin-section-title-secondary {
    margin: 30px 0 14px;
    color: var(--color-text-muted);
}

/* --- نشانگر «زنده» کنار عنوان آمار لحظه‌ای --- */
.admin-live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-muted);
}

.admin-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ecc71;
    box-shadow: 0 0 0 rgba(46, 204, 113, 0.6);
    animation: admin-live-pulse 1.8s infinite;
}

@keyframes admin-live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.55); }
    70% { box-shadow: 0 0 0 7px rgba(46, 204, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

/* --- کارت‌های آمار داشبورد --- */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.admin-stats-grid-live {
    margin-bottom: 8px;
}

.admin-stat-card {
    background: var(--color-bg-light);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- کارت‌های بخش آمار لحظه‌ای: کمی برجسته‌تر از کارت‌های عادی --- */
.admin-stat-card-live {
    border-color: rgba(46, 204, 113, 0.18);
}

.admin-stat-label {
    color: var(--color-text-muted);
    font-size: 13px;
}

.admin-stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--color-accent);
}

/* --- مقدار «کاربران آنلاین» با رنگ سبز، برای تمایز بصری سریع --- */
.admin-stat-value-online {
    color: #2ecc71;
}

/* --- کارت عمومی (مثلاً تنظیمات) --- */
.admin-card {
    background: var(--color-bg-light);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    padding: 22px;
    max-width: 420px;
}

.admin-settings-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-form-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
}

.admin-form-input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-family: inherit;
    font-size: 14px;
    padding: 10px 14px;
    width: 100%;
}

.admin-form-input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.admin-settings-note {
    font-size: 13px;
    color: var(--color-accent);
    background: rgba(34, 211, 238, 0.1);
    border-radius: var(--radius-md);
    padding: 8px 12px;
}

.admin-settings-note.is-error {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
}

/* توضیح کوچک زیر هر فیلد تنظیمات */
.admin-field-hint {
    font-size: 12px;
    color: var(--color-text-muted);
    margin: -4px 0 4px;
}

.admin-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 6px 0;
}

/* ردیف کلید روشن/خاموش */
.admin-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* کلید روشن/خاموش سبک سوییچ (checkbox سفارشی) */
.admin-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.admin-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.admin-switch-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.admin-switch-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    right: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.admin-switch input:checked + .admin-switch-slider {
    background: #16a34a;
}

.admin-switch input:checked + .admin-switch-slider::before {
    transform: translateX(-20px);
}

/* --- دکمه‌های عمومی پنل --- */
.admin-btn {
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    padding: 9px 18px;
    cursor: pointer;
    transition: transform 0.1s ease, opacity 0.15s ease;
}

.admin-btn:active {
    transform: scale(0.97);
}

.admin-btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.admin-btn-primary:hover {
    background: var(--color-primary-hover);
}

.admin-btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text);
}

.admin-btn-pay {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.admin-btn-reject {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.admin-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- جدول‌ها (کاربران / درخواست‌های برداشت) --- */
.admin-table-wrap {
    background: var(--color-bg-light);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    padding: 6px;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 720px;
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    text-align: right;
    white-space: nowrap;
}

.admin-table th {
    color: var(--color-text-muted);
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table-empty {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
    padding: 18px;
}

.admin-wallet-cell {
    direction: ltr;
    text-align: right;
    max-width: 180px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-wallet-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-copy-btn {
    flex-shrink: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    border-radius: 6px;
    opacity: 0.75;
    transition: opacity 0.15s, background 0.15s;
}

.admin-copy-btn:hover {
    opacity: 1;
    background: rgba(124, 58, 237, 0.12);
}

.admin-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    display: inline-block;
}

.admin-actions-cell {
    display: flex;
    gap: 6px;
}

/* ==========================================================
   استایل‌های صفحه‌ی «لاگ‌های امنیتی» — بخش جدید سیستم ضدتقلب
   ========================================================== */
.admin-security-filters {
    margin-bottom: 16px;
}

.admin-security-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.admin-security-filters-grid .admin-form-label {
    font-size: 12px;
}

.admin-security-filters-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-security-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 14px;
}

/* رنگ نشان‌ها بر اساس نوع اقدام سیستم امنیتی */
.admin-badge.action-REJECTED {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.15);
}

.admin-badge.action-BLOCKED {
    color: #f87171;
    background: rgba(220, 38, 38, 0.2);
}

.admin-badge.action-FLAGGED {
    color: #fcd34d;
    background: rgba(251, 191, 36, 0.15);
}

.admin-security-reason-cell {
    font-family: monospace;
    font-size: 12px;
    color: var(--color-accent);
}

.admin-security-details-cell {
    max-width: 260px;
    white-space: normal;
    color: var(--color-text-muted);
    font-size: 12px;
}

/* --- مودال تایید عملیات --- */
.admin-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
}

.admin-modal {
    background: var(--color-bg-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 380px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-modal-title {
    font-size: 16px;
    font-weight: 800;
    margin: 0 0 10px;
}

.admin-modal-text {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 0 0 14px;
}

.admin-modal-note-wrap {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-modal-textarea {
    resize: vertical;
    font-family: inherit;
}

.admin-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ==========================================================
   استایل‌های صفحه‌ی «مدیریت تبلیغات»
   ========================================================== */

/* تصویر بندانگشتی تبلیغ داخل جدول */
.admin-ad-thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: block;
}

/* لینک مقصد در جدول: کوتاه‌شده با ... تا جدول به‌هم نریزد */
.admin-ad-link-cell {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
    color: var(--color-accent);
}

/* نشان وضعیت فعال/غیرفعال تبلیغ */
.admin-badge.ad-active {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.15);
}

.admin-badge.ad-inactive {
    color: var(--color-text-muted);
    background: rgba(255, 255, 255, 0.08);
}

/* دکمه‌ی فعال/غیرفعال کردن سریع تبلیغ */
.admin-btn-toggle-on {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.admin-btn-toggle-off {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text-muted);
}

/* مودال کمی عریض‌تر مخصوص فرم افزودن/ویرایش تبلیغ */
.admin-modal-wide {
    max-width: 480px;
}

.admin-ad-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-ad-form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 4px;
}

.admin-ad-form-grid .admin-form-label {
    font-size: 12px;
}

/* پیش‌نمایش تصویر آپلودشده داخل فرم تبلیغ */
.admin-ad-image-preview {
    width: 100%;
    max-height: 160px;
    object-fit: contain;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    margin-top: 2px;
}

#ad-image-required-mark {
    color: var(--color-text-muted);
    font-weight: 400;
    font-size: 11px;
}

/* ==========================================================
   ریسپانسیو: در صفحه‌های باریک، سایدبار به نوار بالای صفحه تبدیل می‌شود
   ========================================================== */
@media (max-width: 720px) {
    .admin-app {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        border-left: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        padding: 14px;
    }

    .admin-brand {
        margin-bottom: 0;
        margin-left: auto;
    }

    .admin-nav {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        order: 3;
        margin-top: 10px;
    }

    .admin-nav-btn {
        width: auto;
        flex: 1 1 auto;
        justify-content: center;
    }

    .admin-back-link {
        display: none;
    }

    .admin-main {
        padding: 18px;
    }

    .admin-ad-form-grid {
        grid-template-columns: 1fr;
    }
}
