/* Performance Optimizations */
img {
    height: auto;
    max-width: 100%;
    display: block;
}

/* Critical CSS - Above the fold optimizations */
.header {
    will-change: transform;
}

.service-item {
    will-change: transform;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: #333;
}

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

/* Header Styles */
.header {
    height: 50vh;
    background-image: url('../images/FefelinaBackground.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.header-logo {
    max-width: 300px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

/* Section Styles */
.section {
    padding: 60px 0;
    position: relative;
}

.section-title {
    text-align: center;
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 40px;
    color: #e28e60;
}

/* Section Dividers */
.section-divider {
    height: 4px;
    background: linear-gradient(90deg, transparent, #7f50c6, transparent);
    margin: 0 auto;
    width: 80%;
    max-width: 400px;
}

/* About Section */
.about-section {
    background-color: #f8f9fa;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.about-image {
    text-align: center;
}

.about-image img {
    max-width: 100%;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.about-image img:hover {
    transform: scale(1.02);
}

.about-text {
    font-size: 16px;
    color: #666;
    line-height: 1.8;
}

.about-text h3 {
    font-size: 24px;
    color: #e28e60;
    margin-bottom: 20px;
    font-weight: 600;
}

/* Services Section */
.services-section {
    background-color: #fff;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-top: 40px;
}

.service-item {
    text-align: center;
    padding: 30px 20px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    background-color: #f8f9fa;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.service-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(226, 142, 96, 0.15);
    border-color: #e28e60;
}

.service-item img {
    max-width: 150px;
    height: auto;
    margin: 0 auto 20px auto;
    border-radius: 10px;
    transition: transform 0.3s ease;
    display: block;
}

.service-item img:hover {
    transform: scale(1.05);
}

.service-subtitle {
    font-size: 18px;
    font-weight: bold;
    color: #e28e60;
    margin-bottom: 15px;
}

.service-item p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.whatsapp-link {
    color: #e28e60;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.whatsapp-link:hover {
    color: #d67c47;
    text-decoration: underline;
}

/* Reviews Section */
.reviews-section {
    background-color: #f8f9fa;
    text-align: center;
}

/* Footer */
.footer {
    background-color: #ff9f6c;
    color: #000;
    padding: 50px 0 30px 0;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1.5fr 2fr 1.5fr;
    gap: 30px;
    align-items: start;
    margin-bottom: 20px;
}

.footer-column h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.footer-column p {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.footer-column .address {
    font-size: 12px;
    line-height: 1.6;
}

.social-icons {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.social-icons a {
    transition: transform 0.3s ease;
    display: block;
}

.social-icons a:hover {
    transform: scale(1.15);
}

.social-icons img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.footer-logo {
    max-width: 150px;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    align-self: flex-start;
    margin-top: -10px;
}

.brand-info {
    text-align: center;
}

.brand-name {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 10px;
    color: #333;
}

.copyright {
    font-size: 12px;
    color: #444;
}

.footer-bottom {
    border-top: 2px solid rgba(0, 0, 0, 0.1);
    padding-top: 20px;
    text-align: center;
    font-size: 11px;
    color: #666;
}

/* Instagram Section */
.instagram-section {
    background-color: #f8f9fa;
    padding: 60px 0; /* Match standard section padding */
}

.instagram-description {
    text-align: center;
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.instagram-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.instagram-profile {
    text-align: center;
}

.instagram-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #333;
    font-size: 20px;
    font-weight: 600;
    padding: 15px 25px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border: 2px solid transparent;
    border-radius: 12px;
    background-color: white;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.instagram-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.instagram-icon {
    width: 32px;
    height: 32px;
}

.instagram-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.instagram-post {
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.instagram-post:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.instagram-post .instagram-media {
    max-width: 280px !important;
    min-width: 220px !important;
    width: 280px !important;
    transform: scale(0.85);
    transform-origin: center;
}

.instagram-post-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.instagram-post-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
}

.instagram-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.instagram-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(240, 148, 51, 0.9), rgba(220, 39, 67, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.instagram-post:hover .instagram-overlay {
    opacity: 1;
}

.instagram-post:hover .instagram-post-image img {
    transform: scale(1.1);
}

.instagram-view-text {
    color: white;
    font-weight: 600;
    font-size: 16px;
    text-align: center;
}

.instagram-post-caption {
    padding: 15px;
}

.instagram-post-caption p {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #666;
}



/* Responsive Design */
@media (max-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 30px;
    }
    
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .header {
        height: 40vh;
    }
    
    .header-logo {
        max-width: 250px;
    }
    
    .section {
        padding: 40px 0;
    }
    
    .section-title {
        font-size: 28px;
    }
    
    .about-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
    }
    
    .about-image {
        text-align: center;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .about-image img {
        margin: 0 auto;
        display: block;
        text-align: center;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .service-item {
        padding: 25px 15px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 20px;
    }
    
    .social-icons {
        justify-content: center;
    }
    
    /* Instagram responsive - show 2 posts on tablet */
    .instagram-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .instagram-post .instagram-media {
        max-width: 200px !important;
        min-width: 180px !important;
        width: 200px !important;
        transform: scale(0.75);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .header {
        height: 35vh;
    }
    
    .header-logo {
        max-width: 200px;
    }
    
    .section {
        padding: 30px 0;
    }
    
    .section-title {
        font-size: 24px;
        margin-bottom: 30px;
    }
    
    .service-item {
        padding: 20px 10px;
    }
    
    .service-item img {
        max-width: 120px;
    }
    
    .social-icons img {
        width: 35px;
        height: 35px;
    }
    
    /* Instagram mobile responsive - show only first post */
    .instagram-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    /* Hide posts 2 and 3 on mobile with multiple selectors for better compatibility */
    .instagram-grid .instagram-post:nth-child(2),
    .instagram-grid .instagram-post:nth-child(3),
    .instagram-post:nth-child(2),
    .instagram-post:nth-child(3) {
        display: none !important;
        visibility: hidden !important;
    }
    
    .instagram-post .instagram-media {
        max-width: 280px !important;
        min-width: 250px !important;
        width: 280px !important;
        transform: scale(0.9);
    }
    
    /* Fix Instagram icon size on mobile */
    .instagram-link {
        font-size: 16px;
        padding: 10px 18px;
        gap: 8px;
    }
    
    .instagram-icon {
        width: 24px;
        height: 24px;
    }
    
    .footer-logo {
        max-width: 120px;
    }
}

/* Extra small screens (iPhone and similar) */
@media (max-width: 375px) {
    /* Ensure only first Instagram post shows on very small screens */
    .instagram-grid .instagram-post:nth-child(n+2) {
        display: none !important;
    }
    
    .instagram-link {
        font-size: 14px;
        padding: 8px 15px;
        gap: 6px;
    }
    
    .instagram-icon {
        width: 20px;
        height: 20px;
    }
    
    .instagram-post .instagram-media {
        max-width: 260px !important;
        min-width: 240px !important;
        width: 260px !important;
        transform: scale(0.85);
    }
}

/* Loading Animation */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

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

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

/* Accessibility Improvements */
a:focus,
button:focus {
    outline: 2px solid #e28e60;
    outline-offset: 2px;
}

/* Safari-specific styles */
@supports (-webkit-appearance: none) {
    /* Fix for about image centering in Safari */
    .about-image {
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .about-image img {
        margin: 0 auto !important;
        text-align: center;
        align-self: center;
    }
    
    /* Safari Instagram icon fix */
    .instagram-icon {
        width: 28px !important;
        height: 28px !important;
        flex-shrink: 0;
    }
    
    /* Safari mobile specific fixes */
    @media (max-width: 480px) {
        .instagram-icon {
            width: 20px !important;
            height: 20px !important;
        }
        
        .instagram-link {
            font-size: 14px !important;
            padding: 8px 15px !important;
            gap: 6px !important;
        }
    }
    
    /* Extra small screens Safari fixes */
    @media (max-width: 375px) {
        .instagram-icon {
            width: 18px !important;
            height: 18px !important;
        }
        
        .instagram-link {
            font-size: 12px !important;
            padding: 6px 12px !important;
            gap: 4px !important;
        }
    }
}

/* WebKit-specific styles (Safari and Chrome on iOS) */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .about-image {
        text-align: center !important;
        display: block !important;
    }
    
    .about-image img {
        display: block !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    /* This targets iOS Safari specifically */
    .about-section .about-content {
        display: block !important;
    }
    
    .about-image {
        width: 100% !important;
        text-align: center !important;
        margin-bottom: 20px;
    }
    
    .about-image img {
        max-width: 350px !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 auto !important;
        display: block !important;
    }
    
    /* iOS Safari Instagram fixes */
    .instagram-link {
        -webkit-appearance: none;
        appearance: none;
        display: -webkit-inline-flex !important;
        display: inline-flex !important;
        -webkit-align-items: center;
        align-items: center;
    }
    
    .instagram-icon {
        -webkit-flex-shrink: 0;
        flex-shrink: 0;
        display: block !important;
    }
    
    /* Mobile iOS Safari */
    @media (max-width: 480px) {
        .about-content {
            display: block !important;
            grid-template-columns: none !important;
        }
        
        .instagram-icon {
            width: 18px !important;
            height: 18px !important;
        }
        
        .instagram-link {
            font-size: 13px !important;
            padding: 6px 12px !important;
        }
    }
}
