/* ===============================
   SERVICES SECTION
   =============================== */
.services-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    position: relative;
    overflow: hidden;
}

/* Section Header */
.section-title {
    font-size: clamp(32px, 4vw, 42px);
    font-weight: 800;
    color: var(--primary-blue, #0d2d45);
    margin-bottom: 15px;
    letter-spacing: -0.5px;
}

.section-subtitle {
    font-size: clamp(16px, 2vw, 18px);
    color: #6c757d;
    max-width: 600px;
    margin: 0 auto;
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Card Wrapper */
.service-card-wrapper {
    display: flex;
}

/* Service Card */
.service-card {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-blue, #0d2d45), #1e5a7d);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.service-card-wrapper:hover .service-card::before {
    transform: scaleX(1);
}

.service-card-wrapper:hover .service-card {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

/* Image Container */
.service-image-container {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.service-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.service-card-wrapper:hover .service-image {
    transform: scale(1.1);
}

.service-card-wrapper:hover .service-image-overlay {
    opacity: 1;
}

/* Icon Placeholder */
.service-icon-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-blue, #0d2d45) 0%, #1e5a7d 100%);
}

.service-icon-placeholder i {
    font-size: 60px;
    color: rgba(255, 255, 255, 0.9);
    transition: transform 0.4s ease;
}

.service-card-wrapper:hover .service-icon-placeholder i {
    transform: scale(1.15) rotate(5deg);
}

/* Content */
.service-content {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.service-title {
    font-size: 20px;
    font-weight: 700;
    color: #212529;
    margin-bottom: 12px;
    line-height: 1.3;
    min-height: 52px;
}

.service-description {
    font-size: 14px;
    line-height: 1.6;
    color: #6c757d;
    margin-bottom: 20px;
    flex: 1;
    min-height: 60px;
}

/* Service Button - Matching Hero Style */
.service-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    background: var(--primary-blue, #0d2d45);
    border-radius: 50px;
    text-decoration: none;
    border: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 20px rgba(13, 45, 69, 0.25);
    position: relative;
    overflow: hidden;
    margin-top: auto;
}

.service-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.service-btn:hover::before {
    width: 300px;
    height: 300px;
}

.service-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 30px rgba(13, 45, 69, 0.35);
    color: #ffffff;
}

.service-btn i {
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
    font-size: 14px;
}

.service-btn:hover i {
    transform: translateX(4px);
}

.service-btn span {
    position: relative;
    z-index: 1;
}

/* ===============================
   HANDLE 5 CARDS LAYOUT (3-2)
   =============================== */
@media (min-width: 992px) {
    /* When there are exactly 5 cards, center the last 2 */
    .services-grid:has(.service-card-wrapper:nth-child(5):last-child) {
        grid-template-columns: repeat(6, 1fr);
    }
    
    /* First 3 cards take 2 columns each (spanning full width) */
    .services-grid:has(.service-card-wrapper:nth-child(5):last-child) 
    .service-card-wrapper:nth-child(1),
    .services-grid:has(.service-card-wrapper:nth-child(5):last-child) 
    .service-card-wrapper:nth-child(2),
    .services-grid:has(.service-card-wrapper:nth-child(5):last-child) 
    .service-card-wrapper:nth-child(3) {
        grid-column: span 2;
    }
    
    /* 4th card starts at column 2 (leaving 1 column gap on left) */
    .services-grid:has(.service-card-wrapper:nth-child(5):last-child) 
    .service-card-wrapper:nth-child(4) {
        grid-column: 2 / span 2;
    }
    
    /* 5th card takes columns 4-5 */
    .services-grid:has(.service-card-wrapper:nth-child(5):last-child) 
    .service-card-wrapper:nth-child(5) {
        grid-column: 4 / span 2;
    }
}

/* ===============================
   RESPONSIVE DESIGN
   =============================== */

/* Tablets - 2 columns */
@media (min-width: 768px) and (max-width: 991px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 25px;
    }
    
    .service-card-wrapper {
        grid-column: auto !important;
    }
    
    /* Center last card if odd number */
    .services-grid:has(.service-card-wrapper:nth-child(odd):last-child) 
    .service-card-wrapper:last-child {
        grid-column: 1 / -1;
        max-width: 50%;
        margin: 0 auto;
    }
    
    .service-image-container {
        height: 160px;
    }
}

/* Mobile - 1 column */
@media (max-width: 767px) {
    .services-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    
    .service-card-wrapper {
        grid-column: auto !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    .service-image-container {
        height: 200px;
    }
    
    .service-content {
        padding: 20px;
    }
    
    .service-title {
        font-size: 18px;
        min-height: auto;
    }
    
    .service-description {
        font-size: 14px;
        min-height: auto;
    }
    
    .service-btn {
        width: 100%;
        padding: 14px 28px;
    }
}

/* Extra small screens */
@media (max-width: 576px) {
    .section-title {
        font-size: 28px;
    }
    
    .section-subtitle {
        font-size: 16px;
    }
    
    .service-image-container {
        height: 180px;
    }
}