/* ========================================
   Modern CSS Fixes & Improvements
   For BuyHomes Alanya - 2026
   ======================================== */

/* ──────────────────────────────────────
   1. CSS Variables for Easy Customization
   ────────────────────────────────────── */
:root {
    --primary-color: #0000ff;
    --primary-dark: #0000cc;
    --secondary-color: #000024;
    --text-color: #333;
    --text-light: #666;
    --border-color: #ddd;
    --bg-light: #f8f9fa;
    --white: #fff;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
    --border-radius: 8px;
    --spacing-sm: 15px;
    --spacing-md: 30px;
    --spacing-lg: 60px;
}

/* ──────────────────────────────────────
   2. Modern Box Model (Fix Legacy Issues)
   ────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ──────────────────────────────────────
   3. Remove Deprecated Vendor Prefixes
   ────────────────────────────────────── */
.modern-transition {
    transition: var(--transition);
}

.modern-shadow {
    box-shadow: var(--shadow-md);
}

.modern-border-radius {
    border-radius: var(--border-radius);
}

/* ──────────────────────────────────────
   4. Flexbox & Grid Utilities (Modern)
   ────────────────────────────────────── */
.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.grid {
    display: grid;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-md);
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ──────────────────────────────────────
   5. Modern Typography
   ────────────────────────────────────── */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
}

p {
    line-height: 1.7;
    margin-bottom: 1rem;
}

/* ──────────────────────────────────────
   6. Modern Button Styles
   ────────────────────────────────────── */
.btn-modern {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: var(--white);
}

.btn-modern:active {
    transform: translateY(0);
}

/* ──────────────────────────────────────
   7. Modern Card Styles
   ────────────────────────────────────── */
.card-modern {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.card-modern:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-modern img {
    width: 100%;
    height: auto;
    display: block;
}

/* ──────────────────────────────────────
   8. Image Optimization
   ────────────────────────────────────── */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

img[loading="lazy"] {
    content-visibility: auto;
}

/* ──────────────────────────────────────
   9. Modern Form Inputs
   ────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background: var(--white);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 0, 255, 0.1);
}

/* ──────────────────────────────────────
   9b. Header Search Input Override
   ────────────────────────────────────── */
.headerSearch .searchText {
    background: transparent !important;
    color: #fff !important;
    border: none !important;
    border-bottom: 1px solid rgba(255,255,255,.2) !important;
    border-radius: 0 !important;
    padding: 12px 55px 12px 5px !important;
    box-shadow: none !important;
}
.headerSearch .searchText:focus {
    border-color: rgba(255,255,255,.5) !important;
    box-shadow: none !important;
}

/* ──────────────────────────────────────
   10. Accessibility Improvements
   ────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip to main content (for screen readers) */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: var(--white);
    padding: 8px 16px;
    text-decoration: none;
    z-index: 9999;
}

.skip-to-main:focus {
    top: 0;
}

/* ──────────────────────────────────────
   11. Loading States
   ────────────────────────────────────── */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ──────────────────────────────────────
   12. Responsive Utilities
   ────────────────────────────────────── */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}

/* ──────────────────────────────────────
   13. Fix Deprecated Float-Based Layouts
   ────────────────────────────────────── */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* Modern alternative: use flexbox instead */
.container-modern {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

/* ──────────────────────────────────────
   14. Modern Social Media Icons
   ────────────────────────────────────── */
.social-icons {
    display: flex;
    gap: 15px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.social-icons li {
    margin: 0;
}

.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    transition: var(--transition);
    text-decoration: none;
}

.social-icons a:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

/* ──────────────────────────────────────
   15. Modern Animations
   ────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

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

.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

/* ──────────────────────────────────────
   16. Print Styles
   ────────────────────────────────────── */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        color: #000;
        background: #fff;
    }
    
    a {
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* ──────────────────────────────────────
   17. Performance: Content Visibility
   ────────────────────────────────────── */
.below-fold {
    content-visibility: auto;
    contain-intrinsic-size: 0 500px;
}

/* ──────────────────────────────────────
   17b. Property Detail Slider – prevent blank space for small images
   ────────────────────────────────────── */
.propertyDetailsSlider {
    min-height: 0 !important;
}
.propertyDetailsSlider .MagicSlideshow,
.propertyDetailsSlider .mss-slider-container,
.propertyDetailsSlider .mss-slider {
    max-height: 600px !important;
}
.propertyDetailsSlider .mss-slider img {
    max-height: 560px;
    object-fit: contain;
    margin: 0 auto;
}
@media (max-width: 767px) {
    .propertyDetailsSlider .MagicSlideshow,
    .propertyDetailsSlider .mss-slider-container,
    .propertyDetailsSlider .mss-slider {
        max-height: 400px !important;
    }
    .propertyDetailsSlider .mss-slider img {
        max-height: 360px;
    }
}

/* ──────────────────────────────────────
   17c. X/Twitter Share Button – black background
   ────────────────────────────────────── */
.twittercolor {
    background-color: #000 !important;
}
.twittercolor:hover {
    background-color: #333 !important;
}

/* ──────────────────────────────────────
   18. Dark Mode Support (Future-Ready)
   ────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    /* Will be implemented when dark mode is enabled */
    /* body {
        background: #1a1a1a;
        color: #f0f0f0;
    } */
}

/* ──────────────────────────────────────
   19. Smooth Scrolling
   ────────────────────────────────────── */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ──────────────────────────────────────
   20. Legacy Browser Support Removals
   ────────────────────────────────────── */
/* Remove IE-specific hacks */
/* No more -ms- prefixes needed for modern browsers */
/* Flexbox and Grid are now fully supported */
