/* =====================================================
   Real Estate Website - Main Styles
   Color Palette: Blue / White / Gray
   ===================================================== */

:root {
    --primary: #0059C2;
    --primary-dark: #003B82;
    --primary-light: #1a7ae0;
    --white: #FFFFFF;
    --bg: #F4F6F8;
    --gray-light: #E4E4E6;
    --text: #263445;
    --text-muted: #718096;
    --border: #E2E8F0;
    --success: #38A169;
    --danger: #E53E3E;
    --warning: #D69E2E;
    --info: #3182CE;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
    --transition: 0.25s ease;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; display: block; }

ul, ol { list-style: none; }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-content { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}
.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--white);
}
.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}
.btn-sm { padding: 7px 14px; font-size: 0.875rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #c53030; color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-secondary { background: var(--gray-light); color: var(--text); border-color: var(--gray-light); }
.btn-secondary:hover { background: #d0d0d2; }

/* ---------- Header ---------- */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    gap: 20px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
}
.logo i { font-size: 1.5rem; }
.logo:hover { color: var(--primary-dark); }

.main-nav ul {
    display: flex;
    gap: 28px;
}
.main-nav a {
    color: var(--text);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
}
.main-nav a:hover { color: var(--primary); }
.main-nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width var(--transition);
}
.main-nav a:hover::after { width: 100%; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text);
    cursor: pointer;
    padding: 8px;
}

/* User dropdown */
.user-dropdown { position: relative; }
.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    transition: all var(--transition);
}
.user-btn:hover { border-color: var(--primary); }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    padding: 8px 0;
    display: none;
    z-index: 100;
}
.dropdown-menu.show { display: block; }
.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text);
    font-size: 0.9rem;
}
.dropdown-menu a:hover {
    background: var(--bg);
    color: var(--primary);
}
.dropdown-menu a i { width: 18px; text-align: center; color: var(--text-muted); }

/* ---------- Flash / Alerts ---------- */
.flash-messages { padding: 16px 0 0; }
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
}
.alert-success { background: #f0fff4; color: #276749; border: 1px solid #c6f6d5; }
.alert-error { background: #fff5f5; color: #c53030; border: 1px solid #fed7d7; }
.alert-warning { background: #fffff0; color: #975a16; border: 1px solid #fefcbf; }
.alert-info { background: #ebf8ff; color: #2b6cb0; border: 1px solid #bee3f8; }
.alert-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    line-height: 1;
}
.alert-close:hover { opacity: 1; }

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #1a7ae0 100%);
    color: var(--white);
    padding: 70px 0 80px;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}
.hero-content { position: relative; z-index: 1; text-align: center; max-width: 800px; margin: 0 auto; }
.hero h1 {
    font-size: 2.6rem;
    font-weight: 700;
    margin-bottom: 14px;
    line-height: 1.25;
}
.hero p {
    font-size: 1.15rem;
    opacity: 0.9;
    margin-bottom: 36px;
}

/* Search form */
.search-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    max-width: 900px;
    margin: 0 auto;
}
.search-form {
    display: grid;
    grid-template-columns: repeat(5, 1fr) auto;
    gap: 12px;
    align-items: end;
}
.search-form .form-group { margin: 0; }
.search-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-align: left;
}
.search-form select,
.search-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text);
    background: var(--white);
    transition: border-color var(--transition);
}
.search-form select:focus,
.search-form input:focus {
    outline: none;
    border-color: var(--primary);
}
.search-form .btn { height: 42px; white-space: nowrap; }

/* ---------- Sections ---------- */
.section { padding: 60px 0; }
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}
.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}
.section-link {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---------- Property Cards ---------- */
.property-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.property-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    border: 1px solid var(--border);
}
.property-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}
.card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: var(--gray-light);
}
.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.property-card:hover .card-image img { transform: scale(1.05); }
.card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}
.card-badge.rent { background: var(--success); }
.card-fav {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition);
    font-size: 1rem;
}
.card-fav:hover, .card-fav.active { color: var(--danger); background: #fff; }
.card-body { padding: 18px; }
.card-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}
.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}
.card-title a { color: inherit; }
.card-title a:hover { color: var(--primary); }
.card-location {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
.card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.card-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ---------- Categories ---------- */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}
.category-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 16px;
    text-align: center;
    transition: all var(--transition);
}
.category-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}
.category-card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 12px;
}
.category-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

