/* =================================================================
   بخش ۱: موتور تم مرکزی (Theme Engine & Variables)
   نسخه: Royal Blue Background + Pink Glow Interaction
   ================================================================= */
:root {
    /* --- رنگ‌های برند --- */
    --blue-brand: #1a237e;       /* آبی سرمه‌ای (برای دکمه‌ها و آیکون‌ها) */
    
    /* ⭐️ رنگ صورتی چرک (Dirty Pink) برای هاور و افکت‌ها ⭐️ */
    --pink-brand: #eea194;       
    --pink-glow: rgba(238, 161, 148, 0.4); /* نور افشانی صورتی */
    
    --color-red-500: #dc3545;
    --color-red-600: #c82333;
    --color-red-700: #bd2130;
    --color-white: #ffffff;
    
    /* --- تنظیمات ابعاد --- */
    --border-radius-md: 15px;
    --border-radius-lg: 20px;
    
    /* =========================================================
       حالت پیش‌فرض (تم آبی برند)
       ========================================================= */
    --bg-body: #1a237e;          /* زمینه آبی برند */
    --bg-card: #ffffff;          /* کارت سفید */
    --bg-input: #f0f2f5;
    --bg-hover: #f8f9fa;
    
    --text-primary: #1a1a2e;     /* متن تیره */
    --text-secondary: #6c757d;
    --text-inverse: #ffffff;     /* متن روی زمینه آبی */
    
    --border-color: #e9ecef;
    --icon-color: var(--blue-brand);
    --shadow-color: rgba(0, 0, 0, 0.15);
    --special-bg: rgba(255, 255, 255, 0.1);
    
    --pattern-opacity: 0.05;
}

/* --- حالت شب (Dark Mode) --- */
body.theme-dark, html.theme-dark { 
    --bg-body: #0a0a12;
    --bg-card: #1e1e1e;
    --bg-input: #2d2d2d;
    --bg-hover: #333333;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-inverse: #121212;
    --border-color: #333333;
    --icon-color: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --special-bg: #1e1e1e;
    --pattern-opacity: 0.05;
    /* در حالت شب، نور صورتی کمی شفاف‌تر می‌شود */
    --pink-glow: rgba(238, 161, 148, 0.2); 
}

/* --- حالت عصر (Gray Mode) --- */
body.theme-gray, html.theme-gray { 
    --bg-body: #343a40;
    --bg-card: #495057;
    --bg-input: #6c757d;
    --bg-hover: #586069;
    --text-primary: #f8f9fa;
    --text-secondary: #dee2e6;
    --text-inverse: #212529;
    --border-color: #6c757d;
    --icon-color: #f8f9fa;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --special-bg: #495057;
    --pattern-opacity: 0.1;
}

/* =================================================================
   بخش ۲: استایل‌های پایه و هدر
   ================================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: 'Vazir', sans-serif; 
    background-color: var(--bg-body);
    /* پترن پس‌زمینه */
    background-image: 
        radial-gradient(rgba(255, 255, 255, var(--pattern-opacity)) 1px, transparent 1px),
        linear-gradient(180deg, var(--bg-body) 0%, #0d1245 100%);
    background-size: 20px 20px, 100% 100%;
    background-attachment: fixed;
    color: var(--text-primary); 
    transition: background 0.3s ease, color 0.3s ease; 
    min-height: 100vh;
}

.container { max-width: 1400px; width: 100%; margin: 0 auto; padding: 0 25px; }

/* --- هدر --- */
.main-header { 
    background-color: var(--bg-card); 
    padding: 10px 25px; 
    display: flex; align-items: center; justify-content: space-between; 
    box-shadow: 0 2px 10px var(--shadow-color); 
    flex-shrink: 0; 
    border-bottom: 1px solid var(--border-color); 
    transition: background-color 0.3s;
    border-radius: 0 0 20px 20px; margin-bottom: 10px;
}

.header-left { display: flex; align-items: center; gap: 20px; flex-grow: 1; }
.logo a { text-decoration: none; }
.logo h1 { font-size: 26px; color: var(--blue-brand); }

.search-bar { flex-grow: 1; margin: 0 20px; }
.search-bar input { 
    width: 100%; height: 48px; border-radius: var(--border-radius-md); 
    border: 1px solid var(--border-color); background-color: var(--bg-input); 
    padding: 0 20px; font-size: 16px; color: var(--text-primary); transition: all 0.3s; 
}
.search-bar input:focus { outline: none; border-color: var(--pink-brand); box-shadow: 0 0 0 3px var(--pink-glow); } /* فوکوس صورتی */

