@import '../../utils/shared-styles.scss';

/* ===== ENHANCED SERVICES SECTION ===== */
.services-overview {
    position: relative;
    padding: 1.5rem 0;
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #f0f4ff 100%);
    min-height: 100vh;

    @media (min-width: 768px) {
        padding: clamp(2rem, 4vw, 4rem) 0;
    }

    // Animierte Hintergrund-Ebenen
    &::before {
        content: '';
        position: absolute;
        inset: -50%;
        background:
            radial-gradient(circle at 20% 30%, rgba(37, 99, 235, 0.08) 0%, transparent 50%),
            radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
            radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.04) 0%, transparent 60%);
        animation: servicesGradientRotate 25s ease-in-out infinite;
        pointer-events: none;
    }

    // Floating Blur Orbs
    &::after {
        content: '';
        position: absolute;
        inset: 0;
        background-image:
            radial-gradient(circle at 15% 15%, rgba(37, 99, 235, 0.3) 0%, transparent 35%),
            radial-gradient(circle at 85% 85%, rgba(147, 51, 234, 0.25) 0%, transparent 35%);
        filter: blur(60px);
        opacity: 0.5;
        animation: orbsPulse 12s ease-in-out infinite;
        pointer-events: none;
    }

    // Glassmorphism Grid Pattern
    .glass-grid {
        position: absolute;
        inset: 0;
        background-image:
            linear-gradient(rgba(37, 99, 235, 0.03) 1px, transparent 1px),
            linear-gradient(90deg, rgba(37, 99, 235, 0.03) 1px, transparent 1px);
        background-size: 50px 50px;
        animation: gridMove 20s linear infinite;
        pointer-events: none;
    }

    // Floating Particles
    .service-particles {
        position: absolute;
        inset: 0;
        pointer-events: none;

        .particle {
            position: absolute;
            width: 3px;
            height: 3px;
            background: linear-gradient(135deg, #2563eb, #3b82f6);
            border-radius: 50%;
            opacity: 0;
            animation: serviceParticle 15s linear infinite;

            @for $i from 1 through 15 {
                &:nth-child(#{$i}) {
                    left: random(100) * 1%;
                    top: -10%;
                    animation-delay: random(15) * 1s;
                    animation-duration: (10 + random(10)) * 1s;
                }
            }
        }
    }
}

.container {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;

    @media (max-width: 640px) {
        padding-right: 12px;
        padding-left: 12px;
    }
}

/* ===== HERO SECTION ===== */
.services-hero {
    text-align: center;
    margin-bottom: 1.5rem;
    margin-left: 1rem;
    margin-right: 1rem;
    animation: heroFadeIn 1s ease-out;
    position: relative;

    @media (min-width: 768px) {
        margin-bottom: clamp(2rem, 5vw, 3rem);
        margin-left: clamp(1rem, 4vw, 2rem);
        margin-right: clamp(1rem, 4vw, 2rem);
    }

    h1 {
        font-size: 1.5rem;
        font-weight: 900;
        margin: 0 0 .5rem;
        background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #6366f1 100%);
        background-size: 200% 200%;
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        line-height: 1.2;
        animation: gradientText 4s ease-in-out infinite;
        position: relative;

        @media (min-width: 768px) {
            font-size: clamp(1.75rem, 6vw, 3rem);
        }

        // Glow Effect
        &::after {
            content: attr(data-text);
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            z-index: -1;
            filter: blur(20px);
            opacity: 0.3;
            background: linear-gradient(135deg, #2563eb, #3b82f6);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
        }
    }

    .services-subtitle {
        font-size: .9rem;
        color: $color-text-secondary;
        margin: 0;
        line-height: 1.4;
        animation: slideUp 0.8s ease-out 0.2s backwards;
        position: relative;

        @media (min-width: 768px) {
            font-size: clamp(1rem, 3.2vw, 1.125rem);
        }
    }
}

/* ===== SERVICE GRID ===== */
.services-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: stretch;
    margin-bottom: 1.5rem;
    position: relative;

    @media (min-width: 641px) {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: clamp(1rem, 3.5vw, 2rem);
        margin-bottom: clamp(2rem, 5vw, 4rem);
    }
}

