/* ======================================
   ملک یاب - Main Stylesheet
   ====================================== */

/* Variables */
:root {
    --primary: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --secondary: #f59e0b;
    --accent: #10b981;
    --danger: #ef4444;
    --dark: #1f2937;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

/* Base */
* {
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
}

body {
    direction: rtl;
    text-align: right;
    background-color: var(--gray-100);
    color: var(--gray-900);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--gray-900);
}

/* Links */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
}

/* Top Bar */
.top-bar {
    font-size: 0.85rem;
}

/* Navbar */
.navbar {
    padding: 0.75rem 0;
}

.navbar-brand {
    font-size: 1.5rem !important;
    color: var(--primary) !important;
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    color: var(--gray-700) !important;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--primary);
    color: white !important;
}

.nav-link i {
    transition: transform 0.2s ease;
}

.nav-link:hover i {
    transform: scale(1.15);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    min-height: 500px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/assets/images/pattern.svg') repeat;
    opacity: 0.1;
}

.hero-content {
    position: relative;
    z-index: 1;
}

/* Search Box */
.search-box {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.search-box .form-control,
.search-box .form-select {
    border: 1px solid var(--gray-300);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

.search-box .form-control:focus,
.search-box .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

/* Property Cards */
.property-card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    height: 100%;
}

.property-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.property-card .card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.property-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.property-card:hover .card-image img {
    transform: scale(1.05);
}

.property-card .card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--secondary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.property-card .card-favorite {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s;
}

.property-card .card-favorite:hover {
    background: var(--danger);
    color: white;
}

.property-card .card-favorite.active {
    background: var(--danger);
    color: white;
}

.property-card .card-body {
    padding: 1rem 1.25rem;
}

.property-card .card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.property-card .card-location {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

.property-card .card-location i {
    color: var(--primary);
}

.property-card .card-features {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.property-card .card-features span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.property-card .card-price {
    border-top: 1px solid var(--gray-200);
    padding-top: 0.75rem;
    margin-top: auto;
}

.property-card .card-price .price-label {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.property-card .card-price .price-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

/* Category Cards */
.category-card {
    background: white;
    border-radius: 1rem;
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    background: var(--primary);
    color: white;
}

.category-card:hover .category-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.category-card .category-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(30, 64, 175, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
    transition: all 0.3s;
}

/* City Cards */
.city-card {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    height: 250px;
    cursor: pointer;
}

.city-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.city-card:hover img {
    transform: scale(1.1);
}

.city-card .city-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 2rem 1rem 1rem;
    color: white;
}

/* Stats Section */
.stats-section {
    background: var(--primary);
    color: white;
    padding: 4rem 0;
}

.stat-item {
    text-align: center;
}

.stat-item .stat-number {
    font-size: 2.5rem;
    font-weight: 700;
}

.stat-item .stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* Property Detail */
.property-detail .gallery {
    border-radius: 1rem;
    overflow: hidden;
}

.property-detail .gallery img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.property-detail .info-box {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.property-detail .info-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.property-detail .info-item:last-child {
    border-bottom: none;
}

.property-detail .info-item i {
    width: 40px;
    height: 40px;
    background: rgba(30, 64, 175, 0.1);
    color: var(--primary);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-inline-start: 1rem;
}

.property-detail .feature-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gray-100);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    margin: 0.25rem;
}

/* Contact Form */
.contact-form {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Sidebar Filters */
.filter-sidebar {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.filter-sidebar .filter-section {
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.filter-sidebar .filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-sidebar .filter-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Admin Sidebar */
.admin-sidebar {
    background: var(--gray-900);
    min-height: 100vh;
    padding: 1rem 0;
}

.admin-sidebar .sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-sidebar .sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--gray-300);
    text-decoration: none;
    transition: all 0.2s;
}

.admin-sidebar .sidebar-menu li a:hover,
.admin-sidebar .sidebar-menu li a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.admin-sidebar .sidebar-menu li a i {
    width: 24px;
    text-align: center;
}

/* Map Container */
#map {
    height: 400px;
    border-radius: 1rem;
    z-index: 1;
}

/* Breadcrumb */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item a {
    color: var(--gray-500);
}

.breadcrumb-item.active {
    color: var(--primary);
}

/* Pagination */
.pagination .page-link {
    border-radius: 0.5rem;
    margin: 0 2px;
    color: var(--primary);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

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

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

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

/* Footer */
.footer {
    background: var(--gray-900) !important;
}

.footer a:hover {
    color: var(--secondary) !important;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-500);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Iran Map */
.map-container {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: visible;
}

.map-container object,
.map-container img {
    width: 100%;
    height: auto;
    display: block;
}

.province {
    fill: #e2e8f0;
    stroke: #94a3b8;
    stroke-width: 1.5;
    cursor: pointer;
    transition: all 0.2s ease;
}

.province:hover,
.province.hovered {
    fill: #3b82f6;
    stroke: #1e40af;
    stroke-width: 2;
    transform: scale(1.02);
    transform-origin: center;
}

.province.active {
    fill: #1e40af;
    stroke: #1e3a8a;
    stroke-width: 2;
}

/* Map Tooltip */
.map-tooltip {
    position: fixed;
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    border: 1px solid #e5e7eb;
}

.map-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.tooltip-name {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.tooltip-count {
    font-size: 0.85rem;
    color: var(--primary);
}

/* Province List */
.province-list {
    max-height: 500px;
    overflow-y: auto;
}

.province-list-item {
    transition: all 0.2s ease;
}

.province-list-item:hover,
.province-list-item.bg-primary {
    background-color: rgba(30, 64, 175, 0.1) !important;
}

.province-list-item:hover .province-name,
.province-list-item.bg-primary .province-name {
    color: var(--primary);
    font-weight: 600;
}

.province-name {
    color: var(--gray-700);
    transition: all 0.2s ease;
}

/* Hero Swiper Slider */
.hero-section.hero-slider {
    background: none;
    padding: 0;
}

.hero-section.hero-slider::before {
    display: none;
}

.hero-swiper {
    width: 100%;
    min-height: 500px;
}

.hero-swiper .swiper-slide {
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
}

.hero-swiper .swiper-slide .container {
    width: 100%;
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.hero-swiper .swiper-button-next,
.hero-swiper .swiper-button-prev {
    color: white;
    width: 44px;
    height: 44px;
}

.hero-swiper .swiper-button-next::after,
.hero-swiper .swiper-button-prev::after {
    font-size: 1.2rem;
}

.hero-swiper .swiper-pagination-bullet {
    background: white;
    opacity: 0.6;
}

.hero-swiper .swiper-pagination-bullet-active {
    opacity: 1;
}

.hero-swiper .swiper-slide h1 {
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.hero-swiper .swiper-slide .lead {
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* Responsive */
@media (max-width: 991.98px) {
    .hero-section {
        min-height: 400px;
    }

    .hero-swiper {
        min-height: 400px;
    }

    .search-box {
        padding: 1rem;
    }
    
    .property-card .card-image {
        height: 180px;
    }
    
    .stat-item .stat-number {
        font-size: 2rem;
    }
}

@media (max-width: 575.98px) {
    .hero-section {
        min-height: 350px;
    }

    .hero-swiper {
        min-height: 350px;
    }
    
    .property-card .card-image {
        height: 160px;
    }
    
    .category-card {
        padding: 1.5rem 0.75rem;
    }
    
    .category-card .category-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

/* ======================================
   v2 additions
   ====================================== */
.property-card { position: relative; }
.property-card .card-favorite { color: var(--gray-700); padding: 0; }
.property-card .card-favorite:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.property-card .card-title { font-size: 1.05rem; }
.property-card .card-price { display: flex; flex-direction: column; gap: .15rem; }

/* Panel (admin / agent) layout */
.panel-body { background: var(--gray-100); }
.panel-wrap { min-height: 100vh; }
.panel-main { min-width: 0; min-height: 100vh; }
.admin-sidebar { width: 250px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-sidebar .sidebar-menu li a .badge { font-size: .7rem; }
.panel-topbar { position: sticky; top: 0; z-index: 1020; min-height: 56px; }
.panel-backdrop { display: none; }
@media (max-width: 991.98px) {
    .admin-sidebar { position: fixed; right: 0; top: 0; bottom: 0; z-index: 1045; transform: translateX(100%); transition: transform .25s ease; }
    .admin-sidebar.open { transform: translateX(0); }
    .panel-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1040; }
}
.stat-card { border: 0; border-radius: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: .75rem; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.table td, .table th { vertical-align: middle; }
.table-thumb { width: 64px; height: 44px; object-fit: cover; border-radius: .5rem; }

/* Forms */
.form-label { font-weight: 500; }
.required::after { content: ' *'; color: var(--danger); }
input[dir="ltr"], .ltr { direction: ltr; text-align: left; }
.price-hint { color: var(--primary); font-weight: 600; min-height: 1.2em; }

/* Property detail */
.property-detail .gallery-swiper img { height: 420px; object-fit: cover; }
@media (max-width: 767.98px) { .property-detail .gallery-swiper img { height: 260px; } }
.contact-sticky { position: sticky; top: 90px; }
.property-thumbs img { cursor: pointer; }

/* Messages */
.chat-box { max-height: 60vh; overflow-y: auto; }
.chat-msg { max-width: 80%; border-radius: 1rem; padding: .6rem .9rem; margin-bottom: .5rem; white-space: pre-line; word-wrap: break-word; }
.chat-msg.mine { background: var(--primary); color: #fff; margin-right: auto; border-bottom-left-radius: .25rem; }
.chat-msg.theirs { background: #fff; border: 1px solid var(--gray-200); margin-left: auto; border-bottom-right-radius: .25rem; }
.chat-msg small { opacity: .75; font-size: .75rem; }

/* Map page */
#listingsMap { height: calc(100vh - 220px); min-height: 420px; border-radius: 1rem; z-index: 1; }

/* Rich content (blog, pages) */
.rich-content { line-height: 2; }
.rich-content img { max-width: 100%; height: auto; border-radius: .75rem; }
.rich-content table { width: 100%; margin-bottom: 1rem; }
.rich-content blockquote { border-right: 4px solid var(--primary); padding-right: 1rem; color: var(--gray-700); }

/* Hero slides on small screens */
@media (max-width: 767.98px) {
    .hero-swiper, .hero-swiper .swiper-slide { min-height: 0 !important; }
    .hero-section .display-4 { font-size: 2rem; }
}
.hero-swiper .swiper-slide { min-height: 500px; }
