/* ================= IMPROVEMENTS CSS ================= */

/* ==========================================
   1. ACCESSIBILITY IMPROVEMENTS
   ========================================== */
   
/* Skip to content link */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 10px 20px;
    z-index: 99999;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================
   2. NOTIFICATIONS / TOASTS
   ========================================== */
   
.eri-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 99999;
    max-width: 400px;
}

.eri-notification.show {
    transform: translateY(0);
    opacity: 1;
}

.eri-notification i {
    font-size: 20px;
}

.notification-success i {
    color: #27ae60;
}

.notification-error i {
    color: #e74c3c;
}

.notification-warning i {
    color: #f39c12;
}

/* ==========================================
   3. MORTGAGE CALCULATOR
   ========================================== */
   
.mortgage-calculator {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.mortgage-calculator h3 {
    font-size: 22px;
    margin-bottom: 25px;
    color: var(--text-dark);
}

.calculator-form .form-group {
    margin-bottom: 20px;
}

.calculator-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.calculator-form input[type="number"],
.calculator-form select {
    width: 100%;
    height: 45px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    padding: 0 15px;
    font-size: 15px;
    transition: var(--transition);
}

.calculator-form input:focus,
.calculator-form select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.mortgage-result {
    background: var(--bg-light);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-top: 20px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.result-value {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-dark);
}

.result-item.highlight .result-value {
    color: var(--primary-color);
    font-size: 20px;
}

#calc-result {
    margin-top: 20px;
}

.calc-results {
    background: var(--bg-light);
    padding: 20px;
    border-radius: var(--border-radius);
}

.calc-results p {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.calc-results p strong {
    color: var(--text-dark);
}

.calc-results p.error {
    color: #e74c3c;
    font-weight: 600;
}

.calc-note {
    font-size: 12px !important;
    color: var(--text-muted) !important;
    font-style: italic;
    margin-top: 15px !important;
}

/* ==========================================
   4. FAVORITES
   ========================================== */
   
.btn-favorite {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-favorite:hover,
.btn-favorite.active {
    background: var(--primary-color);
    color: white;
}

.btn-favorite i {
    font-size: 18px;
}

.favorites-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.fav-counter {
    background: var(--primary-color);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

/* ==========================================
   5. IMAGE LIGHTBOX
   ========================================== */
   
.property-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.property-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    padding: 10px;
    transition: var(--transition);
}

.lightbox-close:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: var(--transition);
}

.lightbox-nav:hover {
    background: var(--primary-color);
}

.lightbox-prev {
    left: -80px;
}

.lightbox-next {
    right: -80px;
}

.lightbox-thumbnails {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.lightbox-thumb {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: var(--border-radius);
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition);
    border: 2px solid transparent;
}

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

/* ==========================================
   6. ADVANCED SEARCH
   ========================================== */
   
#advanced-search-panel {
    display: none;
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    margin-top: 15px;
    box-shadow: var(--shadow-md);
}

#advanced-search-panel.active {
    display: block;
}

.search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.search-field {
    flex: 1;
    min-width: 200px;
}

.search-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 14px;
    color: var(--text-secondary);
}

.range-slider {
    position: relative;
    height: 40px;
}

.range-slider input[type="range"] {
    width: 100%;
    height: 5px;
    -webkit-appearance: none;
    background: var(--bg-light);
    border-radius: 5px;
    outline: none;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

.range-value {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 5px;
}

#toggle-advanced-search {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 14px;
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

#toggle-advanced-search:hover {
    text-decoration: underline;
}

/* ==========================================
   7. NEWSLETTER
   ========================================== */
   
.newsletter-section {
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a2e 100%);
    padding: 80px 0;
}

.newsletter-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.newsletter-content h3 {
    color: white;
    font-size: 32px;
    margin-bottom: 15px;
}

.newsletter-content p {
    color: rgba(255,255,255,0.8);
    margin-bottom: 30px;
}

#newsletter-form {
    display: flex;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

#newsletter-form input[type="email"] {
    flex: 1;
    height: 50px;
    border: none;
    border-radius: var(--border-radius);
    padding: 0 20px;
    font-size: 15px;
}

