/* ============================================================
   فونت و متغیرهای گلوبال - پنل مدیریت
   ============================================================ */
:root {
    --admin-sidebar-width: 260px;
    --admin-sidebar-collapsed: 72px;
    --admin-primary: #1a1a2e;
    --admin-accent: #e94560;
    --admin-accent-light: #f06e84;
    --admin-bg: #f0f2f5;
    --admin-card-bg: #ffffff;
    --admin-text: #333;
    --admin-text-muted: #6c757d;
    --admin-radius: 10px;
    --admin-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Vazirma', sans-serif;
    background-color: var(--admin-bg);
    color: var(--admin-text);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   صفحه ورود (Login)
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at 10% 80%, rgba(233,69,96,0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 20%, rgba(212,168,83,0.08) 0%, transparent 50%);
}
.login-container { position: relative; z-index: 1; width: 100%; max-width: 420px; }
.login-card {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-header {
    padding: 36px 32px 24px;
    text-align: center;
}
.login-icon {
    width: 72px; height: 72px; border-radius: 18px;
    background: linear-gradient(135deg, var(--admin-accent), var(--admin-accent-light));
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 18px;
    font-size: 1.8rem; color: #fff;
    box-shadow: 0 8px 24px rgba(233,69,96,0.35);
}
.login-title { color: #fff; font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.login-subtitle { color: rgba(255,255,255,0.5); font-size: 0.82rem; }

.login-body { padding: 0 32px 28px; }
.login-input-group .input-group-text {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-left: none;
    color: var(--admin-accent);
    border-radius: 10px 0 0 10px;
}
.login-input-group .form-control {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    border-radius: 0 10px 10px 0;
    padding: 10px 14px;
}
.login-input-group .form-control::placeholder { color: rgba(255,255,255,0.35); }
.login-input-group .form-control:focus {
    background: rgba(255,255,255,0.1);
    border-color: var(--admin-accent);
    box-shadow: 0 0 0 3px rgba(233,69,96,0.2);
    color: #fff;
}
.login-body .form-label { color: rgba(255,255,255,0.6); font-size: 0.82rem; margin-bottom: 6px; }
.login-btn {
    background: linear-gradient(135deg, var(--admin-accent), var(--admin-accent-light));
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(233,69,96,0.35);
}
.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233,69,96,0.45);
    background: linear-gradient(135deg, #d63951, var(--admin-accent));
    color: #fff;
}
.login-footer {
    padding: 18px 32px 24px;
    text-align: center;
}
.back-to-site-link { color: rgba(255,255,255,0.5); font-size: 0.8rem; transition: color 0.3s; }
.back-to-site-link:hover { color: var(--admin-accent); }

/* ============================================================
   سایدبار
   ============================================================ */
.admin-sidebar {
    width: var(--admin-sidebar-width);
    background: var(--admin-primary);
    min-height: 100vh;
    position: fixed;
    top: 0; right: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, transform 0.3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
}
.admin-sidebar.collapsed { width: var(--admin-sidebar-collapsed); }

/* Sidebar Header */
.sidebar-header {
    padding: 20px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(233,69,96,0.1);
}
.sidebar-logo-icon { color: var(--admin-accent); font-size: 1.4rem; flex-shrink: 0; }
.sidebar-title { color: #fff; font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; transition: opacity 0.3s; }
.admin-sidebar.collapsed .sidebar-title { opacity: 0; width: 0; }
.sidebar-toggle-btn {
    margin-left: auto; color: rgba(255,255,255,0.5);
    background: none; border: none; font-size: 1rem;
    transition: color 0.3s;
}
.sidebar-toggle-btn:hover { color: var(--admin-accent); }

/* Sidebar Menu */
.sidebar-menu { list-style: none; padding: 10px 0; flex: 1; overflow-y: auto; }
.sidebar-menu li > a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.55);
    padding: 10px 18px;
    font-size: 0.82rem;
    text-decoration: none;
    transition: all 0.25s ease;
    white-space: nowrap;
    border-right: 3px solid transparent;
}
.sidebar-menu li > a:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
    border-right-color: var(--admin-accent);
}
.sidebar-menu li.active > a {
    color: #fff;
    background: rgba(233,69,96,0.12);
    border-right-color: var(--admin-accent);
}
.sidebar-menu li > a i { font-size: 0.85rem; flex-shrink: 0; width: 18px; text-align: center; }
.sidebar-menu li > a span { flex: 1; transition: opacity 0.3s; }
.admin-sidebar.collapsed .sidebar-menu li > a span { opacity: 0; width: 0; overflow: hidden; }
.admin-sidebar.collapsed .sidebar-menu li > a { justify-content: center; padding: 10px 0; }