.header-right { display: flex; align-items: center; gap: 10px; }

.icon-btn { 
    font-size: 19px; color: var(--text-secondary); width: 42px; height: 42px; 
    border-radius: 50%; background-color: transparent; 
    display: flex; align-items: center; justify-content: center; 
    transition: all 0.3s; cursor: pointer; text-decoration: none; border: none; 
}
.icon-btn:hover { background-color: var(--bg-hover); color: var(--blue-brand); }

.location-text { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 5px 10px; border-radius: 8px; font-weight: 500; color: var(--text-primary); }
.location-text:hover { background-color: var(--bg-hover); }
.location-text i { color: var(--pink-brand); }

.theme-switcher { display: flex; background-color: var(--bg-input); border-radius: 25px; padding: 5px; }
.theme-btn { 
    width: 35px; height: 35px; border-radius: 50%; border: none; cursor: pointer; font-size: 16px; 
    display: flex; align-items: center; justify-content: center; background-color: transparent; 
    color: var(--text-secondary); transition: all 0.3s; 
}
.theme-btn:hover { color: var(--text-primary); }
.theme-btn.active { background-color: var(--blue-brand); color: #fff; box-shadow: 0 3px 10px rgba(26, 35, 126, 0.3); }

.submit-ad-btn { background: var(--blue-brand); color: #fff; padding: 12px 25px; border-radius: var(--border-radius-md); font-weight: bold; border: none; cursor: pointer; transition: all 0.3s; text-decoration: none; }
.submit-ad-btn:hover { background: #3949ab; transform: translateY(-2px); box-shadow: 0 4px 15px var(--pink-glow); } /* هاور دکمه هم صورتی شد */

/* دراپ‌داون منو */
.dropdown { position: relative; }
.dropdown-menu { 
    position: absolute; top: 120%; left: 0; background-color: var(--bg-card); 
    border-radius: var(--border-radius-md); box-shadow: 0 10px 30px var(--shadow-color); 
    border: 1px solid var(--border-color); width: 220px; padding: 10px 0; 
    z-index: 1001; opacity: 0; visibility: hidden; transform: translateY(10px); 
    transition: all 0.3s ease; pointer-events: none; 
}
.dropdown-menu.is-open { opacity: 1 !important; visibility: visible !important; transform: translateY(0) !important; pointer-events: auto !important; }
.dropdown-menu a, .dropdown-menu button { 
    display: flex; align-items: center; gap: 12px; padding: 12px 20px; 
    text-decoration: none; color: var(--text-primary); font-size: 15px; 
    background: none; border: none; width: 100%; text-align: right; cursor: pointer; font-family: 'Vazir', sans-serif; 
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background-color: var(--bg-hover); }
.dropdown-menu a i, .dropdown-menu button i { width: 20px; text-align: center; color: var(--text-secondary); }
.dropdown-menu hr { margin: 5px 20px; border-color: var(--border-color); border-style: solid; border-width: 1px 0 0 0; }
.dropdown-menu .logout-button { color: var(--pink-brand); }
.dropdown-menu-inner a { color: var(--text-secondary); }
.dropdown-menu-inner a:hover { color: var(--text-primary); }

/* =================================================================
   بخش ۳: استایل‌های اختصاصی صفحه اصلی (با نورافشانی صورتی)
   ================================================================= */
.categories-container { margin-top: 30px; margin-bottom: 50px; }

/* ⭐️ 1. کارت مشاهده همه (با هاور صورتی) ⭐️ */
.all-ads-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-hover) 100%);
    border: none;
    border-radius: var(--border-radius-lg);
    padding: 20px 30px;
    display: flex; justify-content: space-between; align-items: center;
    text-decoration: none; color: var(--text-primary);
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}
.all-ads-card:hover { 
    transform: translateY(-5px); 
    /* ✅ نور صورتی از زیر کارت */
    box-shadow: 0 15px 40px var(--pink-glow); 
}
/* خط رنگی صورتی در سمت راست کارت هنگام هاور */
.all-ads-card::before {
    content: ''; position: absolute; top: 0; right: 0; width: 5px; height: 100%;
    background: var(--pink-brand); opacity: 0; transition: 0.3s;
}
.all-ads-card:hover::before { opacity: 1; }

