/* Card Flip Styles */

.card-bottom-spacer {
    height: 40px;
    width: 100%;
    display: block;
    content: "";
}


.why-choose-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.why-choose-card {
    position: relative;
    height: 650px; /* Fixed height to ensure all cards are the same size */
    min-height: 650px; /* Added min-height to ensure consistent sizing */
    perspective: 1000px;
    cursor: pointer;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 15px 15px 25px 15px; /* Adjusted bottom padding to a more reasonable amount */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    overflow: hidden;
}

/* Mobile styles for portrait orientation */
@media (max-width: 768px) and (orientation: portrait) {
    .why-choose-card {
        height: auto;
        min-height: 400px;
        perspective: none;
        position: relative;
        padding: 20px 20px 80px 20px; /* Extra bottom padding for ALL cards */
        margin-bottom: 50px;
        border: 1px solid rgba(0,0,0,0.1);
        border-radius: var(--border-radius);
        background-color: white;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        display: flex;
        flex-direction: column;
    }
    
    /* Static flip link styles */
    .static-flip-link {
        display: block;
        background-color: var(--accent-color);
        color: white;
        padding: 20px 25px;
        border-radius: 30px;
        margin-top: auto;
        margin-bottom: 30px;
        width: 90%;
        max-width: 250px;
        text-align: center;
        font-size: 1.25rem;
        font-weight: 700;
        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
        text-decoration: none;
        transition: all 0.3s ease;
        align-self: center;
        z-index: 10;
        letter-spacing: 0.5px;
    }
    
    /* Add spacing after card content */
    .card-front > *, .card-back > * {
        margin-bottom: 15px;
    }
    
    /* Add extra space before the button */
    .static-flip-link {
        margin-top: 40px;
    }
    
    .static-flip-link:hover, .static-flip-link:active {
        background-color: var(--primary-color);
        transform: translateY(-3px);
        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    }
    
    /* Different styling for back links */
    a.static-flip-link.back-link {
        background-color: #2c3e50 !important; /* Dark blue color */
        color: white !important;
        border: 2px solid white !important;
        margin-top: 60px !important;
        margin-bottom: 40px !important;
    }
    
    a.static-flip-link.back-link:hover, a.static-flip-link.back-link:active {
        background-color: white !important;
        color: #2c3e50 !important;
        border: 2px solid #2c3e50 !important;
    }
    
    .card-front, .card-back {
        position: static;
        height: auto;
        backface-visibility: visible;
        transform: none !important;
        box-shadow: none;
        border: none;
        padding: 25px 20px 80px 20px; /* Extra bottom padding for links and text */
        display: flex;
        flex-direction: column;
        flex: 1;
    }
    
    .card-front {
        display: block;
    }
    
    .card-back {
        display: none;
    }
    
    .why-choose-card.flipped .card-front {
        display: none;
    }
    
    .why-choose-card.flipped .card-back {
        display: block;
    }
    
    /* Mobile flip button - only visible in portrait mode */
    .mobile-flip-button {
        display: block;
        background-color: var(--accent-color);
        color: white;
        padding: 12px 20px;
        border-radius: 25px;
        position: absolute;
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        width: 80%;
        max-width: 200px;
        text-align: center;
        font-size: 1.1rem;
        font-weight: 600;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
        transition: all 0.3s ease;
        cursor: pointer;
        z-index: 10;
        animation: pulse-button 2s infinite;
    }
    
    @keyframes pulse-button {
        0% {
            box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
        }
        70% {
            box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
        }
        100% {
            box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
        }
    }
    
    .mobile-flip-button i {
        margin-left: 5px;
    }
    
    .mobile-flip-button:hover, .mobile-flip-button:active {
        background-color: var(--accent-color);
        box-shadow: 0 5px 12px rgba(0, 0, 0, 0.2);
    }
    
    /* Hide desktop card flippers on mobile portrait */
    .card-front .card-flipper, .card-back .card-flipper {
        display: none;
    }
}

.card-front {
    background-color: white;
    transform: rotateY(0deg);
    z-index: 2;
}

.card-back {
    background-color: white;
    transform: rotateY(180deg);
    z-index: 1;
}

/* Hover effect for desktop devices */
@media (min-width: 769px) and (hover: hover) {
    .why-choose-card:hover .card-front {
        transform: rotateY(180deg);
    }
    
    .why-choose-card:hover .card-back {
        transform: rotateY(0deg);
    }
}

.why-choose-card.flipped .card-front {
    transform: rotateY(180deg);
}

.why-choose-card.flipped .card-back {
    transform: rotateY(0deg);
}

.feature-icon-container {
    margin-top: 10px;
    margin-bottom: 15px;
}

.feature-icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: rgba(76, 175, 80, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.feature-icon-circle i {
    font-size: 36px;
    color: var(--primary-color);
}

.why-choose-card:hover .feature-icon-circle {
    transform: scale(1.1);
    background-color: rgba(76, 175, 80, 0.2);
    box-shadow: 0 10px 20px rgba(76, 175, 80, 0.2);
}

h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 10px 0;
    color: var(--primary-color);
}

.card-teaser {
    color: var(--dark-gray);
    margin-bottom: 25px;
    line-height: 1.6;
    font-size: 1rem;
}

.card-back p {
    margin-bottom: 10px;
    line-height: 1.5;
    font-size: 0.95rem;
    max-width: 100%;
}

.card-flipper {
    font-size: 0.9rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

/* Hide mobile flip button by default (will be shown only in mobile portrait) */
.mobile-flip-button {
    display: none;
}

.card-flipper i {
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.card-flipper:hover {
    color: var(--accent-color);
}

.card-flipper:hover i {
    transform: translateX(5px);
}

.card-back .card-flipper:hover i {
    transform: translateX(-5px);
}

.card-back .feature-list {
    list-style: none;
    padding: 0;
    margin: 15px 0 20px 0; /* Adjusted bottom margin to a more reasonable amount */
    text-align: left;
    width: 100%;
}

.card-back ul li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: var(--dark-gray);
    text-align: left;
}

.card-back ul li i {
    color: var(--primary-color);
    margin-right: 10px;
    margin-top: 5px;
}
