/* Modern Premium CSS - MyEqarat Real Estate Iraq */

:root {
    /* Color Palette */
    --primary: #028090;      /* Deep Teal */
    --primary-hover: #005662;
    --secondary: #E36414;    /* Terracotta/Orange */
    --secondary-hover: #9A3B08;
    --bg-light: #F8F9FA;
    --bg-white: #FFFFFF;
    --text-main: #2B2D42;
    --text-muted: #6C757D;
    --border-color: #E9ECEF;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --bg-light: #121212;
    --bg-white: #1E1E1E;
    --text-main: #E0E0E0;
    --text-muted: #A0A0A0;
    --border-color: #333333;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Typography & Utilities */
h1, h2, h3, h4 {
    font-weight: 700;
    color: var(--text-main);
}

a {
    text-decoration: none;
    color: inherit;
}

/* Buttons */
.btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary);
    color: #FFF;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 128, 144, 0.3);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

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

.btn-search {
    background-color: var(--secondary);
    color: white;
    padding: 14px 32px;
    font-size: 1.1rem;
}

.btn-search:hover {
    background-color: var(--secondary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(227, 100, 20, 0.3);
}

.btn-large {
    padding: 14px 40px;
    font-size: 1.1rem;
}

/* Navbar */
.navbar {
    background-color: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

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

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.2s;
    position: relative;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary);
    border-radius: 2px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-menu {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
}

/* Hero Section */
.hero {
    position: relative;
    height: 600px;
    background: url('https://images.unsplash.com/photo-1600596542815-ffad4c1539a9?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(2, 128, 144, 0.85) 0%, rgba(43, 45, 66, 0.7) 100%);
}

.hero-content {
    position: relative;
    z-index: 1;
    color: white;
    width: 100%;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 40px;
    opacity: 0.9;
}

/* Search Box (Glassmorphism) */
.search-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-lg);
    max-width: 900px;
    margin: 0 auto;
    text-align: right;
}

[data-theme="dark"] .search-box {
    background: rgba(30, 30, 30, 0.95);
}

.search-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tab {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px 10px;
    position: relative;
}

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

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary);
    border-radius: 3px;
}

.search-inputs {
    display: flex;
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px;
    align-items: center;
}

.input-group {
    flex: 2;
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 10px;
    color: var(--text-muted);
}

.select-group {
    flex: 1;
}

.input-group input, .input-group select {
    border: none;
    outline: none;
    width: 100%;
    font-size: 1rem;
    background: transparent;
    color: var(--text-main);
    font-family: inherit;
    padding: 10px 0;
}

.input-divider {
    width: 1px;
    height: 30px;
    background-color: var(--border-color);
}

.search-filters-toggle {
    margin-top: 15px;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-block;
}

/* Main Content */
.main-content {
    padding: 60px 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 1.8rem;
}

/* Property Grid */
.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.property-card {
    background-color: var(--bg-white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    position: relative;
    cursor: pointer;
}

.property-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md);
}

