/* ========================================
   ADDITIONAL UX/UI ENHANCEMENTS
   Skeleton Screens, Tooltips, Animations
   ======================================== */

/* SAFE AREA SUPPORT FOR NOTCHED/CURVED DISPLAYS */
:root {
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-inset-left: env(safe-area-inset-left, 0px);
}

/* SKELETON SCREENS - Loading States */
.skeleton {
    pointer-events: none;
    user-select: none;
}

.skeleton-image,
.skeleton-badge,
.skeleton-title,
.skeleton-text {
    background: linear-gradient(90deg,
            #f0f0f0 0px,
            #f8f8f8 40px,
            #f0f0f0 80px);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.skeleton-image {
    width: 100%;
    height: 300px;
    margin-bottom: 1.5rem;
}

.skeleton-badge {
    width: 120px;
    height: 24px;
    margin-bottom: 1rem;
}

.skeleton-title {
    width: 60%;
    height: 32px;
    margin-bottom: 1rem;
}

.skeleton-text {
    width: 100%;
    height: 16px;
    margin-bottom: 0.75rem;
}

.skeleton-text:last-child {
    width: 80%;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* SCROLL PROGRESS INDICATOR */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, #0EA5E9 0%, #06B6D4 100%);
    width: 0%;
    z-index: 9999;
    transition: width 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* TOOLTIPS */
/* TOOLTIPS REMOVED */

/* IMPROVED REVEAL ANIMATIONS */
.reveal {
    opacity: 0;
    transform: translateY(60px) scale(0.95);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Stagger effect for bento grid */
.bento-grid .bento-item {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.bento-grid .bento-item:nth-child(1) {
    transition-delay: 0.1s;
}

.bento-grid .bento-item:nth-child(2) {
    transition-delay: 0.2s;
}

.bento-grid .bento-item:nth-child(3) {
    transition-delay: 0.3s;
}

.bento-grid .bento-item:nth-child(4) {
    transition-delay: 0.4s;
}

.bento-grid .bento-item:nth-child(5) {
    transition-delay: 0.5s;
}

.bento-grid .bento-item:nth-child(6) {
    transition-delay: 0.6s;
}

.bento-grid.visible .bento-item {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   HERO STATS - OPTIMIZED LAYOUT
   ======================================== */

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 4rem;
    max-width: 1000px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.stat-number {
    font-size: clamp(3rem, 4vw, 4.5rem);
    font-weight: 900;
    font-family: var(--font-heading);
    background: linear-gradient(135deg, #0EA5E9 0%, #06B6D4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 0.75rem;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-body);
}

.stat-divider {
    display: none;
}

@media (max-width: 768px) {
    .hero-stats {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 3rem;
        /* CRITICAL: Add padding to prevent cutoff on mobile */
        padding-left: max(1rem, var(--safe-area-inset-left));
        padding-right: max(1rem, var(--safe-area-inset-right));
    }

    .stat-item {
        padding: 2rem 1.5rem;
        /* Ensure items stay within bounds */
        max-width: 100%;
        box-sizing: border-box;
    }

    .stat-number {
        font-size: 3rem;
        /* Prevent number overflow */
        word-break: break-word;
    }
}

/* ========================================
   SERVICES CAROUSEL
   ======================================== */

.services-carousel {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 0;
}

.carousel-track {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 1rem 0;
}

.carousel-track::-webkit-scrollbar {
    display: none;
}

.service-card {
    flex: 0 0 calc(33.333% - 1.5rem);
    min-width: 300px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 2.5rem;
    scroll-snap-align: start;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card:hover {
    border-color: var(--primary-teal);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.service-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
            rgba(14, 165, 233, 0.25),
            rgba(8, 145, 178, 0.15));
    border: 2px solid rgba(14, 165, 233, 0.2);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.service-icon svg {
    width: 36px;
    height: 36px;
}

.service-card:hover .service-icon {
    box-shadow: 0 0 40px rgba(14, 165, 233, 0.5), 0 0 60px rgba(14, 165, 233, 0.3);
    transform: scale(1.15) rotate(5deg);
    border-color: rgba(14, 165, 233, 0.5);
    background: radial-gradient(circle at 30% 30%,
            rgba(14, 165, 233, 0.35),
            rgba(8, 145, 178, 0.25));
}

.service-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-align: center;
}

.service-card p {
    color: var(--text-body);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.service-tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(14, 165, 233, 0.1);
    color: var(--primary-teal);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
}

.service-card:has(.service-tag) {
    text-align: center;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.carousel-btn:hover {
    background: var(--primary-teal);
    color: white;
    border-color: var(--primary-teal);
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev {
    left: -24px;
}

.carousel-next {
    right: -24px;
}

.carousel-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-medium);
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-dot.active {
    background: var(--primary-teal);
    width: 24px;
    border-radius: 4px;
}

@media (max-width: 1024px) {
    .service-card {
        flex: 0 0 calc(50% - 1rem);
    }

    .carousel-prev,
    .carousel-next {
        display: none;
    }
}

@media (max-width: 768px) {
    .service-card {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .carousel-track {
        gap: 1rem;
    }

    .carousel-prev,
    .carousel-next {
        width: 32px;
        height: 32px;
        background: rgba(14, 165, 233, 0.9);
        color: white;
        box-shadow: 0 2px 12px rgba(14, 165, 233, 0.4);
        border: 2px solid white;
        display: flex;
        opacity: 0.85;
        transition: all 0.3s ease;
    }

    .carousel-prev:active,
    .carousel-next:active {
        opacity: 1;
        transform: translateY(-50%) scale(0.95);
    }

    .carousel-prev {
        left: -12px;
    }

    .carousel-next {
        right: -12px;
    }

    .carousel-prev svg,
    .carousel-next svg {
        width: 18px;
        height: 18px;
    }
}

/* DARK MODE SUPPORT - REMOVED 
   The previous dark mode was causing text visibility issues
   by changing backgrounds without properly adjusting all text colors.
   Users should use their device's light mode for best experience.
*/

/* MOBILE OPTIMIZATIONS */
@media (max-width: 768px) {

    /* Apply safe area insets globally */
    body {
        padding-left: var(--safe-area-inset-left);
        padding-right: var(--safe-area-inset-right);
    }

    /* Ensure touch targets are 44px minimum */
    .btn,
    .nav-link,
    a[href^="tel"],
    a[href^="mailto"],
    .whatsapp-float {
        min-height: 44px;
        min-width: 44px;
    }

    /* Better spacing on mobile */
    .hero-ctas {
        gap: 2rem;
    }

    .bento-grid {
        gap: 2rem;
    }

    .nav-menu li {
        padding: 1rem 0;
    }

    /* Remove max-width on mobile */
    p,
    li {
        max-width: 100%;
    }

    /* Reduce motion for better mobile performance */
    .floating-card {
        display: none !important;
    }

    /* CRITICAL FIX: Prevent content cutoff on curved displays */
    .hero-stats-container {
        padding-left: max(1rem, var(--safe-area-inset-left));
        padding-right: max(1rem, var(--safe-area-inset-right));
        margin-left: 0;
        margin-right: 0;
    }

    .container {
        padding-left: max(1rem, var(--safe-area-inset-left));
        padding-right: max(1rem, var(--safe-area-inset-right));
    }
}