/* ================================================
   Icons Text Module - Premium Water Fill Animation
   ================================================
   Creative card transformation effect
   Uses theme outline primary colors
   ================================================ */

.icons-text-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
    padding: 1rem 0;
}

.icons-text-card-wrapper {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Base Card */
.icons-text-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 1.25rem 1.75rem;
    background: #fff;
    border-radius: 20px;
    border: 1.5px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    min-height: 220px;
}

.icons-text-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

/* ============================================
   WATER FILL LAYER - Fills entire card
   ============================================ */

.icons-text-card .water-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0%;
    background: linear-gradient(
        180deg,
        var(--color-primary-normal-bg, #2563EB) 0%,
        color-mix(in srgb, var(--color-primary-normal-bg, #2563EB) 90%, #1e40af) 100%
    );
    z-index: 1;
    will-change: height;
    transition: height 0.1s linear;
}

/* Wave effect at the top */
.icons-text-card .water-layer::before {
    content: '';
    position: absolute;
    top: -12px;
    left: -10%;
    right: -10%;
    height: 24px;
    background: 
        radial-gradient(ellipse 50% 100% at 25% 100%, 
            var(--color-primary-normal-bg, #2563EB) 0%, transparent 70%),
        radial-gradient(ellipse 40% 100% at 75% 100%, 
            var(--color-primary-normal-bg, #2563EB) 0%, transparent 70%);
    opacity: 0;
    animation: waveFlow 1.5s ease-in-out infinite;
}

.icons-text-card.active .water-layer::before {
    opacity: 1;
}

@keyframes waveFlow {
    0%, 100% { transform: translateX(-5%); }
    50% { transform: translateX(5%); }
}

/* Rising bubbles */
.icons-text-card .bubble {
    position: absolute;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    z-index: 2;
    opacity: 0;
}

.icons-text-card .bubble-1 { width: 8px; height: 8px; left: 20%; }
.icons-text-card .bubble-2 { width: 5px; height: 5px; left: 50%; }
.icons-text-card .bubble-3 { width: 6px; height: 6px; left: 75%; }

.icons-text-card.active .bubble {
    animation: bubbleUp var(--cycle-duration, 3000ms) ease-out infinite;
}

.icons-text-card.active .bubble-1 { animation-delay: 0s; }
.icons-text-card.active .bubble-2 { animation-delay: 0.4s; }
.icons-text-card.active .bubble-3 { animation-delay: 0.8s; }

@keyframes bubbleUp {
    0% { bottom: 0; opacity: 0; transform: scale(0.5); }
    10% { opacity: 0.8; transform: scale(1); }
    100% { bottom: 100%; opacity: 0; transform: scale(0.3) translateX(10px); }
}

/* Active water animation */
.icons-text-card.active .water-layer {
    animation: waterRise var(--cycle-duration, 3000ms) ease-out forwards;
}

@keyframes waterRise {
    0% { height: 0%; }
    100% { height: 105%; }
}

/* ============================================
   ICON CONTAINER - Outline Primary Style
   ============================================ */

.icons-text-icon {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    z-index: 10;
    border-radius: 50%;
    /* Soft blue backdrop to match water fill theme */
    background: rgba(37, 99, 235, 0.08);
    border: 2px solid rgba(37, 99, 235, 0.2);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.icons-text-icon img {
    width: 36px;
    height: 36px;
    position: relative;
    z-index: 2;
    transition: filter 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Active state - white icon on filled card */
.icons-text-card.active .icons-text-icon {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.icons-text-card.active .icons-text-icon img {
    filter: brightness(0) invert(1);
}

/* ============================================
   CONTENT - Transitions to white on active
   ============================================ */

.icons-text-content {
    position: relative;
    z-index: 10;
}

.icons-text-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-secondary-normal-bg, #1e293b);
    margin-bottom: 0.5rem;
    transition: color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.icons-text-card.active .icons-text-title {
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.icons-text-description {
    font-size: 0.875rem;
    color: #64748B;
    line-height: 1.55;
    transition: color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.icons-text-card.active .icons-text-description {
    color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   ACTIVE CARD BORDER GLOW
   ============================================ */

.icons-text-card.active {
    border-color: transparent;
    box-shadow: 
        0 0 0 2px var(--color-primary-normal-bg, #2563EB),
        0 20px 50px color-mix(in srgb, var(--color-primary-normal-bg, #2563EB) 35%, transparent);
}

/* ============================================
   SHIMMER HIGHLIGHT ON ACTIVE
   ============================================ */

.icons-text-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    z-index: 15;
    opacity: 0;
    transition: opacity 0.3s;
}

.icons-text-card.active::after {
    opacity: 1;
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* ============================================
   DARK MODE
   ============================================ */

.dark .icons-text-card,
[data-theme="dark"] .icons-text-card,
.section--dark .icons-text-card {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.08);
}

.dark .icons-text-title,
[data-theme="dark"] .icons-text-title,
.section--dark .icons-text-title {
    color: #f1f5f9;
}

.dark .icons-text-description,
[data-theme="dark"] .icons-text-description,
.section--dark .icons-text-description {
    color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   RESPONSIVE - Tablet
   ============================================ */

@media (max-width: 1024px) {
    .icons-text-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .icons-text-card {
        min-height: 200px;
        padding: 1.5rem 1rem;
    }
}

/* ============================================
   RESPONSIVE - Mobile
   ============================================ */

@media (max-width: 640px) {
    .icons-text-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .icons-text-card {
        padding: 1.25rem 0.875rem 1rem;
        border-radius: 16px;
        min-height: 180px;
    }
    
    .icons-text-icon {
        width: 64px;
        height: 64px;
        margin-bottom: 1rem;
    }
    
    .icons-text-icon img {
        width: 28px;
        height: 28px;
    }
    
    .icons-text-title {
        font-size: 1rem;
    }
    
    .icons-text-description {
        font-size: 0.8rem;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    /* Simpler animation on mobile */
    .icons-text-card .bubble {
        display: none;
    }
    
    .icons-text-card::after {
        display: none;
    }
}

@media (max-width: 380px) {
    .icons-text-grid {
        grid-template-columns: 1fr;
    }
    
    .icons-text-card {
        flex-direction: row;
        text-align: left;
        padding: 1rem;
        gap: 1rem;
        min-height: auto;
    }
    
    .icons-text-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .icons-text-content {
        flex: 1;
    }
    
    .icons-text-description {
        -webkit-line-clamp: 2;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .icons-text-card,
    .icons-text-card .water-layer,
    .icons-text-card .water-layer::before,
    .icons-text-card .bubble,
    .icons-text-icon,
    .icons-text-icon img,
    .icons-text-title,
    .icons-text-description,
    .icons-text-card::after {
        animation: none !important;
        transition: none !important;
    }
    
    .icons-text-card.active .water-layer {
        height: 100%;
    }
}
