/**
 * Services Section - Ultra-Modern Design
 * Styles for the "Our Services" section with interactive glassmorphism cards
 * and advanced visual effects
 * @author Naery Web Development
 * @version 2.0
 */

/*--------------------------------------------------
 # Services Section Styles
--------------------------------------------------*/

/*--------------------------------------------------
 # Services Section Container
--------------------------------------------------*/
.services {
    padding: 80px 0 200px 0;
    background-color: #fff;
    color: #333;
    position: relative;
    overflow: hidden;
}

/* Decorative background pattern */
.services::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-image: none;
    pointer-events: none;
    z-index: 0;
}


/* ============= SERVICES CONTAINERS ============= */
/* Main services container */
.services-modern-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Services cards grid layout */
.services-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    position: relative;
    z-index: 5;
}

/* ============= SERVICE CARDS ============= */
/* Individual service card styling */
.service-card {
    position: relative;
    height: 380px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.5s cubic-bezier(0.215, 0.61, 0.355, 1);
    transform-style: preserve-3d;
    perspective: 1000px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Service-specific background gradient colors */
.service-card[data-service="web-dev"] .card-gradient {
    background: linear-gradient(135deg, rgba(32, 124, 229, 0.7), rgba(23, 43, 77, 0.7)); /* Blue */
}

.service-card[data-service="automation"] .card-gradient {
    background: linear-gradient(135deg, rgba(69, 39, 160, 0.7), rgba(123, 31, 162, 0.7)); /* Purple */
}

.service-card[data-service="project-management"] .card-gradient {
    background: linear-gradient(135deg, rgba(249, 193, 7, 0.7), rgba(191, 146, 0, 0.7)); /* Yellow */
}

/* ============= CARD BACKGROUND IMAGE ============= */
/* Card background image behind the gradient */
.card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../../assets/backgrounds/background_cartes.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.95; /* Slightly reduced to blend better with gradient */
    z-index: 1;
    clip-path: polygon(0% 0%, 100% 0%, 100% 36.45%, 0% 61.41%); /* Same diagonal shape as gradient */
    transition: all 0.35s cubic-bezier(0.215, 0.61, 0.355, 1); /* Exact same transition as gradient */
    /* Performance optimization */
    will-change: transform, clip-path;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* 
* Service-specific background positions and sizing
* To adjust what is visible in the card:
* - background-position: adjusts the visible part of the image (x% y%) 
* - background-size: controls the size (cover displays the entire area but may crop the image)
* - transform: translate(x, y) can also shift the image if needed
*/
.service-card[data-service="web-dev"] .card-bg {
    /* Position to the left slightly shifted upwards to show more elements */
    background-position: 20% 30%;
    background-size: 120%; /* Slightly zoomed to highlight certain elements */
}

.service-card[data-service="automation"] .card-bg {
    /* Horizontally centered position, slightly upwards */
    background-position: 50% 40%;
    background-size: cover;
    /* Slightly shift the image to the left and down */
    /* transform: translate(-5px, 5px); */
}

.service-card[data-service="project-management"] .card-bg {
    /* Position more to the right to show other background elements */
    background-position: 80% 35%;
    background-size: 110%;
}

/* ============= CARD VISUAL EFFECTS ============= */
/* Card background gradient */
.card-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.88; /* Slightly higher to ensure good blend with image */
    clip-path: polygon(0% 0%, 100% 0%, 100% 36.45%, 0% 61.41%); /* Diagonal shape covering about 1/3 of the card */
    transition: all 0.35s cubic-bezier(0.215, 0.61, 0.355, 1); /* Synchronized with background transition */
    z-index: 2;
}

/* Glassmorphism blur effect */
.card-blur {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 0;
}

/* Card glow effect */
.card-glow {
    position: absolute;
    content: '';
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.2), transparent 60%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 1;
}

/* ============= CARD CONTENT STRUCTURE ============= */
/* Card content container */
.card-content {
    position: relative;
    padding: 30px;
    height: 100%;
    display: flex;
    flex-direction: column;
    z-index: 3; /* Increased to be above both background and gradient */
    transition: transform 0.5s ease;
}

/* Title container - aligns icon and heading */
.title-container {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 20px;
    left: 0;
    right: 0;
    z-index: 3;
}

/* ============= SERVICE ICONS ============= */
/* Service icon styling */
.service-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 3;
    margin-right: 10px;
}

/* SVG icons within service icons */
.service-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
    transition: all 0.3s ease;
}

/* Service-specific icon size adjustments */
.dev-icon {
    transform: scale(0.9);
}

.auto-icon {
    transform: scale(0.85);
}

.project-icon {
    transform: scale(0.85);
}

/* ============= CARD TITLES & DESCRIPTIONS ============= */
/* Service title styling */
.service-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 2;
    margin: 0;
    padding: 0;
}