/* Submenu */
.menu-toggle { cursor: pointer; }
.arrow-icon { font-size: 0.6rem !important; transition: transform 0.25s; color: rgba(255,255,255,0.3) !important; }
.menu-item-has-children.open .arrow-icon { transform: rotate(180deg); }
.submenu {
    list-style: none;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    background: rgba(0,0,0,0.15);
}
.menu-item-has-children.open .submenu { max-height: 200px; }
.submenu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.4);
    padding: 8px 18px 8px 38px;
    font-size: 0.78rem;
    text-decoration: none;
    transition: all 0.25s;
    white-space: nowrap;
}
.submenu li a:hover, .submenu li.active a { color: var(--admin-accent); background: rgba(233,69,96,0.08); }
.submenu li a i { font-size: 0.72rem; }
.admin-sidebar.collapsed .submenu { display: none; }

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.admin-user-info { display: flex; align-items: center; gap: 10px; }
.admin-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--admin-accent), var(--admin-accent-light));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.85rem; flex-shrink: 0;
}
.admin-details { flex: 1; min-width: 0; }
.admin-name { color: #fff; font-size: 0.8rem; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-form { margin-top: 2px; }
.logout-btn { color: rgba(255,255,255,0.4); font-size: 0.7rem; padding: 0; transition: color 0.3s; }
.logout-btn:hover { color: var(--admin-accent); }
.admin-sidebar.collapsed .admin-details { display: none; }

/* ============================================================
   پنل اصلی محتوا
   ============================================================ */
.admin-main-content {
    margin-right: var(--admin-sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-right 0.3s ease;
}
.admin-sidebar.collapsed ~ .admin-main-content { margin-right: var(--admin-sidebar-collapsed); }

/* Topbar */
.admin-topbar {
    background: #fff;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    position: sticky; top: 0; z-index: 100;
    gap: 12px;
    flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-menu-btn { background: none; border: none; color: var(--admin-text-muted); font-size: 1.1rem; padding: 4px 8px; border-radius: 6px; }
.topbar-menu-btn:hover { background: #eee; color: var(--admin-accent); }
.page-title { font-size: 1.1rem; font-weight: 600; color: var(--admin-text); margin-bottom: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-right .breadcrumb { margin-bottom: 0; font-size: 0.72rem; }
.topbar-right .breadcrumb-item { color: var(--admin-text-muted); }
.topbar-right .breadcrumb-item a { color: var(--admin-accent); text-decoration: none; }

/* Content Area */
.admin-content-area { flex: 1; padding: 24px; }

/* ============================================================
   داشبورد - کارت آمار
   ============================================================ */
.admin-stat-card {
    background: #fff;
    border-radius: var(--admin-radius);
    padding: 22px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--admin-shadow);
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.admin-stat-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.admin-stat-card.stat-primary { border-left-color: #3498db; }
.admin-stat-card.stat-warning { border-left-color: #f39c12; }
.admin-stat-card.stat-success { border-left-color: #2ecc71; }
.admin-stat-card.stat-danger { border-left-color: #e74c3c; }

.stat-card-icon {
    width: 50px; height: 50px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; color: #fff; flex-shrink: 0;
}
.stat-primary .stat-card-icon { background: linear-gradient(135deg, #3498db, #2980b9); }
.stat-warning .stat-card-icon { background: linear-gradient(135deg, #f39c12, #e67e22); }
.stat-success .stat-card-icon { background: linear-gradient(135deg, #2ecc71, #27ae60); }
.stat-danger .stat-card-icon { background: linear-gradient(135deg, #e74c3c, #c0392b); }

.stat-card-content { flex: 1; }
.stat-card-number { font-size: 1.7rem; font-weight: 700; color: var(--admin-text); line-height: 1; }
.stat-card-label { font-size: 0.75rem; color: var(--admin-text-muted); margin-top: 4px; }
.stat-card-link { font-size: 0.72rem; color: var(--admin-accent); text-decoration: none; position: absolute; bottom: 12px; left: 18px; }
.stat-card-link:hover { text-decoration: underline; }

/* ============================================================
   کارت‌های مدیریت
   ============================================================ */
.admin-card {
    background: #fff;
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow);
    overflow: hidden;
}
.admin-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}
.admin-card-title { font-size: 0.88rem; font-weight: 600; color: var(--admin-text); margin-bottom: 0; }
.admin-card-body { padding: 20px; }

/* ============================================================
   جدول مدیریت
   ============================================================ */
.admin-table {
    font-size: 0.82rem;
    margin-bottom: 0;
}
.admin-table thead { background: #f8f9fa; }
.admin-table thead th {
    color: var(--admin-text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 10px 12px;
    border-bottom: 2px solid #eee;
    white-space: nowrap;
}
.admin-table tbody td { padding: 12px; vertical-align: middle; border-bottom: 1px solid #f0f0f0; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #fafbfc; }
.admin-table-link { color: var(--admin-accent); text-decoration: none; font-weight: 500; }
.admin-table-link:hover { text-decoration: underline; }
.admin-no-thumb {
    width: 50px; height: 50px; border-radius: 6px;
    background: #eee; display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
}

/* ============================================================
   فرم‌های مدیریت
   ============================================================ */
.admin-card .form-label { font-size: 0.82rem; color: var(--admin-text); font-weight: 500; margin-bottom: 5px; }
.admin-card .form-control {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 0.85rem;
    font-family: 'Vazirma', sans-serif;
    transition: border-color 0.25s;
}
.admin-card .form-control:focus { border-color: var(--admin-accent); box-shadow: 0 0 0 3px rgba(233,69,96,0.15); }
.admin-card .form-select { border-radius: 8px; font-size: 0.85rem; font-family: 'Vazirma', sans-serif; }
.admin-card .form-select:focus { border-color: var(--admin-accent); box-shadow: 0 0 0 3px rgba(233,69,96,0.15); }

/* Rich Text Editor Area */
.editor-toolbar { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px; background: #f8f9fa; border-radius: 8px 8px 0 0; border: 1px solid #ddd; border-bottom: none; }
.editor-toolbar .btn { font-size: 0.72rem; padding: 4px 8px; border-radius: 4px; }
.article-editor {
    min-height: 300px;
    padding: 16px;
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    font-size: 0.88rem;
    line-height: 1.8;
    color: var(--admin-text);
    font-family: 'Vazirma', sans-serif;
    outline: none;
    background: #fff;
}
.article-editor:focus { border-color: var(--admin-accent); box-shadow: 0 0 0 3px rgba(233,69,96,0.1); }
.article-editor h1,.article-editor h2,.article-editor h3,.article-editor h4 { margin: 12px 0 6px; color: var(--admin-primary); }
.article-editor p { margin-bottom: 10px; }
.article-editor blockquote { border-right: 3px solid var(--admin-accent); padding: 10px 14px; background: #fef5f6; border-radius: 0 6px 6px 0; margin: 12px 0; }

/* Existing Images Grid */
.existing-image-card { position: relative; text-align: center; }
.delete-image-btn { font-size: 0.7rem; margin-top: 6px; }

/* ============================================================
   موبایل OverLay & رسپانسیو
   ============================================================ */
.admin-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}
.admin-overlay.active { display: block; }

@media (max-width: 991px) {
    .admin-sidebar {
        transform: translateX(100%);
        width: var(--admin-sidebar-width);
    }
    .admin-sidebar.mobile-open { transform: translateX(0); }
    .admin-main-content { margin-right: 0 !important; }
    .admin-topbar { padding: 10px 16px; }
    .admin-content-area { padding: 16px; }
}

@media (max-width: 576px) {
    .admin-content-area { padding: 12px; }
    .admin-topbar { padding: 8px 12px; }
    .page-title { font-size: 0.95rem; }
    .admin-stat-card { padding: 16px 14px; gap: 12px; }
    .stat-card-number { font-size: 1.3rem; }
    .stat-card-icon { width: 40px; height: 40px; font-size: 1rem; }
}

/* ============================================================
   فیلتر اطلاعات
   ============================================================ */
.filter-info { background: #f8f9fa; padding: 10px 16px; border-radius: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

/* ============================================================
   بادیر و دیگران
   ============================================================ */
.btn-primary { background-color: var(--admin-accent); border-color: var(--admin-accent); border-radius: 8px; font-size: 0.82rem; font-weight: 500; }
.btn-primary:hover { background-color: var(--admin-accent-light); border-color: var(--admin-accent-light); }
.btn-outline-primary { color: var(--admin-accent); border-color: var(--admin-accent); border-radius: 8px; font-size: 0.78rem; }
.btn-outline-primary:hover { background-color: var(--admin-accent); color: #fff; }
.btn-outline-secondary { border-radius: 8px; font-size: 0.78rem; }
.btn-outline-danger { border-radius: 8px; font-size: 0.72rem; }
.btn-outline-info { border-radius: 8px; font-size: 0.72rem; }
.btn-outline-success { border-radius: 8px; font-size: 0.72rem; }
