/* Grammar Topics Grid */
.grammar-topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    position: relative;
    z-index: 1;
}

/* Grammar Topic Card */
.grammar-topic-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.grammar-topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--neon-purple), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.grammar-topic-card:hover::before {
    opacity: 1;
}

.grammar-topic-card:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(139, 92, 246, 0.5);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3);
}

.grammar-topic-card .topic-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 12px;
    transition: all 0.3s;
}

.grammar-topic-card:hover .topic-icon {
    background: rgba(139, 92, 246, 0.2);
    transform: scale(1.1) rotate(5deg);
}

.grammar-topic-card .topic-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.grammar-topic-card .topic-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: white;
}

.grammar-topic-card .topic-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.grammar-topic-card .topic-count {
    display: inline-block;
    background: rgba(139, 92, 246, 0.2);
    color: var(--neon-purple);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
    width: fit-content;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .grammar-topics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .grammar-topic-card {
        padding: 0.75rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
        min-height: 120px;
    }

    .grammar-topic-card .topic-icon {
        font-size: 1.8rem;
        width: 45px;
        height: 45px;
        margin: 0 auto;
    }

    .grammar-topic-card .topic-info h3 {
        font-size: 0.85rem;
        line-height: 1.2;
    }

    .grammar-topic-card .topic-info p {
        font-size: 0.7rem;
        display: none;
        /* Hide description on mobile to save space */
    }

    .grammar-topic-card .topic-count {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
        margin-top: 0.25rem;
    }

    /* Ensure header is visible on mobile */
    .modes-header-group {
        padding-top: 1rem !important;
    }
}
/* Info Button on Grammar Cards */
.info-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    font-size: 1rem;
    transition: all 0.2s;
}

.info-btn:hover {
    background: var(--neon-purple);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

/* Modal Content Styling */
.explanation-content h3 {
    color: var(--neon-purple);
    border-bottom: 2px solid rgba(139, 92, 246, 0.3);
    padding-bottom: 0.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.explanation-content h3:first-child {
    margin-top: 0;
}

.explanation-content p {
    margin-bottom: 1rem;
}

.explanation-content hr {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 2rem 0;
}

.example-box {
    background: rgba(30, 41, 59, 0.5);
    border-left: 4px solid var(--neon-blue);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0 8px 8px 0;
}

.example-box p {
    margin: 0.5rem 0;
}

.explanation-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: rgba(0, 0, 0, 0.2);
}

.explanation-table th, 
.explanation-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.explanation-table th {
    color: var(--neon-blue);
    font-weight: 700;
}

/* Mobile Modal Adjustments */
@media (max-width: 768px) {
    .modal-content {
        width: 95% !important;
        max-height: 90vh !important;
    }
}

