/* Expandable Service Card Styles */
.expandable-card {
    position: relative;
    overflow: visible !important;
    cursor: pointer;
    z-index: 1;
    height: 400px; /* Fixed height for uniformity - match index.html */
    display: flex;
    flex-direction: column;
    width: 100%; /* Full width of grid column */
    touch-action: manipulation; /* Enable native touch feedback */
}

.expandable-card:hover,
.expandable-card.active {
    z-index: 100;
    overflow: visible !important;
}

/* More specific rule to override .service-card overflow */
.service-card.expandable-card {
    overflow: visible !important;
}

.service-card.expandable-card:hover,
.service-card.expandable-card.active {
    overflow: visible !important;
}

.expandable-card .service-details {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(9, 0, 64, 0.95) 0%, rgba(0, 128, 128, 0.85) 100%);
    border-radius: 20px;
    padding: 1.25rem; /* Reduced padding */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 10;
    height: 100%; /* Use percentage to match parent height */
    width: 100%; /* Ensure full width */
    box-sizing: border-box; /* Include padding in width/height calculations */
    transform-origin: center;
    max-height: none !important; /* Override conflicting max-height from style.css */
    overflow: hidden; /* Changed from visible to hidden */
}

.expandable-card:hover .service-details,
.expandable-card.active .service-details {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: none !important; /* Ensure max-height override on hover */
    overflow: visible !important; /* Ensure overflow override on hover */
}

.details-content {
    height: 100%;
    display: block;
    text-align: left;
    padding-bottom: 2.5rem; /* Increased padding to make room for button */
    overflow: hidden;
}

.details-content h4 {
    font-family: 'Panchang', 'Poppins', sans-serif;
    font-size: 1.4rem; /* Match .service-title font size */
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.75rem 0; /* Match .service-title margin */
    line-height: 1.3;
}

.details-content > p {
    font-size: 0.95rem; /* Match .service-description font size */
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5; /* Match .service-description line-height */
    margin-bottom: 1rem; /* Match .service-description margin-bottom */
    flex-grow: 0;
    flex-shrink: 0;
}

.service-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem; /* Match .feature-item font size from style.css */
    color: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 0;
}

.feature-item i {
    color: #00ffff;
    font-size: 1rem; /* Match .feature-item i font size from style.css */
    width: 24px; /* Match .feature-item i width from style.css */
    text-align: center;
    flex-shrink: 0;
}

.service-cta {
    position: absolute;
    bottom: 1rem;
    left: 1.25rem;
    right: 1.25rem;
    padding-top: 0.75rem;
}