#newsletter-form button {
    height: 50px;
    padding: 0 30px;
    background: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

#newsletter-form button:hover {
    filter: brightness(115%);
    transform: translateY(-2px);
}

#newsletter-form button.success {
    background: #27ae60;
}

@media (max-width: 576px) {
    #newsletter-form {
        flex-direction: column;
    }
    
    #newsletter-form button {
        width: 100%;
    }
}

/* ==========================================
   8. SHARE BUTTONS
   ========================================== */
   
.share-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: var(--transition);
}

.share-btn:hover {
    transform: translateY(-3px);
}

.share-btn.facebook { background: #1877F2; }
.share-btn.twitter { background: #1DA1F2; }
.share-btn.whatsapp { background: #25D366; }
.share-btn.linkedin { background: #0A66C2; }

/* ==========================================
   9. SCROLL TO TOP
   ========================================== */
   
.scroll-top {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 45px;
    height: 45px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
    border: none;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    background: var(--primary-dark);
    transform: translateY(-5px);
}

/* ==========================================
   10. WHATSAPP FLOAT
   ========================================== */
   
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    background: #25d366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 30px;
    box-shadow: 0 4px 20px rgba(37,211,102,0.4);
    z-index: 9999;
    transition: var(--transition);
    text-decoration: none;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(37,211,102,0.5);
    color: white;
}

/* ==========================================
   11. ANIMATIONS
   ========================================== */
   
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.animate-on-scroll {
    opacity: 0;
}

.animate-on-scroll.animated {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-on-scroll.delay-1 { animation-delay: 0.1s; }
.animate-on-scroll.delay-2 { animation-delay: 0.2s; }
.animate-on-scroll.delay-3 { animation-delay: 0.3s; }
.animate-on-scroll.delay-4 { animation-delay: 0.4s; }

/* ==========================================
   12. PROPERTY DETAIL PAGE
   ========================================== */
   
.property-detail-header {
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a2e 100%);
    padding: 120px 0 60px;
    color: white;
    margin-top: -50px;
}

.property-breadcrumb {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}

.property-breadcrumb a {
    color: rgba(255,255,255,0.7);
}

.property-breadcrumb a:hover {
    color: var(--primary-color);
}

.property-breadcrumb span {
    color: rgba(255,255,255,0.5);
}

.property-detail-header h1 {
    color: white;
    font-size: 36px;
    margin-bottom: 15px;
}

.property-detail-header .location {
    font-size: 18px;
    color: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    gap: 10px;
}

.property-detail-header .location i {
    color: var(--primary-color);
}

.property-detail-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.property-detail-gallery {
    margin-top: -40px;
    position: relative;
    z-index: 10;
}

.gallery-main {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.gallery-main img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    cursor: pointer;
}

.gallery-thumbs {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.gallery-thumbs img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--border-radius);
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition);
    border: 2px solid transparent;
}

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

.property-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--border-radius);
}

.feature-item i {
    font-size: 24px;
    color: var(--primary-color);
}

.feature-item .feature-info span {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
}

.feature-item .feature-info strong {
    font-size: 20px;
    color: var(--text-dark);
}

/* ==========================================
   13. CONTACT FORM IMPROVEMENTS
   ========================================== */
   
.contact-info-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.contact-info-box {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 25px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.contact-info-box:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-5px);
}

.contact-info-box i {
    width: 50px;
    height: 50px;
    background: var(--bg-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary-color);
}

.contact-info-box h4 {
    font-size: 16px;
    margin-bottom: 5px;
}