/* Service description container */
.service-description {
    position: absolute;
    width: 100%;
    z-index: 2;
}

/* First part of the description (on colored gradient background) */
.service-brief-top {
    position: absolute;
    top: 134px;
    left: 0;
    right: 41px;
    padding: 0 20px;
    margin: 0;
    text-align: center;
    color: white;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    z-index: 2;
    transform: rotate(-14deg) translateY(-10px);
}

/* Second part of the description (below the diagonal) */
.service-brief-bottom {
    position: absolute;
    top: 163px;
    left: 7px;
    right: 41px;
    padding: 0 20px;
    margin: 0;
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.6;
    letter-spacing: 0.3px;
    z-index: 2;
    transform: rotate(-14deg) translateY(-10px);
}

/* ============= SERVICE-SPECIFIC COLORS ============= */
/* Service-specific colors for bottom description text */
.service-card[data-service="web-dev"] .service-brief-bottom {
    color: #195089; /* Deeper blue for better harmony with the card */
}

.service-card[data-service="automation"] .service-brief-bottom {
    color: rgba(69, 39, 160, 1); /* Purple */
}

.service-card[data-service="project-management"] .service-brief-bottom {
    color: rgba(249, 193, 7, 1); /* Yellow */
}

/* ============= CARD DETAILS ============= */
/* Service details (visible only on hover) */
.card-details {
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    transform: translateY(20px);
    height: 0;
    overflow: hidden;
    color: white;
    position: absolute;
    top: 85px; /* Remonte un peu le bloc de détails */
    left: 0;
    right: 0;
    padding: 16px 30px 0 30px; /* Réduit le padding-top */
    text-align: center;
}

/* Card details content styling */
.card-details p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Card details list styling */
.card-details ul {
    list-style-type: none;
    padding-left: 0;
    margin-top: 20px;
    text-align: left;
    display: inline-block;
}

.card-details li {
    color: white;
    margin-bottom: 8px;
    position: relative;
    padding-left: 24px; /* Décale le texte pour la puce */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    line-height: 1.8;
}

/* Custom bullet points for list items */
.card-details li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: white;
}

/* ============= READ MORE BUTTON ============= */
/* 'Read more' button - Modern design */
.more-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    left: auto;
    transform: none;
    display: flex;
    align-items: center;
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 10;
    overflow: hidden;
}

/* Service-specific button colors */
.service-card[data-service="web-dev"] .more-btn {
    color: #195089; /* Deeper blue for better harmony with the card */
}

.service-card[data-service="automation"] .more-btn {
    color: rgba(69, 39, 160, 1); /* Purple */
}

.service-card[data-service="project-management"] .more-btn {
    color: rgba(249, 193, 7, 1); /* Yellow */
}

/* Button circle container */
.circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    margin-right: 10px;
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Service-specific circle background colors */
.service-card[data-service="web-dev"] .circle {
    background-color: rgba(32, 124, 229, 0.15); /* Blue */
}

.service-card[data-service="automation"] .circle {
    background-color: rgba(69, 39, 160, 0.15); /* Purple */
}

.service-card[data-service="project-management"] .circle {
    background-color: rgba(249, 193, 7, 0.15); /* Yellow */
}

