/* CEFR Levels Section Styling */
.cefr-levels {
    padding: 80px 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    position: relative;
    overflow: hidden;
}

.cefr-levels::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="%23dee2e6" stroke-width="0.5" opacity="0.3"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>') repeat;
    opacity: 0.1;
    z-index: 1;
}

.cefr-levels .container {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.cefr-levels h2 {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
    width: 100%;
}

.cefr-levels h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 2px;
}

.levels-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 50px;
    justify-content: center;
    align-items: stretch;
}

/* Ensure cards have consistent width */
.level-card {
    flex: 0 0 auto;
    width: 100%;
    max-width: 350px;
    min-width: 300px;
}

/* For larger screens, limit cards per row and center them */
@media (min-width: 769px) {
    .levels-grid {
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* When there are exactly 5 cards, center the last 2 */
    .level-card:nth-child(4):nth-last-child(2),
    .level-card:nth-child(5):last-child {
        margin-left: auto;
        margin-right: auto;
    }
    
    /* Create a centered layout for the bottom row when there are 5 items */
    .level-card:nth-child(4):nth-last-child(2) {
        margin-right: 15px;
    }
    
    .level-card:nth-child(5):last-child {
        margin-left: 15px;
    }
}

.level-card {
    background: #ffffff;
    border-radius: 15px;
    padding: 30px 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border-left: 4px solid #007bff;
    max-width: 350px;
    width: 100%;
    text-align: center;
}

.level-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.1), rgba(0, 86, 179, 0.1));
    border-radius: 0 15px 0 50px;
    z-index: 1;
}

.level-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    border-left-width: 6px;
}

.level-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
    line-height: 1.3;
}

.level-card p {
    color: #6c757d;
    line-height: 1.6;
    font-size: 1rem;
    margin: 0;
    position: relative;
    z-index: 2;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cefr-levels {
        padding: 60px 0;
    }
    
    .cefr-levels h2 {
        font-size: 2rem;
    }
    
    .levels-grid {
        flex-direction: column;
        gap: 20px;
        margin-top: 30px;
        align-items: center;
    }
    
    .level-card {
        padding: 25px 20px;
        max-width: 100%;
        min-width: auto;
        width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .level-card h3 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .cefr-levels {
        padding: 40px 0;
    }
    
    .cefr-levels h2 {
        font-size: 1.8rem;
    }
    
    .level-card {
        padding: 20px 15px;
    }
}

/* Animation for cards on scroll */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.level-card {
    animation: fadeInUp 0.6s ease forwards;
}

.level-card:nth-child(1) { animation-delay: 0.1s; }
.level-card:nth-child(2) { animation-delay: 0.2s; }
.level-card:nth-child(3) { animation-delay: 0.3s; }
.level-card:nth-child(4) { animation-delay: 0.4s; }
.level-card:nth-child(5) { animation-delay: 0.5s; }
.level-card:nth-child(6) { animation-delay: 0.6s; }