.contact-info-box p,
.contact-info-box a {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.sidebar-sticky {
    position: sticky;
    top: 100px;
}

.contact-card {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.contact-card h4 {
    font-size: 20px;
    margin-bottom: 10px;
}

.contact-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ==========================================
   14. RESPONSIVE ADJUSTMENTS
   ========================================== */
   
@media (max-width: 768px) {
    .mortgage-calculator {
        padding: 20px;
    }
    
    .result-item {
        flex-direction: column;
        gap: 5px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
    }
    
    .property-detail-header {
        padding: 100px 0 40px;
    }
    
    .property-detail-header h1 {
        font-size: 28px;
    }
    
    .property-features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .share-buttons {
        justify-content: center;
        margin-top: 20px;
    }
    
    .eri-notification {
        left: 20px;
        right: 20px;
        bottom: 20px;
    }
    
    .whatsapp-float {
        width: 50px;
        height: 50px;
        font-size: 24px;
        bottom: 20px;
        left: 20px;
    }
    
    .scroll-top {
        bottom: 80px;
        right: 20px;
        width: 40px;
        height: 40px;
    }
}

/* ==========================================
   15. LOADING STATES
   ========================================== */
   
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================
   16. PRINT STYLES
   ========================================== */
   
@media print {
    .whatsapp-float,
    .scroll-top,
    .share-buttons,
    .btn-favorite,
    #newsletter-form,
    footer,
    .sidebar {
        display: none !important;
    }
    
    .property-detail-header {
        background: white !important;
        color: black !important;
        padding: 20px 0 !important;
        margin: 0 !important;
    }
    
    .property-detail-header h1 {
        color: black !important;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 12px;
        color: #666;
    }
}

/* ================= SEARCH FORM STYLES ================= */
.search-form-card {
    border-radius: 1rem !important;
}

.search-form-card .form-select,
.search-form-card .form-control {
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.search-form-card .form-select:focus,
.search-form-card .form-control:focus {
    border-color: #FBAC18;
    box-shadow: 0 0 0 0.25rem rgba(251,172,24,0.25);
}

.search-form-card .btn-primary {
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
}

.input-group-text {
    background-color: #f8f9fa;
    border-right: none;
}

.input-group .form-control:focus {
    border-left: none;
}

/* ================= BOOTSTRAP GRID UTILITIES ================= */
.row.g-3 > * {
    padding-right: calc(var(--bs-gutter-x) * 0.5);
    padding-left: calc(var(--bs-gutter-x) * 0.5);
}

.row.g-3 {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 1.5rem;
    margin-right: calc(-1 * var(--bs-gutter-x) * 0.5);
    margin-left: calc(-1 * var(--bs-gutter-x) * 0.5);
    margin-top: calc(-1 * var(--bs-gutter-y) * 0.5);
    margin-bottom: calc(-1 * var(--bs-gutter-y) * 0.5);
}

.row.g-3 > * {
    margin-top: calc(var(--bs-gutter-y) * 0.5);
    margin-bottom: calc(var(--bs-gutter-y) * 0.5);
    padding-right: calc(var(--bs-gutter-x) * 0.5);
    padding-left: calc(var(--bs-gutter-x) * 0.5);
}

/* ================= ANIMATION UTILITIES ================= */
.animate-fade-in {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================= CARD HOVER EFFECTS ================= */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 1rem 3rem rgba(0,0,0,0.15) !important;
}

/* ================= PAGINATION STYLES ================= */
.pagination {
    gap: 0.25rem;
}

.pagination .page-link {
    border-radius: 0.5rem !important;
    border: none;
    padding: 0.5rem 1rem;
    color: #2C3E50;
    font-weight: 500;
    transition: all 0.3s ease;
}

.pagination .page-item.active .page-link {
    background-color: #FBAC18;
    color: #212529;
}

.pagination .page-link:hover {
    background-color: #FBAC18;
    color: #212529;
    transform: translateY(-2px);
}

.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    border-radius: 0.5rem !important;
}

/* ================= BADGE STYLES ================= */
.badge.bg-primary {
    background-color: #FBAC18 !important;
    color: #212529 !important;
}

.badge.bg-info {
    background-color: #17a2b8 !important;
}

.badge.bg-success {
    background-color: #28a745 !important;
}

.badge.bg-dark {
    background-color: #2C3E50 !important;
}

/* ================= RESPONSIVE UTILITIES ================= */
@media (max-width: 991.98px) {
    .search-form-card .col-lg-4,
    .search-form-card .col-lg-3 {
        margin-bottom: 1rem;
    }
}

@media (max-width: 575.98px) {
    .input-group {
        flex-direction: column;
    }
    
    .input-group > * {
        border-radius: 0.5rem !important;
    }
    
    .input-group-text {
        border-radius: 0.5rem 0.5rem 0 0 !important;
    }
}
