/* ===== Variables ===== */
:root {
    --primary: #1346AF;
    --primary-light: #1a56d6;
    --primary-pale: #e8eef9;
    --white: #ffffff;
    --light: #f4f7fc;
    --text: #1a1a2e;
    --muted: #6b7280;
    --border: #dde3f0;
    --shadow: 0 2px 16px rgba(19,70,175,0.10);
    --radius: 10px;
}

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

body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--light);
    color: var(--text);
    font-size: 15px;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ===== Navbar ===== */
.navbar {
    background: var(--white);
    box-shadow: 0 2px 8px rgba(19,70,175,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    max-width: 1200px;
    margin: auto;
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo span { color: var(--text); }

.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { color: var(--muted); font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--primary); }
.nav-links a.btn-primary,
.nav-links a.btn-primary:hover,
.nav-links a.btn-primary:visited { color: #ffffff !important; }

.btn {
    display: inline-block;
    padding: 9px 22px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all .2s;
}

.btn-primary { background: var(--primary); color: var(--white) !important; }
.btn-primary:hover { background: var(--primary-light); color: var(--white) !important; }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }

.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; }
.hamburger span { width: 24px; height: 2px; background: var(--primary); border-radius: 2px; }

/* ===== Hero ===== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #0a2d7a 100%);
    color: var(--white);
    padding: 80px 20px 60px;
    text-align: center;
}

.hero h1 { font-size: 2.4rem; font-weight: 800; margin-bottom: 14px; line-height: 1.2; }
.hero p { font-size: 1.05rem; opacity: .85; margin-bottom: 36px; }

.search-box {
    background: var(--white);
    border-radius: 12px;
    padding: 16px;
    max-width: 780px;
    margin: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.search-box input,
.search-box select {
    flex: 1;
    min-width: 140px;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    outline: none;
}

.search-box input:focus,
.search-box select:focus { border-color: var(--primary); }

.search-box .btn { flex-shrink: 0; padding: 10px 28px; }

/* ===== Stats ===== */
.stats {
    background: var(--white);
    padding: 28px 20px;
    border-bottom: 1px solid var(--border);
}

.stats-inner {
    max-width: 1200px;
    margin: auto;
    display: flex;
    justify-content: center;
    gap: 60px;
    flex-wrap: wrap;
}

.stat-item { text-align: center; }
.stat-item h3 { font-size: 1.8rem; color: var(--primary); font-weight: 800; }
.stat-item p { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ===== Section ===== */
.section { padding: 56px 20px; }
.section-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 6px; }
.section-sub { color: var(--muted); margin-bottom: 32px; }

.container { max-width: 1200px; margin: auto; }

/* ===== Property Grid ===== */
.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.property-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
}

.property-card:hover { transform: translateY(-4px); box-shadow: 0 8px 28px rgba(19,70,175,0.15); }

.card-img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    background: var(--primary-pale);
}

.card-img-placeholder {
    width: 100%;
    height: 190px;
    background: var(--primary-pale);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 2.5rem;
}

