/* Main Grid Container */
.cag-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 40px;
    padding: 50px 20px;
    max-width: 1280px;
    margin: 0 auto;
    perspective: 1000px;
    /* Enable 3D space */
}

/* Card Wrapper for 3D Tilt */
.cag-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 2px;
    /* Space for the gradient border */
    position: relative;
    overflow: hidden;
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.05);
    /* Soft ambient shadow */
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Animated Gradient Border Background */
.cag-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(60deg,
            #f7971e,
            #ffd200,
            #067F7C,
            #044F4D,
            #f7971e);
    background-size: 300% 300%;
    animation: cag-border-spin 4s linear infinite;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
}

@keyframes cag-border-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.cag-card:hover::before {
    opacity: 1;
}

.cag-card:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.12);
}

/* Inner Card Content (White Box) */
.cag-card-content {
    background: #ffffff;
    border-radius: 22px;
    /* Slightly less than parent */
    padding: 40px 30px;
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center horizontally */
    text-align: center;
    /* Center text */
}

/* Icon - Floating & Glowing */
.cag-icon {
    font-size: 80px;
    /* Larger font size for FA */
    margin-bottom: 25px;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 40px;
    /* Adjusted for larger size */
    color: #333;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    /* Bouncy */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    /* Ensure images don't leak out */
}

.cag-icon img,
.cag-icon svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Ensure images/svgs fit perfectly */
    display: block;
}

.cag-card:hover .cag-icon {
    background: #044F4D;
    color: #fff;
    transform: scale(1.15);
    box-shadow: 0 15px 30px rgba(4, 79, 77, 0.4);
}

/* Title - Gradient Text */
.cag-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 15px;
    color: #1a202c;
    background: -webkit-linear-gradient(45deg, #1a202c, #2d3748);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.3s ease;
    width: 100%;
    /* Ensure text align center works */
}

.cag-card:hover .cag-title {
    background: linear-gradient(45deg, #067F7C, #044F4D);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Description */
.cag-description {
    font-size: 1.05rem;
    color: #718096;
    line-height: 1.7;
    margin-bottom: 30px;
    flex-grow: 1;
    width: 100%;
}

/* Button - Magnetic & Shining */
.cag-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(90deg, #044F4D, #033836);
    padding: 16px 40px;
    /* Bigger padding for centered look */
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    margin-top: auto;
    width: auto;
    /* Not full width anymore */
    min-width: 160px;
    position: relative;
    overflow: hidden;
    border: none;
}

.cag-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    transition: left 0.5s ease;
}

.cag-button:hover::before {
    left: 100%;
    /* Shine effect moves across */
}

.cag-button:hover {
    background: linear-gradient(90deg, #067F7C, #044F4D);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(4, 79, 77, 0.3);
    color: #fff;
    text-decoration: none;
}

.cag-button i {
    transition: transform 0.3s ease;
}

.cag-button:hover i {
    transform: translateX(5px);
}

/* Responsive */
@media (max-width: 768px) {
    .cag-grid-container {
        gap: 30px;
        padding: 30px 15px;
    }

    .cag-card-content {
        padding: 30px 25px;
    }
}