/* ===== SERVICE CARD ===== */
.service-card {
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(153, 153, 153, 0.5);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.04),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    overflow: hidden;
    animation: cardFadeIn 0.8s ease-out backwards;

    @media (min-width: 641px) {
        padding: clamp(1.25rem, 3.5vw, 2rem);
        min-height: 400px;
        border-radius: 24px;
    }

    @for $i from 1 through 3 {
        &:nth-child(#{$i}) {
            animation-delay: #{$i * 0.1}s;
        }
    }

    // Glassmorphism overlay
    &::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg,
                rgba(37, 99, 235, 0.03) 0%,
                transparent 40%,
                transparent 60%,
                rgba(147, 51, 234, 0.03) 100%);
        opacity: 0;
        transition: opacity 0.4s ease;
        pointer-events: none;
    }

    // Animated border gradient
    &::after {
        content: '';
        position: absolute;
        inset: -2px;
        background: linear-gradient(45deg,
                #2563eb,
                #3b82f6,
                #6366f1,
                #8b5cf6,
                #2563eb);
        border-radius: 24px;
        opacity: 0;
        z-index: -1;
        transition: opacity 0.4s ease;
    }

    &:hover {
        transform: translateY(-8px) scale(1.02);
        box-shadow:
            0 20px 40px rgba(0, 0, 0, 0.12),
            0 0 0 1px rgba(37, 99, 235, 0.2),
            inset 0 0 0 1px rgba(255, 255, 255, 0.8);
        border-color: transparent;
        background: rgba(255, 255, 255, 0.98);

        @media (min-width: 769px) {
            transform: translateY(-12px) scale(1.02);
            box-shadow:
                0 30px 60px rgba(0, 0, 0, 0.15),
                0 0 0 1px rgba(37, 99, 235, 0.3),
                inset 0 0 0 1px rgba(255, 255, 255, 1);
        }

        &::before {
            opacity: 1;
        }

        &::after {
            opacity: 0.1;
        }

        .card-icon {
            transform: scale(1.1) rotate(5deg);
            box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);

            .icon-emoji {
                animation: emojiPulse 0.5s ease;
            }
        }

        .card-badge {
            animation: badgeBounce 0.5s ease;
        }
    }

    // Featured card special styles
    &.featured {
        border-color: rgba(59, 130, 246, 0.3);
        border-width: 3px;
        background: linear-gradient(135deg,
                rgba(255, 255, 255, 0.95),
                rgba(237, 242, 255, 0.95));
        box-shadow:
            0 8px 32px rgba(37, 99, 235, 0.12),
            inset 0 0 0 1px rgba(255, 255, 255, 0.8);
        position: relative;

        @media (min-width: 641px) {
            box-shadow:
                0 16px 48px rgba(37, 99, 235, 0.15),
                inset 0 0 0 1px rgba(255, 255, 255, 0.9);
        }

        // Glow effect for featured
        &::before {
            background: radial-gradient(circle at center,
                    rgba(37, 99, 235, 0.1) 0%,
                    transparent 70%);
            opacity: 1;
            animation: featuredGlow 3s ease-in-out infinite;
        }

        .card-icon {
            background: linear-gradient(135deg, #2563eb, #3b82f6);
            box-shadow:
                0 6px 20px rgba(37, 99, 235, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
            position: relative;

            @media (min-width: 641px) {
                box-shadow:
                    0 10px 30px rgba(37, 99, 235, 0.3),
                    inset 0 1px 0 rgba(255, 255, 255, 0.3);
            }

            &::after {
                content: '';
                position: absolute;
                inset: -4px;
                background: linear-gradient(135deg, #2563eb, #3b82f6);
                border-radius: inherit;
                opacity: 0;
                filter: blur(8px);
                animation: iconPulse 2s ease-in-out infinite;
            }

            .icon-emoji {
                filter: drop-shadow(0 2px 8px rgba(255, 255, 255, 0.3));
            }
        }
    }
}

.card-badge {
    position: static;
    align-self: flex-start;
    margin-bottom: .5rem;
    padding: .3rem .6rem;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 800;
    box-shadow:
        0 4px 12px rgba(37, 99, 235, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    white-space: nowrap;
    z-index: 1;
    position: relative;
    overflow: hidden;

    @media (min-width: 421px) {
        position: absolute;
        top: 1rem;
        right: 1rem;
        font-size: .78rem;
        padding: .4rem .8rem;
        margin-bottom: 0;
    }

    &::before {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: linear-gradient(45deg,
                transparent,
                rgba(255, 255, 255, 0.2),
                transparent);
        animation: badgeShimmer 3s ease-in-out infinite;
    }
}

.card-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(59, 130, 246, 0.1));
    border-radius: 14px;
    display: grid;
    place-items: center;
    margin-bottom: .75rem;
    transition: all 0.3s ease;
    position: relative;

    @media (min-width: 641px) {
        width: clamp(64px, 12vw, 80px);
        height: clamp(64px, 12vw, 80px);
        border-radius: 20px;
        margin-bottom: 1.25rem;
    }

    .icon-emoji {
        font-size: 1.75rem;
        position: relative;
        z-index: 1;

        @media (min-width: 641px) {
            font-size: clamp(2rem, 7vw, 2.5rem);
        }
    }
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: .625rem;
    flex: 1;
    position: relative;
    z-index: 1;
}

.card-header {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    margin-bottom: .25rem;

    @media (min-width: 641px) {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        gap: .75rem;
        margin-bottom: .5rem;
    }

    h3 {
        font-size: 1.15rem;
        font-weight: 800;
        color: $color-text-primary;
        margin: 0;
        overflow-wrap: anywhere;
        line-height: 1.25;
        transition: color 0.3s ease;

        @media (min-width: 641px) {
            font-size: clamp(1.25rem, 4.6vw, 1.5rem);
            line-height: 1.3;
        }
    }

    .card-price {
        display: inline-flex;
        align-items: center;
        align-self: flex-start;
        background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(59, 130, 246, 0.1));
        color: #2563eb;
        padding: .35rem .6rem;
        border-radius: 999px;
        font-size: .8rem;
        font-weight: 800;
        border: 1px solid rgba(37, 99, 235, 0.2);
        white-space: nowrap;
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;

        @media (min-width: 641px) {
            align-self: auto;
            font-size: .875rem;
            padding: .45rem .75rem;
        }

        &::before {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(135deg, #2563eb, #3b82f6);
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .service-card:hover & {
            transform: scale(1.05);
            box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
        }
    }
}

.card-features {
    list-style: none;
    padding: 0;
    margin: 0 0 .75rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;

    @media (min-width: 641px) {
        gap: .625rem;
        margin: 0 0 1rem;
    }

    li {
        display: grid;
        grid-template-columns: 20px 1fr;
        align-items: start;
        gap: .5rem;
        color: $color-text-secondary;
        font-size: .85rem;
        line-height: 1.4;
        transition: all 0.3s ease;
        position: relative;

        @media (min-width: 641px) {
            grid-template-columns: 24px 1fr;
            gap: .625rem;
            font-size: clamp(.9rem, 2.5vw, .9375rem);
            line-height: 1.5;
        }

        &::before {
            content: '';
            position: absolute;
            left: -8px;
            right: -8px;
            top: 50%;
            transform: translateY(-50%);
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.05), transparent);
            opacity: 0;
            transition: opacity 0.3s ease;
            border-radius: 8px;
        }

        .service-card:hover & {
            transform: translateX(4px);

            &::before {
                opacity: 1;
            }
        }

        .material-symbols-outlined {
            color: #10b981;
            font-size: 20px;
            margin-top: .075rem;
            filter: drop-shadow(0 2px 4px rgba(16, 185, 129, 0.2));
            transition: all 0.3s ease;

            @media (min-width: 641px) {
                font-size: 22px;
                margin-top: .125rem;
            }
        }

        .service-card:hover & .material-symbols-outlined {
            animation: checkPop 0.5s ease;
        }
    }
}

