/**
 * Hero Background Image Styling
 * Dr. Hamza Gemici Medical Aesthetics Website
 */

/* Enhanced Hero Background Styling */
.hero {
    /* Fallback for when image is loading */
    background-color: var(--primary);
}

/* Enhanced background image handling */
.hero.with-background {
    background:
        linear-gradient(135deg, rgba(33, 90, 228, 0.85) 0%, rgba(33, 90, 228, 0.9) 100%),
        url('../images/drhg.jpg?v=20250122');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Responsive background for mobile */
@media (max-width: 768px) {
    .hero.with-background {
        background-attachment: scroll;
        background-position: center top;
    }
}

/* Loading state for background image */
.hero-background-loading {
    background: var(--primary);
    position: relative;
}

.hero-background-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Improved text contrast on background image */
.hero-content {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero h1,
.hero .subtitle,
.hero .description {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Professional overlay for better readability */
.hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(33, 90, 228, 0.1) 0%,
        rgba(33, 90, 228, 0.05) 50%,
        rgba(0, 0, 0, 0.1) 100%
    );
    z-index: 1;
    pointer-events: none;
}

/* Ensure content stays above overlay */
.hero-content {
    position: relative;
    z-index: 3;
}

/* Background image error handling */
.hero-background-error {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
}

.hero-background-error::before {
    content: '⚠️ Background image failed to load';
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    z-index: 10;
    opacity: 0.7;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hero {
        background: var(--primary) !important;
    }

    .hero::after {
        background: rgba(0, 0, 0, 0.5) !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .hero {
        background-attachment: scroll !important;
    }

    .hero-background-loading::after {
        animation: none;
    }
}