/* 
* Critical CSS - Above the fold styles for fast initial render
* This file contains only the essential styles needed for the initial page load
*/

/* CSS Variables */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

html[data-bs-theme="dark"] {
    --primary-bg: #121212;
    --secondary-bg: #1e1e1e;
    --card-bg: #252525;
    --text-color: #e0e0e0;
    --border-color: #333;
}

/* Core Typography and Layout */
body {
    font-family: 'Vazirmatn', tahoma, sans-serif !important;
    background-color: #f9f9f9;
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* Dark mode body */
html[data-bs-theme="dark"] body {
    background-color: var(--primary-bg);
}

/* Header - Critical for above the fold */
.top-bar {
    font-size: 0.875rem;
    background-color: var(--light-color);
    border-bottom: 1px solid #dee2e6;
}

.navbar {
    background-color: white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0.5rem 0;
}

.navbar-brand img {
    height: 50px;
    width: auto;
}

/* Navigation */
.navbar-nav .nav-link {
    color: #333 !important;
    font-weight: 500;
    padding: 0.75rem 1rem !important;
    transition: color 0.3s ease;
    white-space: nowrap;
    font-size: 0.95rem;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
}

/* Hero Section - Critical for LCP */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* Search Form - Above the fold */
.search-form {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

/* Cards - Critical for property listings */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.card-img-top {
    height: 200px;
    object-fit: cover;
    border-radius: 0;
}

/* Property Cards */
.property-card {
    height: 100%;
}

.property-card .card-body {
    padding: 1.25rem;
}

.property-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #333;
}

/* Card text elements */
.card-text {
    color: #666;
}

.property-price {
    color: var(--primary-color);
    font-weight: 600;
}

.property-location {
    color: #666;
    font-size: 0.9rem;
}

/* Buttons - Critical UI elements */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    transform: translateY(-1px);
}

/* Loading States */
.img-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Dark Mode Critical Styles */
html[data-bs-theme="dark"] .card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-bs-theme="dark"] .property-card .card-title {
    color: #ffffff !important;
}

html[data-bs-theme="dark"] .card-text {
    color: #cccccc !important;
}

html[data-bs-theme="dark"] .property-location {
    color: #aaaaaa !important;
}

html[data-bs-theme="dark"] .property-price {
    color: #4dabf7 !important;
}

html[data-bs-theme="dark"] .navbar {
    background-color: var(--secondary-bg) !important;
}

html[data-bs-theme="dark"] .navbar-nav .nav-link {
    color: var(--text-color) !important;
}

html[data-bs-theme="dark"] .top-bar {
    background-color: var(--secondary-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

html[data-bs-theme="dark"] h1, 
html[data-bs-theme="dark"] h2, 
html[data-bs-theme="dark"] h3, 
html[data-bs-theme="dark"] h4, 
html[data-bs-theme="dark"] h5, 
html[data-bs-theme="dark"] h6 {
    color: #ffffff !important;
}

html[data-bs-theme="dark"] p, 
html[data-bs-theme="dark"] span, 
html[data-bs-theme="dark"] div {
    color: var(--text-color);
}

html[data-bs-theme="dark"] .text-muted {
    color: #aaaaaa !important;
}

html[data-bs-theme="dark"] .badge {
    color: #ffffff !important;
}

html[data-bs-theme="dark"] .breadcrumb-item a {
    color: #4dabf7;
}

html[data-bs-theme="dark"] .breadcrumb-item.active {
    color: #cccccc;
}

/* Responsive Critical Styles */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .search-form {
        padding: 1.5rem;
        margin-top: 1rem;
    }
    
    .card-img-top {
        height: 180px;
    }
}

/* Font Display Optimization - handled by vazirmatn-font-face.css */

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