.card-body { padding: 16px; }
.card-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.badge-sale { background: #e8f4fd; color: #1346AF; }
.badge-rent { background: #e8fdf0; color: #16a34a; }

.card-title { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.card-address { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.card-price { font-size: 1.2rem; font-weight: 800; color: var(--primary); margin-bottom: 12px; }

.card-meta {
    display: flex;
    gap: 14px;
    font-size: 13px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.card-meta span { display: flex; align-items: center; gap: 4px; }

/* ===== Form ===== */
.form-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: auto;
}

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color .2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.form-sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 14px;
}

.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* ===== Footer ===== */
footer {
    background: var(--text);
    color: #ccc;
    padding: 40px 20px 20px;
}

.footer-inner {
    max-width: 1200px;
    margin: auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 28px;
}

.footer-brand .logo { color: var(--white); margin-bottom: 10px; }
.footer-brand p { font-size: 13px; line-height: 1.7; }
footer h4 { color: var(--white); margin-bottom: 14px; font-size: 15px; }
footer ul { list-style: none; }
footer ul li { margin-bottom: 8px; }
footer ul li a { color: #aaa; font-size: 13px; transition: color .2s; }
footer ul li a:hover { color: var(--white); }
.footer-bottom { border-top: 1px solid #333; padding-top: 18px; text-align: center; font-size: 13px; color: #888; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .nav-links { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--white); padding: 20px; box-shadow: var(--shadow); gap: 16px; }
    .nav-links.open { display: flex; }
    .hamburger { display: flex; }
    .hero h1 { font-size: 1.7rem; }
    .stats-inner { gap: 30px; }
    .form-row { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr; gap: 24px; }
    .search-box { flex-direction: column; }
}

@media (max-width: 480px) {
    .hero { padding: 50px 16px 40px; }
    .section { padding: 36px 16px; }
    .form-card { padding: 20px; }
}

/* ===== Features Grid (Homepage) ===== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-top: 16px;
}

.feature-card {
    background: var(--primary-pale);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
}

.feature-icon  { font-size: 2rem; margin-bottom: 10px; }
.feature-title { font-weight: 700; margin-bottom: 6px; }
.feature-desc  { color: var(--muted); font-size: 13px; }

/* ===== Filter Bar ===== */
.filter-bar {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 28px;
    box-shadow: var(--shadow);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filter-group { display: flex; flex-direction: column; flex: 1; min-width: 130px; }
.filter-group label { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.filter-group input,
.filter-group select {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    outline: none;
}
.filter-group input:focus,
.filter-group select:focus { border-color: var(--primary); }

/* ===== Property Detail ===== */
.back-link {
    color: var(--primary);
    font-size: 14px;
    display: inline-block;
    margin-bottom: 20px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
    align-items: start;
}

.detail-img {
    width: 100%;
    border-radius: var(--radius);
    max-height: 420px;
    object-fit: cover;
}

.detail-img-placeholder {
    width: 100%;
    height: 320px;
    background: var(--primary-pale);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
}

.detail-body {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 20px;
    box-shadow: var(--shadow);
}

.detail-title   { font-size: 1.5rem; margin: 10px 0 8px; }
.detail-address { color: var(--muted); margin-bottom: 16px; }
.detail-price   { font-size: 1.8rem; font-weight: 800; color: var(--primary); margin-bottom: 20px; }
.price-unit     { font-size: 1rem; font-weight: 500; color: var(--muted); }

.meta-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.meta-box {
    background: var(--primary-pale);
    padding: 12px 18px;
    border-radius: 8px;
    text-align: center;
}
.meta-icon  { font-size: 1.3rem; }
.meta-val   { font-weight: 700; }
.meta-label { font-size: 12px; color: var(--muted); }

.desc-title { margin-bottom: 10px; }
.desc-text  { color: var(--muted); line-height: 1.8; }

.contact-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 80px;
}

.contact-card h3 { margin-bottom: 16px; }

.owner-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.owner-avatar {
    width: 48px; height: 48px;
    background: var(--primary-pale);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.owner-name  { font-weight: 700; }
.owner-label { font-size: 13px; color: var(--muted); }
.contact-btn { width: 100%; text-align: center; display: block; margin-bottom: 10px; }
.listed-date { font-size: 12px; color: var(--muted); margin-top: 14px; text-align: center; }

/* ===== Misc ===== */
.loading-placeholder { color: var(--muted); padding: 40px; text-align: center; }
.empty-msg   { color: var(--muted); text-align: center; padding: 40px 0; }
.empty-state { text-align: center; padding: 60px 0; color: var(--muted); }

/* ===== Responsive: Detail ===== */
@media (max-width: 768px) {
    .detail-grid { grid-template-columns: 1fr; }
    .contact-card { position: static; margin-top: 20px; }
    .filter-bar { flex-direction: column; }
    .filter-group { min-width: 100%; }
}

/* ===== Section Header with title + button ===== */
.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.section-header .section-title { margin-bottom: 4px; }
.section-header .section-sub   { margin-bottom: 0; }

/* ===== Property Image Gallery ===== */
.gallery-wrap { margin-bottom: 20px; }

.gallery-main {
    position: relative;
    cursor: pointer;
    border-radius: var(--radius);
    overflow: hidden;
}

.gallery-main .detail-img {
    width: 100%;
    height: 380px;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}

.gallery-main:hover .detail-img { transform: scale(1.02); }

.gallery-count {
    position: absolute;
    bottom: 12px; right: 12px;
    background: rgba(0,0,0,.6);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.gallery-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.gallery-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2.5px solid transparent;
    transition: border-color .2s, opacity .2s;
    opacity: .75;
}

.gallery-thumb:hover { opacity: 1; }
.gallery-thumb.active { border-color: var(--primary); opacity: 1; }

/* ===== Lightbox ===== */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lightbox.open { display: flex; }

.lightbox img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

.lb-close {
    position: absolute;
    top: 20px; right: 24px;
    background: none; border: none;
    color: #fff; font-size: 2rem;
    cursor: pointer; line-height: 1;
}

.lb-prev, .lb-next {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,.15);
    border: none; color: #fff;
    font-size: 2.5rem; cursor: pointer;
    padding: 8px 16px; border-radius: 6px;
    transition: background .2s;
}

.lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,.3); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }

.lb-counter {
    position: absolute;
    bottom: 20px;
    color: rgba(255,255,255,.7);
    font-size: 14px;
}

@media (max-width: 768px) {
    .gallery-main .detail-img { height: 240px; }
    .gallery-thumb { width: 60px; height: 46px; }
}

/* ===== Upload Area ===== */
.upload-area {
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    background: var(--primary-pale);
    transition: background .2s;
}
.upload-area:hover { background: #d6e4f7; }
.upload-icon { font-size: 2rem; margin-bottom: 8px; }
.upload-text { font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.upload-sub  { font-size: 12px; color: var(--muted); }

/* ===== Image Preview Grid ===== */
.image-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}
.preview-item {
    position: relative;
    width: 90px;
}
.preview-item img {
    width: 90px;
    height: 68px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--border);
    display: block;
}
.preview-label {
    display: block;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    margin-top: 3px;
}
