/* =========================================
   1. FONTS & BASE (تنظیمات پایه و فونت‌ها)
   ========================================= */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn/Vazirmatn-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
    font-family: 'Vazirmatn', tahoma, sans-serif !important;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: #f5f1ff;
    color: #24143d;
    direction: rtl;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
}

/* =========================================
   2. UI COMPONENTS (المان‌های عمومی و فرم‌ها)
   ========================================= */

/* --- کادرها و باکس‌ها --- */
.hp-box {
    width: 100%;
    background: #fff;
    border: 1px solid rgba(124, 58, 237, 0.13);
    border-radius: 24px;
    padding: 26px 22px;
    box-shadow: 0 14px 42px rgba(124, 58, 237, 0.08);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hp-box-title {
    margin: 0 0 8px;
    color: #4c1d95;
    font-size: 24px;
    font-weight: 900;
    text-align: center;
}

/* --- ورودی‌ها (Inputs) --- */
.hp-input {
    width: 100%;
    min-height: 52px;
    border: 1px solid rgba(124, 58, 237, 0.18);
    border-radius: 16px;
    background: #fbf8ff;
    color: #2f184f;
    padding: 10px 14px;
    font-size: 15px;
    font-weight: 700;
    outline: none;
    transition: 0.2s ease;
}

.hp-input:focus {
    border-color: #8b5cf6;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12);
}

/* =========================================
   استایل اختصاصی و مدرن برای باکس‌های کشویی
   ========================================= */
.hp-custom-select {
    display: block;
    width: 100%;
    padding: 14px 15px;
    font-size: 15px;
    font-weight: 800;
    color: #4c1d95;
    background-color: #fbf8ff;
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 12px;
    outline: none;
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.3s ease;
    
    /* حذف استایل زشت و پیش‌فرض مرورگرها */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    /* فلش سفارشی (رنگ بنفش هماهنگ با قالب) */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c3aed' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 18px;
    
    /* پیش‌فرض برای سایت راست‌چین: فلش سمت چپ */
    background-position: left 15px center;
    padding-left: 45px;
}

/* افکت جذاب موقع کلیک کردن روی باکس */
.hp-custom-select:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* تنظیم خودکار فلش برای زمان‌هایی که لیست ما انگلیسی و چپ‌چین است */
.hp-custom-select[dir="ltr"] {
    background-position: right 15px center;
    padding-left: 15px;
    padding-right: 45px;
}

/* --- پیام‌های سیستم (Alerts) --- */
.hp-alert {
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.8;
}

.hp-alert-danger {
    background: #fff0f0;
    color: #dc2626;
}

.hp-alert-success {
    background: #ecfdf3;
    color: #15803d;
}

/* =========================================
   3. BUTTON SYSTEM (سیستم دکمه‌ها - پاستلی)
   ========================================= */

/* کلاس پایه دکمه */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

/* دکمه اصلی (گرادینت جذاب و کمی نرم‌تر) */
.btn-primary {
    background: linear-gradient(135deg, #8b5cf6, #c084fc);
    color: #fff;
    box-shadow: 0 6px 15px rgba(139, 92, 246, 0.2);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.35);
}

/* دکمه‌های ساده و پاستلی */

/* دکمه روشن (طوسی/بنفش پاستلی) */
.btn-light {
    background: #f3e8ff;
    color: #6d28d9;
}
.btn-light:hover {
    background: rgb(225, 198, 254);
}

/* دکمه تمدید/موفقیت (سبز پاستلی) */
.btn-success {
    background: #a8fdc6;
    color: #258b49;
}
.btn-success:hover {
    background: #7ee4a2;
    transform: translateY(-2px);
}

/* دکمه حذف/خطر (قرمز پاستلی) */
.btn-danger {
    background: #f88585;
    color: #aa0000;
}
.btn-danger:hover {
    background: #f85252;
    transform: translateY(-2px);
}

/* کلاس‌های تغییر دهنده (Modifiers) */
.btn-block {
    width: 100%;
    min-height: 52px;
    font-size: 16px;
}

/* =========================================
   4. LAYOUT: HEADER (هدر و منوی کاربری)
   ========================================= */
.site-header {
    width: 100%;
    height: 72px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.10);
    position: sticky;
    top: 0;
    z-index: 1000;
    direction: ltr;
}