/* ============= MODERN ARROW ICON ============= */
/* Modern and elegant arrow base */
.icon {
    position: relative;
    width: 10px;
    height: 1px;
    background-color: transparent !important;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Arrow pseudo-elements (lines) */
.icon.arrow::before,
.icon.arrow::after {
    content: '';
    position: absolute;
    background-color: currentColor;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Top arrow line (rotated 45 degrees) */
.icon.arrow::before {
    top: -3px;
    right: -2px;
    width: 8px;
    height: 1.5px;
    transform: rotate(45deg);
}

/* Bottom arrow line (rotated -45 degrees) */
.icon.arrow::after {
    bottom: -3px;
    right: -2px;
    width: 8px;
    height: 1.5px;
    transform: rotate(-45deg);
}

/* Service-specific circle text colors */
.service-card[data-service="web-dev"] .circle {
    color: #195089; /* Deeper blue for better harmony with the card */
}

.service-card[data-service="automation"] .circle {
    color: rgba(69, 39, 160, 1); /* Purple */
}

.service-card[data-service="project-management"] .circle {
    color: rgba(249, 193, 7, 1); /* Yellow */
}

/* Button icon hover effects */
.more-btn:hover .icon.arrow::before,
.more-btn:hover .icon.arrow::after {
    right: -4px; /* Arrow movement on hover */
}

/* Button text styling */
.btn-text {
    position: relative;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), color 0.3s;
    white-space: nowrap;
    font-family: 'Nunito Sans', sans-serif;
}

/* Soulignement moderne animé pour le bouton */
.btn-text::after {
    content: '';
    display: block;
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 0;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover d'une carte : texte blanc + trait animé */
.service-card:hover .more-btn .btn-text {
    color: #fff;
}
.service-card:hover .more-btn .btn-text::after {
    width: 100%;
}

/* Flèche blanche au hover d'une carte */
.service-card:hover .more-btn .icon.arrow {
    color: #fff;
}


/* ============= HOVER EFFECTS ============= */
/* Card hover effect */
.service-card:hover {
    transform: translateY(-8px) rotateX(3deg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Card hover unified effects for background and gradient */
.service-card:hover .card-bg,
.service-card:hover .card-gradient {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); /* Full coverage on hover, exactly synchronized */
}

/* Background specific hover effect */
.service-card:hover .card-bg {
    transform: scale(1.05); /* Reduced zoom for subtler effect */
    opacity: 0.9; /* Maintain visibility under gradient */
}

/* Gradient specific hover effect */
.service-card:hover .card-gradient {
    opacity: 0.92; /* Balanced opacity to blend with background */
}

/* Service icon subtle animation on hover */
.service-card:hover .service-icon {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Button hover animations */
.more-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Circle scale effect on hover */
.more-btn:hover .circle {
    transform: scale(1.1);
}

/* Button text movement on hover */
.more-btn:hover .btn-text {
    transform: translateX(3px);
}

.service-card:hover .service-brief-top,
.service-card:hover .service-brief-bottom {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.service-card:hover .card-blur {
    opacity: 1;
}

.service-card:hover .card-glow {
    opacity: 0.8;
}

.service-card:hover .service-icon {
    transform: translateY(-5px);
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.25);
}

.service-card:hover .service-brief {
    opacity: 0;
}

.service-card:hover .card-details {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    height: auto;
    margin-bottom: 20px;
}

.service-card:hover .more-btn .circle {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateX(5px);
}

/* Suppression des modals de service - Maintenant les boutons "En savoir plus" mènent à la section contact */

/* ============= ANIMATIONS KEYFRAMES ============= */
/* Fade up animation for element entrance */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation entrée depuis la gauche - plus prononcée */
@keyframes fromLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animation entrée depuis le haut - plus prononcée */
@keyframes fromTop {
    from {
        opacity: 0;
        transform: translateY(-100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation entrée depuis le bas - plus prononcée */
@keyframes fromBottom {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation entrée depuis la droite - plus prononcée */
@keyframes fromRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Light sweep effect for cards */
@keyframes lightSweep {
    0% {
        transform: translateX(-100%) skewX(-20deg);
        opacity: 0;
    }
    10% {
        opacity: 0.5;
    }
    20% {
        opacity: 0;
    }
    100% {
        transform: translateX(100%) skewX(-20deg);
    }
}

/* Floating animation for service icons */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
}

/* ============= ANIMATION APPLICATIONS ============= */
/* Floating effect on service icons */
.service-icon {
    animation: float 5s ease-in-out infinite;
}

/* Light sweep effect on cards - setup */
.service-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transform: translateX(-100%) skewX(-20deg);
    opacity: 0;
    pointer-events: none;
    z-index: 5;
}

/* Apply light sweep animation on hover */
.service-card:hover::after {
    animation: lightSweep 3s ease-in-out;
}

/* ============= RESPONSIVE STYLES ============= */
/* Large tablets and small desktops (max-width: 1100px) */
@media (max-width: 1100px) {
    /* Adjust card grid for smaller screens */
    .services-cards {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    /* Increase card height for better content visibility */
    .service-card {
        height: 400px;
    }
    
    /* Stack modal content vertically */
    .detail-content {
        flex-direction: column;
    }
    
    /* Full-width image in modal for small screens */
    .detail-image {
        max-width: 100%;
        margin-bottom: 20px;
    }
}

/* Tablets and mobile devices (max-width: 768px) */
@media (max-width: 768px) {
    /* Reduce vertical padding */
    .services {
        padding: 60px 0 80px 0;
    }
    
    /* Smaller section title */
    .services .section-title h2 {
        font-size: 2rem;
    }
    
    /* Auto-height cards with minimum height */
    .service-card {
        height: auto;
        min-height: 350px;
    }
    
    /* Smaller card titles */
    .service-card h3 {
        font-size: 1.3rem;
    }
    
    /* Ensure details are properly displayed */
    .service-card:hover .card-details {
        height: auto;
    }
    
    /* Single column features grid */
    .detail-features {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .services {
        padding: 40px 0 60px 0;
    }
    
    .services .section-title h2 {
        font-size: 1.8rem;
    }
    
    .service-card {
        min-height: 330px;
    }
    
    .service-icon {
        width: 60px;
        height: 60px;
    }
    
    .service-card h3 {
        font-size: 1.2rem;
    }
    
    .detail-header h3 {
        font-size: 1.4rem;
    }
    
    .detail-content {
        padding: 20px;
    }
}
