@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #d62828;
    --primary-dark: #a81f1f;
    --primary-light: #fff1f1;
    --accent: #f2543d;
    --bg: #faf7f8;
    --text: #26201f;
    --muted: #7a6f6e;
    --white: #fff;
    --radius: 14px;
    --shadow: 0 6px 18px rgba(214, 40, 40, .07);
    --shadow-lg: 0 12px 30px rgba(214, 40, 40, .13);
}

html { scroll-behavior: smooth; }
::selection { background: var(--primary); color: var(--white); }

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.site-header {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #f3e3e3;
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 2px 12px rgba(214, 40, 40, .06);
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; padding: 14px 16px; flex-wrap: wrap;
}
.logo { display: flex; flex-direction: column; transition: transform .2s; }
.logo:hover { transform: scale(1.03); }
.logo-text { font-size: 27px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }
.logo-text .accent { color: var(--text); }
.logo-sub { font-size: 12px; color: var(--muted); }
.main-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.main-nav a { font-weight: 600; color: var(--text); padding: 6px 2px; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.main-nav a:hover { color: var(--primary); border-color: var(--primary); }
.admin-link {
    background: var(--white); color: var(--primary);
    padding: 8px 20px; border-radius: 999px; font-size: 14px; font-weight: 700;
    border: 2px solid var(--primary); transition: background .2s, color .2s;
}
.admin-link:hover { background: var(--primary); color: var(--white); }

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 60%, #7e1414 100%);
    color: var(--white);
    padding: 80px 0 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: ""; position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 600px 300px at 15% 10%, rgba(255,255,255,.14), transparent),
        radial-gradient(ellipse 500px 260px at 85% 90%, rgba(255,255,255,.10), transparent);
    pointer-events: none;
}
.hero-inner { position: relative; }
.hero h1 { font-size: 44px; margin-bottom: 10px; font-weight: 800; text-shadow: 0 2px 14px rgba(0,0,0,.18); }
.hero p { color: #ffe3e3; margin-bottom: 30px; font-size: 18px; }
.search-form { max-width: 620px; margin: 0 auto; }
.search-tabs { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.search-tabs label {
    background: rgba(255, 255, 255, .14); padding: 8px 22px;
    border-radius: 999px; cursor: pointer; font-size: 14px;
    border: 1px solid rgba(255, 255, 255, .25); transition: background .2s;
}
.search-tabs label:hover { background: rgba(255, 255, 255, .24); }
.search-tabs input { margin-left: 6px; accent-color: #ffb3b3; }
.search-row { display: flex; gap: 10px; }
.search-row input {
    flex: 1; padding: 14px 20px; border: none; border-radius: 12px;
    font-size: 15px; font-family: inherit; box-shadow: var(--shadow-lg);
}
.search-row input:focus { outline: 3px solid rgba(255,255,255,.55); }
.search-row button {
    background: var(--white); color: var(--primary-dark); border: none;
    padding: 0 36px; border-radius: 12px; font-weight: 800; font-size: 15px;
    cursor: pointer; font-family: inherit; transition: transform .15s, box-shadow .2s;
    box-shadow: var(--shadow-lg);
}
.search-row button:hover { transform: translateY(-2px); }
.stats { display: flex; justify-content: center; gap: 70px; margin-top: 34px; }
.stat strong { font-size: 34px; display: block; color: #ffd7d7; }
.stat span { font-size: 14px; color: #ffe3e3; }

/* ---------- Sections / Grid ---------- */
.main-content { min-height: 60vh; }
.section { padding: 42px 0; }
.section-title {
    font-size: 25px; margin-bottom: 26px; color: var(--text);
    position: relative; display: inline-block; padding-bottom: 10px; font-weight: 800;
}
.section-title::after {
    content: ""; position: absolute; bottom: 0; right: 0;
    width: 55%; height: 4px; border-radius: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 24px;
}
.center { text-align: center; margin-top: 32px; }
.btn {
    display: inline-block; background: var(--primary); color: var(--white);
    padding: 12px 38px; border-radius: 999px; font-weight: 700;
    box-shadow: 0 6px 16px rgba(214, 40, 40, .25); transition: background .2s, transform .15s;
}
.btn:hover { background: var(--primary-dark); transform: translateY(-2px); }
.empty { color: var(--muted); padding: 30px 0; }

/* ---------- Card ---------- */
.card {
    background: var(--white); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow);
    transition: transform .25s, box-shadow .25s; position: relative;
    display: flex; border: 1px solid #f6e6e6;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.card-featured { outline: 2px solid var(--accent); outline-offset: -2px; }
.badge-featured {
    position: absolute; top: 10px; right: 10px; z-index: 2;
    background: var(--accent); color: var(--white);
    font-size: 12px; font-weight: 700; padding: 3px 14px; border-radius: 999px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .2);
}
.card-link { display: flex; flex-direction: column; width: 100%; }
.card-img { position: relative; aspect-ratio: 4/3; background: #fbeeee; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card-img img { transform: scale(1.06); }
.no-img {
    width: 100%; height: 100%; display: flex; align-items: center;
    justify-content: center; color: #c9a3a3; font-size: 14px;
}
.badge-deal {
    position: absolute; bottom: 10px; right: 10px;
    font-size: 12px; font-weight: 700; padding: 4px 14px;
    border-radius: 999px; color: var(--white);
    box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
}
.badge-sale { background: #e03131; }
.badge-rent { background: #c2255c; }
.card-body { padding: 16px 18px 18px; flex: 1; }
.card-body h3 { font-size: 17px; margin-bottom: 4px; transition: color .2s; }
.card:hover h3 { color: var(--primary); }
.card-location { color: var(--muted); font-size: 13px; }
.card-meta {
    list-style: none; display: flex; gap: 8px; flex-wrap: wrap;
    margin: 10px 0; color: var(--muted); font-size: 13px;
}
.card-meta li { background: var(--primary-light); padding: 2px 10px; border-radius: 6px; }
.card-price { color: var(--primary); font-weight: 800; font-size: 15px; line-height: 1.7; }


/* ---------- Contact & consultation ---------- */
.card-actions { padding: 0 18px 18px; }
.contact-btn, .consultation-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 9px; font-weight: 700; transition: transform .2s, background .2s, box-shadow .2s; }
.contact-btn { width: 100%; padding: 9px 12px; background: var(--primary-light); color: var(--primary); border: 1px solid #f2caca; font-size: 13px; }
.contact-btn:hover { background: var(--primary); color: var(--white); transform: translateY(-2px); box-shadow: var(--shadow); }
.consultation-actions { display: flex; gap: 10px; margin: 20px 0 24px; }
.consultation-btn { min-height: 44px; padding: 9px 18px; font-size: 14px; }
.primary-consultation { background: var(--primary); color: var(--white); box-shadow: var(--shadow); }
.primary-consultation:hover { background: var(--primary-dark); transform: translateY(-2px); }
.secondary-consultation { color: var(--primary); background: var(--primary-light); border: 1px solid #f2caca; }
.secondary-consultation:hover { background: #ffe1e1; transform: translateY(-2px); }

/* ---------- Filter form ---------- */
.filter-form {
    display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px;
    background: var(--white); padding: 18px; border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid #f6e6e6;
}
.filter-form input, .filter-form select {
    padding: 10px 14px; border: 1px solid #eccfcf; border-radius: 10px;
    font-family: inherit; font-size: 14px; background: var(--white);
    transition: border-color .2s, box-shadow .2s;
}
.filter-form input:focus, .filter-form select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(214, 40, 40, .12);
}
.filter-form input[type="text"] { flex: 1; min-width: 160px; }
.filter-form button {
    background: var(--primary); color: var(--white); border: none;
    padding: 10px 28px; border-radius: 10px; font-family: inherit;
    font-weight: 700; cursor: pointer; font-size: 14px;
    transition: background .2s, transform .15s;
}
.filter-form button:hover { background: var(--primary-dark); transform: translateY(-1px); }

/* ---------- Detail ---------- */
.back-link { display: inline-block; color: var(--muted); margin-bottom: 18px; font-size: 14px; }
.back-link:hover { color: var(--primary); }
.detail-grid {
    display: grid; grid-template-columns: 1.1fr 1fr; gap: 30px;
    background: var(--white); border-radius: var(--radius);
    padding: 28px; box-shadow: var(--shadow-lg); border: 1px solid #f6e6e6;
}
.detail-cover { border-radius: var(--radius); width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.thumbs img {
    width: 82px; height: 62px; object-fit: cover; border-radius: 8px;
    cursor: pointer; border: 2px solid transparent; transition: border-color .2s, transform .15s;
}
.thumbs img:hover, .thumb-active { border-color: var(--accent); }
.detail-info h1 { font-size: 26px; margin: 12px 0 6px; font-weight: 800; }
.detail-info .card-location { margin-bottom: 14px; }
.price-box {
    background: var(--primary-light); border-radius: 12px; padding: 18px 22px;
    color: var(--primary-dark); font-weight: 700; margin-bottom: 18px;
    border: 1px solid #f5d2d2;
}
.detail-info > .badge-deal {
    position: static;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-bottom: 8px;
}
.price-box span { color: var(--muted); font-weight: 500; }
.spec-list {
    list-style: none; display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px 24px; margin-bottom: 18px;
}
.spec-list li { background: #faf5f5; padding: 9px 14px; border-radius: 10px; font-size: 14px; }
.spec-list span { color: var(--muted); }
.features { list-style: none; display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.features li {
    background: var(--primary); color: var(--white); font-size: 13px;
    font-weight: 600; padding: 5px 16px; border-radius: 999px;
}
.description h3, .attachments h3 { margin-bottom: 8px; font-size: 17px; color: var(--primary); font-weight: 800; }
.attachments { margin-top: 22px; }
.attachments ul { list-style: none; }
.attachments li { margin-bottom: 6px; }
.attachments a {
    color: var(--primary); font-weight: 600;
    background: #faf5f5; padding: 9px 16px; border-radius: 10px; display: inline-block;
    transition: background .2s;
}
.attachments a:hover { background: var(--primary-light); }

/* ---------- Footer ---------- */
.site-footer { background: linear-gradient(180deg, #2a1112 0%, #1a0c0d 100%); color: #d9b8b8; margin-top: 56px; }
.footer-inner {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px;
    padding: 44px 16px 34px;
}
.footer-col h4 { color: var(--white); margin-bottom: 12px; }
.footer-col a { display: block; margin-bottom: 8px; font-size: 14px; color: #d9b8b8; transition: color .2s; }
.footer-col a:hover { color: #ff9c9c; }
.footer-col .logo-text { color: var(--white); }
.footer-bottom {
    text-align: center; padding: 16px; font-size: 13px;
    border-top: 1px solid #3d2022; color: #a88686;
}
.footer-bottom strong { color: #ff9c9c; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 11px; }

@media (max-width: 600px) {
    .consultation-actions { flex-direction: column; gap: 8px; }
    .consultation-btn { width: 100%; }
}


/* Green contact CTA */
.contact-btn { background: #e9f8ee; color: #218548; border-color: #b9e4c7; }
.contact-btn:hover { background: #249653; color: #fff; box-shadow: 0 6px 16px rgba(36, 150, 83, .22); }
.primary-consultation { background: #249653; color: #fff; box-shadow: 0 6px 16px rgba(36, 150, 83, .22); }
.primary-consultation:hover { background: #19753f; }
.secondary-consultation { color: #218548; background: #e9f8ee; border-color: #b9e4c7; }
.secondary-consultation:hover { background: #d7f1df; }

::-webkit-scrollbar-track { background: #f5eaea; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* Similar property cards */
.card-location { display: flex; align-items: center; gap: 6px; min-height: 26px; white-space: nowrap; overflow: hidden; }
.card-location span:not(.location-icon) { overflow: hidden; text-overflow: ellipsis; }
.location-icon { color: #249653; font-size: 17px; line-height: 1; }
.location-separator { color: #bdaaaa; font-size: 11px; }
.compact-card { box-shadow: 0 4px 14px rgba(67, 36, 36, .08); }
.compact-card:hover { transform: translateY(-3px); }
.compact-card .card-img { aspect-ratio: 16 / 10; }
.compact-card .card-body { padding: 12px 14px 11px; }
.compact-card .card-body h3 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact-card .card-location { font-size: 12px; }
.compact-card .card-meta { gap: 5px; margin: 7px 0; font-size: 11px; }
.compact-card .card-meta li { padding: 2px 7px; }
.compact-card .card-price { font-size: 13px; }
.compact-card .card-actions { padding: 0 14px 14px; }
.compact-card .contact-btn { min-height: 36px; padding: 7px 9px; font-size: 11px; background: #e9f8ee; border-color: #b9e4c7; color: #218548; }
.compact-card .contact-btn:hover { background: #249653; color: #fff; }

.card { flex-direction: column; }
.card-link { flex: 1; }
.card-actions { width: 100%; margin-top: auto; }



/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .detail-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 28px; }
    .stats { gap: 30px; }
    .footer-inner { grid-template-columns: 1fr; }
    .search-row { flex-direction: column; }
    .search-row button { padding: 12px; }
}

/* Final responsive layout safeguards */
html, body { max-width: 100%; overflow-x: hidden; }
.card, .detail-grid, .footer-inner { min-width: 0; }
.card-body, .detail-info, .footer-col { min-width: 0; }
.card-price, .price-box, .description p, .attachments a { overflow-wrap: anywhere; word-break: break-word; }
.consultation-actions { flex-wrap: wrap; }
.consultation-actions .consultation-btn { flex: 1 1 180px; }

@media (max-width: 1100px) {
    .container { max-width: 100%; }
    .detail-grid { gap: 20px; padding: 22px; }
}

@media (max-width: 700px) {
    .header-inner { padding: 10px 14px; }
    .main-nav { width: 100%; justify-content: center; gap: 10px 16px; }
    .main-nav a { font-size: 13px; }
    .hero { padding: 52px 0 42px; }
    .hero h1 { font-size: 25px; }
    .hero p { font-size: 15px; }
    .section { padding: 34px 0; }
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .card-body { padding: 13px; }
    .card-body h3 { font-size: 15px; }
    .card-actions { padding: 0 13px 13px; }
    .contact-btn { font-size: 12px; padding: 8px 6px; }
    .detail-grid { grid-template-columns: 1fr; padding: 14px; border-radius: 12px; }
    .detail-info h1 { font-size: 22px; }
    .detail-cover { aspect-ratio: 16 / 11; }
    .spec-list { grid-template-columns: 1fr; gap: 8px; }
    .consultation-actions { margin: 16px 0 20px; }
    .consultation-actions .consultation-btn { flex-basis: 100%; width: 100%; }
    .footer-inner { grid-template-columns: 1fr; gap: 22px; padding-top: 32px; }
}

@media (max-width: 420px) {
    .container { padding-left: 12px; padding-right: 12px; }
    .grid { grid-template-columns: 1fr; }
    .search-tabs { gap: 6px; }
    .search-tabs label { padding: 7px 13px; font-size: 12px; }
    .card-img { aspect-ratio: 16 / 10; }
    .detail-grid { padding: 10px; }
    .detail-info h1 { font-size: 20px; }
    .price-box { padding: 14px; font-size: 13px; }
}


.detail-info > .badge-deal {
    position: static !important;
    inset: auto !important;
    display: inline-flex;
    align-items: center;
    width: max-content;
    margin: 0 0 8px auto;
    float: none;
}
.detail-info > h1 { clear: both; }


/* Detail page responsive fix */
.detail-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    width: 100%;
    align-items: start;
}
.detail-gallery,
.detail-info { min-width: 0; width: 100%; }
.detail-info > .badge-deal {
    position: static !important;
    display: table;
    width: auto;
    max-width: 100%;
    margin: 0 0 10px auto;
    white-space: nowrap;
}
.detail-info h1,
.detail-info .card-location,
.detail-info .description p { overflow-wrap: anywhere; word-break: break-word; }
.detail-info h1 { margin-top: 0; }
.detail-cover { display: block; min-height: 180px; }
.consultation-actions .consultation-btn { width: 100%; }

@media (max-width: 860px) {
    .detail-grid { grid-template-columns: minmax(0, 1fr); padding: 20px; }
    .detail-gallery { order: 1; }
    .detail-info { order: 2; }
}

@media (max-width: 600px) {
    .detail-grid { gap: 18px; padding: 14px; }
    .detail-cover { min-height: 150px; aspect-ratio: 16 / 10; }
    .detail-info > .badge-deal { margin-right: 0; font-size: 11px; padding: 4px 11px; }
    .detail-info h1 { font-size: 21px; line-height: 1.6; }
    .detail-info .card-location { font-size: 12px; line-height: 1.8; }
    .price-box { padding: 14px; margin-bottom: 14px; }
    .spec-list { grid-template-columns: minmax(0, 1fr); }
}