.all-ads-card .text-content { font-size: 1.1rem; font-weight: 800; }
.all-ads-card .arrow-icon {
    width: 40px; height: 40px; background: var(--text-primary); color: var(--bg-card);
    border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: 0.3s;
}
.all-ads-card:hover .arrow-icon { 
    background: var(--pink-brand); /* فلش صورتی می‌شود */
    color: #fff; transform: translateX(-5px); 
}

/* ⭐️ 2. گرید استاندارد (با هاور صورتی) ⭐️ */
.standard-categories-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 60px; }
@media (min-width: 992px) { .standard-categories-grid { grid-template-columns: repeat(6, 1fr); gap: 25px; } }

.category-card {
    background-color: var(--bg-card);
    border: 1px solid transparent; 
    border-radius: var(--border-radius-lg);
    padding: 25px 10px; text-align: center; text-decoration: none; color: var(--text-primary);
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: all 0.3s ease;
    display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%;
}
.category-card .icon {
    width: 65px; height: 65px; background-color: var(--bg-hover); color: var(--text-secondary);
    border-radius: 24px; display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; margin-bottom: 15px; transition: 0.3s;
}
.category-card .title { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); }

.category-card:hover { 
    transform: translateY(-8px); 
    /* ✅ بوردر و سایه صورتی چرک */
    border-color: var(--pink-brand); 
    box-shadow: 0 15px 35px var(--pink-glow); 
}
.category-card:hover .icon { 
    background-color: var(--pink-brand); /* آیکون صورتی می‌شود */
    color: #fff; border-radius: 50%; transform: rotateY(180deg); 
}

/* ⭐️ 3. گرید ویژه (Special) ⭐️ */
.special-categories-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 50px;
    background-color: var(--special-bg); 
    backdrop-filter: blur(10px); 
    padding: 30px; border-radius: 30px;
    box-shadow: 0 10px 40px var(--shadow-color); 
    border: 1px solid rgba(255,255,255,0.1); 
    position: relative;
}
.special-categories-grid::before {
    content: 'خدمات متمایز'; position: absolute; top: -15px; right: 40px;
    background: var(--blue-brand); color: #fff; padding: 5px 20px;
    border-radius: 20px; font-size: 0.9rem; font-weight: 800; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
}
@media (min-width: 992px) { .special-categories-grid { grid-template-columns: repeat(3, 1fr); } }