/* ===== CTA SECTION ===== */
.services-cta {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(37, 99, 235, 0.15);
    border-radius: 16px;
    padding: 1.25rem 1rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.06),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    animation: ctaFadeIn 1s ease-out 0.5s backwards;

    @media (min-width: 641px) {
        padding: clamp(1.5rem, 3.5vw, 2.5rem);
        border-radius: 24px;
        margin-bottom: clamp(2rem, 5vw, 4rem);
    }

    // Animated gradient background
    &::before {
        content: '';
        position: absolute;
        inset: -50%;
        background: radial-gradient(circle at 30% 50%,
                rgba(37, 99, 235, 0.1) 0%,
                transparent 40%);
        animation: ctaGradientRotate 15s ease-in-out infinite;
        pointer-events: none;
    }

    &:hover {
        transform: translateY(-2px);
        box-shadow:
            0 16px 48px rgba(0, 0, 0, 0.08),
            inset 0 0 0 1px rgba(255, 255, 255, 0.8);
        border-color: rgba(37, 99, 235, 0.25);
    }
}

.cta-actions {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-top: 1rem;
}

.cta-alternative {
    font-size: .875rem;
    color: $color-text-secondary;
    margin: 0;
    margin-top: 20px;
    line-height: 1.4;

    @media (min-width: 641px) {
        font-size: 1rem;
    }

    a {
        color: #2563eb;
        font-weight: 600;
        text-decoration: underline;
        transition: color 0.3s ease;
        cursor: pointer;

        &:hover {
            color: #1e40af;
        }
    }
}

.cta-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 1rem;
    gap: .75rem;
    position: relative;
    z-index: 1;

    @media (min-width: 768px) {
        flex-direction: row;
        text-align: left;
        margin-bottom: clamp(1.25rem, 3vw, 2rem);
        gap: 1rem;
    }
}