.site-logo {
    display: flex;
    align-items: center;
}

.site-header-action { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    position: relative; 
}

.site-menu-btn {
    height: 48px;
    border: none;
    border-radius: 16px;
    background: #f4efff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    padding: 0 14px;
    transition: background 0.2s ease;
}

.site-menu-btn:hover {
    background: #ede9fe;
}

.site-menu-btn svg {
    width: 22px;
    height: 22px;
    fill: #6d28d9;
    flex-shrink: 0;
}

.site-menu-btn .user-name {
    font-weight: 800;
    font-size: 14px;
    color: #6d28d9;
}

.site-menu-panel { 
    position: absolute; 
    top: 65px; 
    right: 0; /* به جای left از right استفاده کردیم */
    left: auto; 
    width: 280px; 
    max-width: calc(100vw - 36px); 
    background: #fff; 
    border-radius: 22px; 
    padding: 12px; 
    box-shadow: 0 24px 70px rgba(36, 20, 61, 0.18); 
    display: none; 
    flex-direction: column; 
    gap: 8px; 
    direction: rtl; 
    z-index: 1001;
}

body.site-menu-open .site-menu-panel {
    display: flex;
}

.site-menu-panel form {
    margin: 0;
}

.site-menu-panel a, 
.site-menu-panel button {
    width: 100%;
    min-height: 48px;
    border: none;
    border-radius: 16px;
    background: #f7f2ff;
    color: #4c1d95;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    text-align: right;
    transition: background 0.2s ease;
}

.site-menu-panel a:hover, 
.site-menu-panel button:hover {
    background: #ede9fe;
}

.site-menu-panel svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    flex-shrink: 0;
}

.site-menu-panel .logout-link {
    background: #fff0f0;
    color: #dc2626;
}

.site-menu-panel .logout-link:hover {
    background: #fee2e2;
}

@media(max-width: 760px) {
    .site-header {
        height: 64px;
        padding: 0 12px;
    }
    .site-menu-panel {
        width: 260px;
        top: 55px;
        right: 0;
        left: auto;
    }
}

/* =========================================
   5. LAYOUT: FOOTER (فوتر)
   ========================================= */
.site-footer {
    width: 100%;
    min-height: 76px;
    margin-top: auto;
    padding: 18px;
    background: #fff;
    border-top: 1px solid rgba(124, 58, 237, 0.12);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
}

.site-footer-side {
    min-height: 1px;
}

.site-footer-center {
    text-align: center;
    color: #6d28d9;
    font-size: 14px;
    font-weight: 800;
    direction: ltr;
}

@media(max-width: 640px) {
    .site-footer {
        grid-template-columns: 1fr;
        min-height: 64px;
    }
    .site-footer-side {
        display: none;
    }
}

/* =========================================
   6. PAGES: HOME (صفحه اصلی)
   ========================================= */
.home-hero {
    position: relative;
    width: 100%;
    height: 88vh; 
    background-image: url('../img/hero1.webp');
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    overflow: hidden;
}

.home-hero-box {
    position: absolute;
    left: 50%;
    top: 70%;
    transform: translate(-50%, -50%);
    width: calc(100% - 80px);
    max-width: 400px;
    padding: 20px 16px;
    text-align: center;
    border-radius: 18px;
    background: rgba(18, 8, 38, 0.45);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(230, 210, 255, 0.25);
    box-shadow: 0 0 28px rgba(150, 80, 255, 0.35);
}

.home-hero-box h1 {
    margin: 0 0 10px;
    color: #fff;
    font-size: 30px;
    font-weight: 900;
}

.home-hero-box p {
    margin: 0 0 16px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    line-height: 2;
}

/* =========================================
   7. PAGES: AUTH & CAPTCHA (ورود، ثبت‌نام و کپچا)
   ========================================= */
.auth-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    min-height: calc(100vh - 150px);
    padding: 28px 16px;
}