.special-category-card {
    display: flex; align-items: center; gap: 15px; background-color: var(--bg-card);
    border: none; border-radius: 18px; padding: 20px;
    text-decoration: none; transition: 0.3s; position: relative; overflow: hidden; color: var(--text-primary);
}
.special-category-card:hover { 
    transform: translateX(-5px); 
    /* ✅ سایه صورتی */
    box-shadow: 0 10px 25px var(--pink-glow); 
}
.special-category-card::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 3px;
    /* ✅ خط صورتی پررنگ */
    background: linear-gradient(90deg, var(--pink-brand), transparent);
    transform: scaleX(0); transform-origin: right; transition: 0.3s;
}
.special-category-card:hover::after { transform: scaleX(1); }
.special-category-card .icon-bg {
    width: 55px; height: 55px; background-color: var(--bg-hover); color: var(--text-secondary);
    border-radius: 14px; display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; flex-shrink: 0;
}
/* رنگ‌های آیکون‌ها */
.special-category-card:nth-child(1) .icon-bg { color: #1976d2; background: rgba(25, 118, 210, 0.1); }
.special-category-card:nth-child(2) .icon-bg { color: #fbc02d; background: rgba(251, 192, 45, 0.1); }
.special-category-card:nth-child(3) .icon-bg { color: #388e3c; background: rgba(56, 142, 60, 0.1); }
.special-category-card:nth-child(4) .icon-bg { color: #c2185b; background: rgba(194, 24, 91, 0.1); }
body.theme-dark .special-category-card .icon-bg { background: rgba(255,255,255,0.05); }

.special-category-card h3 { margin: 0 0 5px 0; font-size: 1rem; font-weight: 800; color: var(--text-primary); }
.special-category-card p { margin: 0; font-size: 0.75rem; color: var(--text-secondary); line-height: 1.4; }

/* 4. بنر مانا */
.mana-banner {
    background: linear-gradient(120deg, #1a1a2e 0%, #000000 100%);
    border-radius: 25px; padding: 40px; display: flex; justify-content: space-between; align-items: center;
    color: white; position: relative; overflow: hidden; box-shadow: 0 15px 30px rgba(0,0,0,0.3); margin-bottom: 50px;
    border: 1px solid rgba(255,255,255,0.1);
}
.mana-banner::before {
    content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23d4af37' fill-opacity='0.1' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='3'/%3E%3Ccircle cx='13' cy='13' r='3'/%3E%3C/g%3E%3C/svg%3E");
}
.mana-banner h3 { color: #d4af37; margin-bottom: 10px; font-size: 1.5rem; font-weight: 900; }
.mana-banner p { color: #e1e5ee; }
.mana-banner a {
    background: #d4af37; color: #000; padding: 12px 30px; border-radius: 50px;
    text-decoration: none; font-weight: bold; z-index: 2; transition: 0.3s;
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3);
}
.mana-banner a:hover { transform: scale(1.05); background: #fff; }
@media (max-width: 768px) { .mana-banner { flex-direction: column; text-align: center; gap: 20px; } .special-categories-grid::before { right: 50%; transform: translateX(50%); } }

/* =================================================================
   بخش ۴: مودال‌ها و Select2
   ================================================================= */
.modal-overlay { 
    position: fixed; inset: 0; background-color: rgba(0, 0, 0, 0.6); backdrop-filter: blur(5px); 
    z-index: 2000; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; 
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { 
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.9); 
    z-index: 2001; opacity: 0; visibility: hidden; transition: opacity 0.3s, transform 0.3s; 
    width: 90%; max-width: 450px; 
}
.modal.active { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.modal-content { 
    background-color: var(--bg-card); border-radius: var(--border-radius-lg); padding: 30px; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.5); border: 1px solid var(--border-color);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { font-size: 22px; color: var(--blue-brand); }
.modal-header .close-btn { font-size: 24px; cursor: pointer; color: var(--text-secondary); background: none; border: none;}
.modal-body .form-group { margin-bottom: 15px; }
.modal-body label { font-weight: 600; margin-bottom: 8px; display: block; color: var(--text-primary); }
.modal-body input, .modal-body select { 
    width: 100%; height: 50px; border-radius: var(--border-radius-md); 
    border: 1px solid var(--border-color); background-color: var(--bg-input); 
    padding: 0 20px; font-size: 16px; color: var(--text-primary); 
}
.modal-body .city-list { 
    max-height: 200px; overflow-y: auto; border: 1px solid var(--border-color); 
    padding: 10px; border-radius: var(--border-radius-md); background-color: var(--bg-input); 
}
.city-item { padding: 10px; cursor: pointer; border-radius: 8px; transition: background-color 0.2s; color: var(--text-primary); border-bottom: 1px solid var(--border-color); }
.city-item:hover, .city-item.selected { background-color: var(--bg-hover); color: var(--blue-brand); font-weight: 600; }
.modal-footer button { width: 100%; padding: 15px; background-color: var(--blue-brand); color: #fff; border: none; border-radius: var(--border-radius-md); font-size: 18px; font-weight: bold; cursor: pointer; margin-top: 10px; }
.modal-footer button:disabled { background-color: var(--text-secondary); cursor: not-allowed; }

/* Select2 */
.select2-dropdown { background-color: var(--bg-card); border-color: var(--border-color); color: var(--text-primary); }
.select2-search--dropdown .select2-search__field { background-color: var(--bg-input); color: var(--text-primary); border-bottom: 1px solid var(--border-color); }
.select2-results__option { color: var(--text-primary); background-color: var(--bg-card); }
.select2-results__option--highlighted { background-color: var(--blue-brand) !important; color: #fff !important; }
.select2-container--default .select2-selection--single { background-color: var(--bg-input); border-color: var(--border-color); }
.select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--text-primary); }

/* --- دکمه‌ها --- */
.submit-ad-btn.logged-out-state { background-color: var(--color-red-500) !important; color: var(--color-white) !important; border-color: var(--color-red-600) !important; }
.submit-ad-btn.logged-out-state:hover { background-color: var(--color-red-600) !important; border-color: var(--color-red-700) !important; }

.chat-badge {
    position: absolute; top: -5px; right: -5px; background-color: var(--color-red-500); color: white;
    border-radius: 50%; padding: 2px 5px; font-size: 0.7em; min-width: 18px; text-align: center;
    line-height: 1.2; box-shadow: 0 0 0 2px var(--bg-card);
}
.has-unread-messages .chat-badge { display: block !important; }
html.theme-dark #wizard-title { color: var(--text-primary); }