.cta-icon {
    flex-shrink: 0;
    position: relative;

    .material-symbols-outlined {
        font-size: 36px;
        color: #2563eb;
        filter: drop-shadow(0 4px 12px rgba(37, 99, 235, 0.2));
        animation: iconFloat 3s ease-in-out infinite;

        @media (min-width: 768px) {
            font-size: clamp(40px, 8vw, 56px);
        }
    }
}

/* ===== TRUST SECTION ===== */
.trust-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem;
    animation: trustFadeIn 1s ease-out 0.7s backwards;
    position: relative;

    @media (min-width: 641px) {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 1rem;
    }
}

.trust-item {
    display: flex;
    gap: .75rem;
    padding: .95rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(226, 232, 240, 0.5);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;

    @media (min-width: 641px) {
        padding: 1.25rem;
        gap: 1rem;
        border-radius: 16px;
        box-shadow:
            0 4px 16px rgba(0, 0, 0, 0.05),
            inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    }

    &::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg,
                transparent,
                rgba(37, 99, 235, 0.05),
                transparent);
        transform: translateX(-100%);
        transition: transform 0.5s ease;
    }

    &:hover {
        transform: translateY(-4px) scale(1.02);
        box-shadow:
            0 12px 32px rgba(0, 0, 0, 0.08),
            inset 0 0 0 1px rgba(37, 99, 235, 0.3);
        border-color: rgba(37, 99, 235, 0.2);
        background: rgba(255, 255, 255, 0.95);

        &::before {
            transform: translateX(0);
        }

        .material-symbols-outlined {
            animation: iconBounce 0.5s ease;
        }
    }

    .material-symbols-outlined {
        font-size: 24px;
        color: #2563eb;
        flex-shrink: 0;
        filter: drop-shadow(0 2px 8px rgba(37, 99, 235, 0.2));

        @media (min-width: 641px) {
            font-size: 32px;
        }
    }
}

/* ===== ANIMATIONS ===== */
@keyframes servicesGradientRotate {

    0%,
    100% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.2);
    }
}

@keyframes orbsPulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 0.3;
        transform: scale(1.1);
    }
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(50px, 50px);
    }
}

@keyframes serviceParticle {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes gradientText {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

@keyframes featuredGlow {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

@keyframes iconPulse {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes emojiPulse {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.2) rotate(10deg);
    }
}

@keyframes badgeBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

@keyframes badgeShimmer {
    from {
        transform: rotate(25deg) translateX(-100%);
    }

    to {
        transform: rotate(25deg) translateX(100%);
    }
}

@keyframes checkPop {

    0%,
    100% {
        transform: scale(1);
        color: #10b981;
    }

    50% {
        transform: scale(1.3);
        color: #34d399;
    }
}


@keyframes arrowSlide {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(4px);
    }
}

@keyframes ctaFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ctaGradientRotate {

    0%,
    100% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.1);
    }
}

@keyframes iconFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes trustFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes iconBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

/* ===== END OF SERVICES COMPONENT STYLES ===== */


/* === PERFORMANCE MODE: Mobile & Reduce Motion === */
@media (max-width: 640px),
(prefers-reduced-motion: reduce) {

    /* 1) Alle Dauer-Animationen/Transitions aus */
    * {
        animation: none !important;
        transition: none !important;
    }

    /* 2) Teure Hintergrundebenen aus */
    .services-overview::before,
    .services-overview::after,
    .services-overview .glass-grid,
    .services-overview .service-particles {
        display: none !important;
    }

    /* 3) Backdrop-Filter/Blur reduzieren oder entfernen */
    .service-card,
    .services-cta,
    .trust-item {
        backdrop-filter: none !important;
        background: #fff !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, .04) !important;
    }

    /* 4) Hover-Styles neutralisieren (auf Mobile eh unnötig) */
    .service-card:hover {
        transform: none !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, .04) !important;
    }

    /* 5) „Featured“-Glows & Card-Overlays aus */
    .service-card::before,
    .service-card::after,
    .service-card.featured::before {
        display: none !important;
    }

    /* 6) Buttons simpler machen */
    .btn::before {
        display: none !important;
    }

    .btn {
        box-shadow: none !important;
    }

    /* 7) Weniger Tiefe, kleinere Radien = günstiger */
    .service-card,
    .services-cta {
        border-radius: 12px !important;
    }

    /* 8) Rendering-Hints: nur sichtbare Cards rendern */
    .service-card {
        content-visibility: auto;
        contain: layout paint style;
    }


    /* 10) Kleine Feinanpassungen */
    .card-icon {
        background: #f3f6ff !important;
    }
}