.service-btn {
    background: linear-gradient(135deg, #090040, #0d0060, #090040);
    background-size: 200% 200%;
    border: none;
    border-radius: 50px;
    padding: 0.7rem 1.25rem; /* Reduced padding */
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem; /* Reduced font size */
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 4px 15px rgba(9, 0, 64, 0.3),
        0 0 15px rgba(9, 0, 64, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    min-height: 44px; /* Minimum touch target size according to WCAG */
    touch-action: manipulation; /* Enable native touch feedback */
}

.service-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.6s ease;
}

.service-btn:hover:before,
.service-btn:focus:before {
    left: 100%;
}

.service-btn:hover,
.service-btn:focus {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 30px rgba(9, 0, 64, 0.6),
        0 0 40px rgba(9, 0, 64, 0.4),
        0 0 20px rgba(13, 0, 96, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    background: linear-gradient(135deg, #0a0048, #1a0080, #0a0048);
    background-size: 200% 200%;
    animation: moveGradient 2s ease infinite, enhancedGlow 2s ease-in-out infinite alternate;
}

.service-btn:active,
.service-btn.btn-pressed {
    transform: translateY(0) scale(0.96);
    box-shadow: 
        0 6px 25px rgba(9, 0, 64, 0.5),
        0 0 30px rgba(9, 0, 64, 0.3),
        0 0 15px rgba(13, 0, 96, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    background: linear-gradient(135deg, #0a0048, #1a0080, #0a0048);
    background-size: 200% 200%;
    animation: moveGradient 2s ease infinite, enhancedGlow 2s ease-in-out infinite alternate;
}

/* Mobile touch feedback */
@media (hover: none) and (pointer: coarse) {
    .service-btn:active {
        transform: translateY(-1px);
        box-shadow: 
            0 6px 25px rgba(9, 0, 64, 0.5),
            0 0 30px rgba(9, 0, 64, 0.3),
            0 0 15px rgba(13, 0, 96, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
        background: linear-gradient(135deg, #0a0048, #1a0080, #0a0048);
        background-size: 200% 200%;
        animation: moveGradient 2s ease infinite, enhancedGlow 2s ease-in-out infinite alternate;
    }
    
    .service-btn:active:before {
        left: 100%;
    }
}

.service-btn:active {
    transform: translateY(0);
}

/* Mobile Touch Support */
@media (hover: none) and (pointer: coarse) {
    .expandable-card:active .service-details {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    .expandable-card.touched .service-details {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    /* Enhanced touch feedback for cards */
    .expandable-card:active {
        transform: translateY(-3px);
    }
}

/* Mobile Responsive Adjustments */
@media (max-width: 1024px) {
    .details-content h4 {
        font-size: 1.4rem;
    }
    
    .details-content > p {
        font-size: 0.95rem;
    }
    
    .service-features {
        gap: 0.5rem;
    }
    
    .feature-item {
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .expandable-card .service-details {
        padding: 1.5rem;
        height: auto; /* Allow flexible height on mobile */
    }
    
    .details-content h4 {
        font-size: 1.3rem;
        margin-bottom: 0.75rem;
    }
    
    .details-content > p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
        line-height: 1.5;
    }
    
    .service-features {
        grid-template-columns: 1fr;
        gap: 0.25rem;
        margin-bottom: 1rem;
    }
    
    .feature-item {
        font-size: 0.8rem;
        padding: 0.25rem 0;
    }
    
    .service-btn {
        padding: 0.7rem 1.25rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .expandable-card .service-details {
        padding: 1.25rem;
        height: auto; /* Allow flexible height on mobile */
    }
    
    .details-content h4 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }
    
    .details-content > p {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
        line-height: 1.5;
    }
    
    .service-features {
        margin-bottom: 0.75rem;
    }
    
    .feature-item {
        font-size: 0.75rem;
        gap: 0.375rem;
    }
    
    .feature-item i {
        font-size: 0.875rem;
        width: 16px;
    }
    
    .service-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
    
    .service-cta {
        padding-top: 0.5rem;
    }
}

/* Animation Performance Optimizations */
@media (prefers-reduced-motion: reduce) {
    .expandable-card .service-details {
        transition: opacity 0.2s ease;
    }
    
    .service-btn:before {
        display: none;
    }
}

/* High DPI Screen Adjustments */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
    .service-btn {
        box-shadow: 
            0 2px 12px rgba(9, 0, 64, 0.4),
            0 0 10px rgba(9, 0, 64, 0.2);
    }
    
    .service-btn:hover {
        box-shadow: 
            0 4px 20px rgba(9, 0, 64, 0.6),
            0 0 25px rgba(9, 0, 64, 0.4),
            0 0 15px rgba(13, 0, 96, 0.3);
    }
}

/* Keyframe Animations */
@keyframes subtleGlow {
    0% {
        box-shadow: 
            0 4px 20px rgba(9, 0, 64, 0.4),
            0 0 20px rgba(9, 0, 64, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    100% {
        box-shadow: 
            0 4px 25px rgba(9, 0, 64, 0.5),
            0 0 30px rgba(9, 0, 64, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }
}

@keyframes enhancedGlow {
    0% {
        box-shadow: 
            0 8px 30px rgba(9, 0, 64, 0.6),
            0 0 40px rgba(9, 0, 64, 0.4),
            0 0 20px rgba(13, 0, 96, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    100% {
        box-shadow: 
            0 8px 40px rgba(9, 0, 64, 0.8),
            0 0 60px rgba(9, 0, 64, 0.6),
            0 0 30px rgba(13, 0, 96, 0.4),
            0 0 10px rgba(26, 0, 128, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.25);
    }
}

@keyframes moveGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}