.auth-link {
    margin: 14px 0 0;
    color: #5b4778;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

.auth-link a {
    color: #7c3aed;
    font-weight: 900;
}

.hp-captcha-row {
    display: grid;
    grid-template-columns: 50% minmax(0, 1fr) 52px;
    gap: 8px;
    align-items: center;
    direction: rtl;
}

.hp-captcha-img {
    width: 100%;
    height: 52px;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid rgba(124, 58, 237, 0.16);
    background: #fff;
}

.hp-captcha-input {
    text-align: center;
    letter-spacing: 2px;
}

/* دکمه رفرش کپچا که فقط یک مربع است */
.hp-captcha-refresh {
    width: 52px;
    height: 52px;
    padding: 0;
}

.hp-captcha-refresh svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

@media(max-width: 480px) {
    .hp-captcha-img {
        height: 64px;
    }
}

/* =========================================
   8. REGISTER LOCKED STATE (حالت قفل ثبت‌نام)
   ========================================= */
.hp-register-locked {
    text-align: center;
    align-items: center; /* چون hp-box به صورت flex-column هست، این خط محتوا رو وسط چین میکنه */
    padding: 34px 10px;
}

.hp-register-locked-icon {
    font-size: 72px;
    line-height: 1;
    margin-bottom: 10px;
}

.hp-register-locked p {
    color: #6b5a82;
    font-size: 15px;
    line-height: 2;
    margin-bottom: 15px;
    text-align: center;
}

/* =========================================
   9. DASHBOARD LAYOUT (قالب داشبورد کاربری)
   ========================================= */
.dashboard-layout {
    width: 100%;
    max-width: 1120px; /* عرض استاندارد برای پنل کاربری */
    margin: 0 auto;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: calc(100vh - 150px);
}

.hp-welcome {
    width: 100%;
    background: #fff;
    border: 1px solid rgba(124, 58, 237, 0.13);
    border-radius: 24px;
    padding: 16px 20px;
    box-shadow: 0 14px 42px rgba(124, 58, 237, 0.08);
    color: #2f184f;
    font-size: 15px;
    font-weight: 800;
    text-align: center;
}

/* =========================================
   10. ACCORDION CARDS (قالب کارت‌های بازشو عمومی)
   ========================================= */
.hp-card {
    background: #fff;
    border: 1px solid rgba(124, 58, 237, 0.13);
    border-radius: 24px;
    box-shadow: 0 14px 42px rgba(124, 58, 237, 0.08);
    overflow: hidden;
    margin-bottom: 14px;
    transition: 0.3s ease;
}

/* تیتر کارت (بخش قابل کلیک) */
.hp-card-header {
    width: 100%;
    min-height: 78px;
    padding: 16px 20px;
    background: #fff;
    border: none;
    display: grid;
    grid-template-columns: 1fr auto auto 40px; /* جایگاه: تیتر، متا، وضعیت، فلش */
    align-items: center;
    gap: 16px;
    cursor: pointer;
    text-align: right;
}

.hp-card-title {
    font-size: 18px;
    font-weight: 950;
    color: #4c1d95;
    word-break: break-word;
}

/* کادر طوسی برای اطلاعات اضافه (مثل حجم/روز) */
.hp-card-meta {
    font-size: 13px;
    font-weight: 800;
    color: #6b5a82;
    background: #fbf8ff;
    border: 1px solid rgba(124, 58, 237, 0.1);
    padding: 6px 12px;
    border-radius: 12px;
    white-space: nowrap;
}

/* فلش باز و بسته شدن */
.hp-card-arrow {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: #f4efff;
    color: #7c3aed;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s ease;
}
.hp-card-arrow svg { width: 20px; height: 20px; fill: currentColor; }
.hp-card.open .hp-card-arrow { transform: rotate(180deg); background: #ede9fe; }

/* بدنه مخفی کارت */
.hp-card-body {
    display: none;
    padding: 0 20px 20px;
    flex-direction: column;
    gap: 10px;
}
.hp-card.open .hp-card-body {
    display: flex;
    animation: hpFadeIn 0.3s ease;
}

/* گرید ۲ ستونه داخل کارت‌ها */
.hp-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.hp-card-grid form { margin: 0; }

/* --- سیستم وضعیت‌ها (Status Dots) --- */
.hp-status { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 900; white-space: nowrap; }
.hp-status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; animation: hpStatusBlink 1.5s infinite ease-in-out; }

.hp-status--active .hp-status-dot, .hp-status--success .hp-status-dot { background: #16a34a; box-shadow: 0 0 8px rgba(22,163,74,0.6); }
.hp-status--active, .hp-status--success { color: #16a34a; }

.hp-status--expired .hp-status-dot, .hp-status--danger .hp-status-dot { background: #dc2626; box-shadow: 0 0 8px rgba(220,38,38,0.6); }
.hp-status--expired, .hp-status--danger { color: #dc2626; }

.hp-status--limited .hp-status-dot { background: #f59e0b; box-shadow: 0 0 8px rgba(245,158,11,0.6); }
.hp-status--limited { color: #f59e0b; }

.hp-status--unknown .hp-status-dot { background: #6b7280; box-shadow: 0 0 8px rgba(107,114,128,0.6); }
.hp-status--unknown { color: #6b7280; }

@keyframes hpStatusBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes hpFadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* صفحه‌بندی ساده */
.hp-simple-pagination { width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; padding: 16px; background: #fff; border: 1px solid rgba(124, 58, 237, 0.13); border-radius: 20px; }
.hp-simple-pagination span { font-weight: 800; color: #4c1d95; font-size: 14px; }

/* ریسپانسیو کارت‌ها */
@media(max-width: 760px) {
    .hp-card-header {
        grid-template-columns: 1fr 40px;
        grid-template-rows: auto auto auto;
        gap: 10px;
        padding: 14px;
    }
    .hp-card-title { grid-column: 1 / 2; }
    .hp-card-arrow { grid-column: 2 / 3; grid-row: 1 / 2; justify-self: end; }
    .hp-card-meta, .hp-status { grid-column: 1 / -1; justify-self: start; width: 100%; text-align: right; }
    .hp-card-grid { grid-template-columns: 1fr; }
}

/* =========================================
   11. PAGE HEADER (عنوان عمومی تمام صفحات)
   ========================================= */
/* این کلاس رو برای بالای تمام صفحات استفاده می‌کنیم */
.hp-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    width: 100%;
}

.hp-page-head h1 {
    margin: 0;
    color: #24123d;
    font-size: 26px;
    font-weight: 950;
}

/* در موبایل دکمه بیاد زیر عنوان و تمام‌عرض بشه */
@media(max-width: 640px) {
    .hp-page-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .hp-page-head h1 {
        font-size: 22px;
    }
    .hp-page-head .btn {
        width: 100%;
    }
}

/* =========================================
   12. FORM GROUPS & LABELS (گروه‌بندی فرم‌ها و لیبل)
   ========================================= */
.hp-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hp-label {
    font-size: 14px;
    font-weight: 800;
    color: #4c1d95;
    padding-right: 4px;
}

/* =========================================
   13. TABS & MODALS (تب‌ها و پاپ‌آپ‌ها)
   ========================================= */
/* نوار تب‌ها (اسکرول افقی در موبایل) */
.hp-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
    width: 100%;
}
.hp-tabs::-webkit-scrollbar {
    height: 4px;
}
.hp-tabs::-webkit-scrollbar-thumb {
    background: #d8b4fe;
    border-radius: 4px;
}

/* مخفی و ظاهر کردن تب‌ها */
.admin-tab {
    display: none;
}
.admin-tab.active {
    display: block;
    animation: hpFadeIn 0.3s ease;
}

/* وقتی روی یک تب کلیک میشه، استایل دکمه اصلی (بنفش) رو بگیره */
.admin-link.active {
    background: linear-gradient(135deg, #8b5cf6, #c084fc) !important;
    color: #fff !important;
    box-shadow: 0 6px 15px rgba(139, 92, 246, 0.2);
}

/* ساختار پاپ‌آپ (Modal) */
.hp-modal {
    position: fixed;
    inset: 0;
    background: rgba(18, 8, 38, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}
.hp-modal.open {
    display: flex;
    animation: hpFadeIn 0.2s ease;
}
.hp-modal-box {
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

/* زیباتر کردن اسکرول‌بار داخل مودال‌ها */
.hp-modal-box::-webkit-scrollbar { width: 6px; }
.hp-modal-box::-webkit-scrollbar-track { background: transparent; }
.hp-modal-box::-webkit-scrollbar-thumb { background: rgba(124, 58, 237, 0.2); border-radius: 10px; }
.hp-modal-box::-webkit-scrollbar-thumb:hover { background: rgba(124, 58, 237, 0.5); }

/* دکمه بستن پاپ‌آپ */
.hp-modal-close { 
    position: absolute;
    top: 16px;
    left: 16px;
    width: 36px;
    height: 36px; 
    padding: 0;
    border-radius: 12px;
    z-index: 10; 
}