/* ---------- Features / Advantages ---------- */
.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}
.feature-card {
    text-align: center;
    padding: 30px 20px;
}
.feature-icon {
    width: 64px;
    height: 64px;
    background: rgba(0,89,194,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.5rem;
    color: var(--primary);
}
.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}
.feature-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ---------- CTA ---------- */
.cta-section {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    padding: 60px 0;
    text-align: center;
}
.cta-section h2 {
    font-size: 1.9rem;
    margin-bottom: 12px;
}
.cta-section p {
    opacity: 0.9;
    margin-bottom: 28px;
    font-size: 1.05rem;
}
.cta-section .btn {
    background: #fff;
    color: var(--primary);
    border-color: #fff;
}
.cta-section .btn:hover {
    background: transparent;
    color: #fff;
}

/* ---------- Footer ---------- */
.site-footer {
    background: #1a2332;
    color: #a0aec0;
    padding: 50px 0 0;
    margin-top: auto;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.3fr;
    gap: 40px;
    padding-bottom: 40px;
}
.footer-title {
    color: #fff;
    font-size: 1.3rem;
    margin-bottom: 14px;
}
.footer-desc {
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 16px;
}
.footer-col h4 {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 16px;
}
.footer-col ul li { margin-bottom: 8px; }
.footer-col a {
    color: #a0aec0;
    font-size: 0.9rem;
}
.footer-col a:hover { color: #fff; }
.social-links {
    display: flex;
    gap: 12px;
}
.social-links a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background var(--transition);
}
.social-links a:hover { background: var(--primary); }
.contact-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9rem;
    margin-bottom: 10px;
}
.contact-list i { margin-top: 3px; color: var(--primary-light); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 20px 0;
    text-align: center;
    font-size: 0.85rem;
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--text);
}
.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,89,194,0.12);
}
.form-control.is-invalid { border-color: var(--danger); }
.invalid-feedback {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 4px;
}
textarea.form-control { resize: vertical; min-height: 120px; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Auth pages */
.auth-page {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 40px;
    width: 100%;
    max-width: 460px;
    border: 1px solid var(--border);
}
.auth-card h1 {
    font-size: 1.6rem;
    margin-bottom: 8px;
    text-align: center;
}
.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 28px;
    font-size: 0.95rem;
}
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ---------- Property Detail ---------- */
.property-detail { padding: 30px 0 60px; }
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 32px;
}
.gallery-main {
    border-radius: var(--radius);
    overflow: hidden;
    height: 420px;
    background: var(--gray-light);
    margin-bottom: 12px;
}
.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.gallery-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.gallery-thumbs img {
    width: 90px;
    height: 70px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color var(--transition);
}
.gallery-thumbs img.active,
.gallery-thumbs img:hover { border-color: var(--primary); }

.detail-info h1 {
    font-size: 1.6rem;
    margin-bottom: 8px;
}
.detail-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}
.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.detail-meta span { display: flex; align-items: center; gap: 5px; }
.detail-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.detail-section h2 {
    font-size: 1.15rem;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.features-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.features-list li {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    padding: 6px 0;
}
.features-list .label { color: var(--text-muted); }
.features-list .value { font-weight: 600; }

.sidebar-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    position: sticky;
    top: 90px;
}
.sidebar-card .contact-phone {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin: 12px 0;
}
.sidebar-card .btn { margin-bottom: 10px; }
.agent-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.agent-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--text-muted);
}
.share-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}
.share-buttons a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition);
}
.share-buttons a:hover { background: var(--primary); color: #fff; }

/* ---------- Filters sidebar ---------- */
.listings-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 28px;
    padding: 30px 0 60px;
}
.filter-sidebar {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    height: fit-content;
    position: sticky;
    top: 90px;
}
.filter-sidebar h3 {
    font-size: 1.1rem;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.filter-group { margin-bottom: 16px; }
.filter-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 5px;
}
.listings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.listings-count { color: var(--text-muted); font-size: 0.95rem; }
.sort-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

/* ---------- Pagination ---------- */
.pagination {
    margin-top: 36px;
    display: flex;
    justify-content: center;
}
.pagination ul {
    display: flex;
    gap: 6px;
}
.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 500;
    background: var(--white);
    transition: all var(--transition);
}
.page-link:hover, .page-link.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 16px;
    opacity: 0.4;
}
.empty-state h3 {
    font-size: 1.3rem;
    color: var(--text);
    margin-bottom: 8px;
}
.empty-state p { margin-bottom: 20px; }

/* ---------- Page Header ---------- */
.page-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 28px 0;
}
.page-header h1 {
    font-size: 1.7rem;
    margin-bottom: 4px;
}
.breadcrumb {
    display: flex;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--text); }

/* ---------- Misc ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-pending { background: #fefcbf; color: #975a16; }
.badge-approved { background: #c6f6d5; color: #276749; }
.badge-rejected { background: #fed7d7; color: #c53030; }
.badge-inactive { background: var(--gray-light); color: var(--text-muted); }

.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0,0,0,0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
