/* Enhanced Critical CSS with better mobile optimization */
* {
    box-sizing: border-box;
}

/* Faster rendering with system fonts initially */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Critical layout prevention */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Hero section optimization for mobile */
.hero-section {
    position: relative;
    min-height: 500px;
    overflow: hidden;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

@media (min-width: 768px) {
    .hero-section {
        min-height: 700px;
    }
}

/* Reserve space for hero image */
.hero-bg-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Container optimization */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}

/* Grid system optimization */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col-lg-8 {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 15px;
}

.col-lg-4 {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 15px;
}

@media (min-width: 992px) {
    .col-lg-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }
    
    .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

/* Button optimization */
.btn {
    display: inline-block;
    font-weight: 600;
    line-height: 1.5;
    color: #fff;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 0.25rem;
    transition: all 0.15s ease-in-out;
    background: #007bff;
    border-color: #007bff;
}

.btn:hover {
    background: #0056b3;
    border-color: #0056b3;
}

/* Navigation optimization */
.header-top {
    position: relative;
    z-index: 1000;
    background: #fff;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

/* Typography optimization */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: 1.75rem;
    line-height: 1.2;
}

@media (min-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }
}

h2 {
    font-size: 1.5rem;
}

@media (min-width: 768px) {
    h2 {
        font-size: 2rem;
    }
}

p {
    margin-top: 0;
    margin-bottom: 1rem;
}

/* Card optimization */
.service-card,
.testimonial-card,
.city-link-card,
.location-card {
    min-height: 200px;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease-in-out;
}

/* Featured escort card */
.featured-escort-card {
    min-height: 300px;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    text-align: center;
}

/* Mobile-specific optimizations */
.mobile-device {
    /* Reduce motion on mobile */
    --animation-duration: 0.1s;
}

.mobile-device * {
    animation-duration: var(--animation-duration) !important;
    transition-duration: var(--animation-duration) !important;
}

/* Low-end device optimizations */
.low-end-device {
    /* Disable complex animations */
    .animated {
        animation: none !important;
    }
    
    /* Simplify gradients */
    .hero-section {
        background: #667eea;
    }
}

/* Slow connection optimizations */
.slow-connection {
    /* Disable non-essential features */
    .marquee {
        display: none;
    }
    
    /* Simplify images */
    img {
        filter: none;
    }
}

/* Loading states */
.lazy-load {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy-load.loaded {
    opacity: 1;
}

/* Progressive enhancement */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .service-card,
    .testimonial-card {
        border: 1px solid currentColor;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .header-top {
        background: #2d2d2d;
    }
    
    .service-card,
    .testimonial-card {
        background: #2d2d2d;
        color: #e0e0e0;
    }
}

/* Utility classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }

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

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }

/* Performance monitoring styles */
.performance-monitor {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 9999;
    display: none;
}

.performance-monitor.show {
    display: block;
}