.card-image-wrapper {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.card-badges {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
}

.badge {
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
}

.badge-featured { background-color: var(--secondary); }
.badge-sale { background-color: var(--primary); }
.badge-new { background-color: #2A9D8F; }

.favorite-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255,255,255,0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

[data-theme="dark"] .favorite-btn {
    background: rgba(30,30,30,0.8);
}

.favorite-btn:hover, .favorite-btn.active {
    color: #E63946;
    transform: scale(1.1);
}

.card-content {
    padding: 20px;
}

.property-price {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.property-address {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.property-features {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.property-features span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 600;
}

.property-features i {
    color: var(--text-muted);
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agent-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 600;
}

.agent-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #2A9D8F;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.publish-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.load-more-container {
    text-align: center;
    margin-top: 20px;
}

/* Map Modal */
.map-modal {
    position: fixed;
    inset: 0;
    background: var(--bg-white);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.map-modal.open {
    transform: translateY(0);
}

.map-header {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-white);
}

.close-map-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
}

.map-container {
    flex: 1;
    position: relative;
    background-color: #E9ECEF;
}

.map-overlay-message {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-white);
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    font-weight: 600;
    z-index: 10;
}

/* Footer */
footer {
    background-color: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding-top: 50px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

.footer-brand p {
    color: var(--text-muted);
    margin: 15px 0;
    max-width: 400px;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.2rem;
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--primary);
    color: white;
}

.footer-links h4 {
    margin-bottom: 20px;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--text-muted);
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 900px) {
    .search-inputs {
        flex-direction: column;
        padding: 15px;
        background: transparent;
        border: none;
        gap: 15px;
    }
    
    .input-group {
        background: var(--bg-white);
        width: 100%;
        border-radius: 8px;
        padding: 5px 15px;
    }
    
    .input-divider {
        display: none;
    }
    
    .btn-search {
        width: 100%;
    }
    
    .hero h1 {
        font-size: 2.2rem;
    }
}

@media (max-width: 768px) {
    html, body {
        width: 100vw;
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
        overscroll-behavior-y: none; /* Prevents iOS pull-to-refresh bounce on body */
    }
    
    body {
        padding-bottom: 90px; /* Space for the bottom App Tab Bar */
    }

    /* iOS App Bottom Tab Bar */
    .nav-links {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        padding: 12px 5px;
        padding-bottom: env(safe-area-inset-bottom, 20px); /* iPhone X/11/12/13/14/15 safe area */
        justify-content: space-around;
        box-shadow: 0 -5px 25px rgba(0,0,0,0.06);
        z-index: 9999;
        border-top: 1px solid rgba(0,0,0,0.05);
        margin: 0;
    }

    .nav-links a {
        font-size: 0.7rem !important;
        font-weight: 700;
        color: var(--text-muted);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        text-align: center;
        opacity: 0.7;
    }

    .nav-links a.active {
        color: var(--primary);
        opacity: 1;
    }
    
    .nav-links a::after {
        display: none !important; /* Remove bottom underline on mobile tab bar */
    }
    
    * {
        -webkit-tap-highlight-color: transparent;
    }

    a, button, .n-card, .pill {
        -webkit-touch-callout: none;
        user-select: none;
    }
    
    /* Reveal injected icons on mobile */
    .nav-icon-mobile {
        display: block !important;
        font-size: 1.3rem;
        margin-bottom: 2px;
    }

    .nav-actions .btn-outline {
        display: none; /* Hide language swap on mobile header to save space, or keep it small */
    }

    /* Layout & Utilities for Native App Feel */
    .container {
        padding: 0 15px;
    }

    .list-map-layout, .neighborhood-grid, .agents-grid, .stat-grid, .footer-content {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .map-column {
        height: 350px !important;
        margin-top: 30px;
    }
    
    #map, #agentMap {
        position: relative !important;
        top: 0 !important;
        z-index: 1;
    }

    .search-bar-v2 {
        flex-direction: column;
        padding: 5px;
        border-radius: 20px;
    }
    
    .search-bar-v2 input {
        border-bottom: 1px solid var(--border-color);
        border-radius: 0;
        padding: 18px 15px;
        font-size: 16px; /* 16px prevents Safari auto-zoom on focus */
    }
    
    .btn-search-v2 {
        width: 100%;
        border-radius: 15px;
        margin-top: 5px;
        padding: 18px;
    }

    .region-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 10px;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch; /* Smooth iOS horizontal scrolling */
        scrollbar-width: none;
    }
    
    .region-pills::-webkit-scrollbar {
        display: none;
    }
    
    /* Native App Form Inputs */
    input, select, textarea {
        font-size: 16px !important; /* Critical: Stops iOS Safari Zooming on input focus */
    }
    
    .filter-strip {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-section {
        width: 100%;
        justify-content: space-between;
    }
}
