/* --- Lesson Card Styles (for Paragraphs) --- */
.lesson-card {
    background-color: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.lesson-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #4f46e5;
}

.lesson-card.active {
    background-color: #4f46e5;
    color: white;
    border-color: #3730a3;
}

.lesson-card.active .lesson-icon {
    color: white;
}

.lesson-card.active .lesson-desc {
    color: #e0e7ff;
}

.lesson-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #4f46e5;
    transition: color 0.2s;
}

.lesson-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.lesson-desc {
    font-family: 'Roboto Mono', monospace;
    color: #6b7280;
    transition: color 0.2s;
}

/* --- Typing Drill Styles --- */
#text-input {
    caret-color: transparent;
    /* Hide the default cursor */
    text-align: left !important;
    /* Ensure text input aligns left for paragraphs */
}

#text-display {
    text-align: justify !important;
    /* Justify text for paragraphs */
    line-height: 1.8;
    /* Better readability for paragraphs */
    font-size: 1.25rem;
    /* Slightly smaller font for paragraphs */
}

.letter {
    display: inline-block;
    position: relative;
    transition: color 0.2s ease, transform 0.2s ease;
}

.letter.active {
    color: #4f46e5;
    transform: scale(1.05);
    /* Slightly less scaling for paragraphs */
}

.letter.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: #4f46e5;
    animation: blink 1s infinite;
    border-radius: 2px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.letter.correct {
    color: #10b981;
}

.letter.incorrect {
    color: #ef4444;
}

/* --- How-to Steps & FAQ (Consistent Styling) --- */
.step-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.step-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.step-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    margin-bottom: 1.5rem;
    font-size: 2.5rem;
    transition: all 0.3s ease;
}

.step-card:hover .step-icon-container {
    transform: scale(1.1);
}

.step-icon-1 {
    background-color: #e0f2fe;
    color: #0ea5e9;
}

.step-icon-2 {
    background-color: #dcfce7;
    color: #22c55e;
}

.step-icon-3 {
    background-color: #fef3c7;
    color: #f59e0b;
}

.faq-entry {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.faq-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-question {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    padding-bottom: 0.5rem;
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, padding-top 0.5s ease-in-out;
    padding-top: 0;
}

.faq-question.active+.faq-answer {
    max-height: 300px;
    /* Increased max-height for longer FAQ answers */
    padding-top: 1rem;
}

.faq-answer p {
    color: #4b5563;
    line-height: 1.6;
}

.faq-question .fa-chevron-down {
    transform: rotate(0deg);
}

.faq-question.active .fa-chevron-down {
    transform: rotate(180deg);
}

/* --- Certificate Modal Styles (Consistent) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #9ca3af;
}

#certificate-preview-container {
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 0.5rem;
    max-width: 840px;
    width: 95%;
}

#certificate {
    width: 800px;
    height: 565px;
    border: 10px solid #4f46e5;
    padding: 2rem;
    background: linear-gradient(to bottom right, #ffffff, #f3f4f6);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: 'Times New Roman', serif;
    margin: 0 auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

@media (max-width: 850px) {
    #certificate {
        width: 100%;
        height: auto;
        padding: 1rem;
        border-width: 5px;
    }

    #certificate-header h1 {
        font-size: 2rem;
    }

    #certificate-header h2 {
        font-size: 1rem;
    }

    #certificate-body p {
        font-size: 1rem;
    }

    #certificate-body .user-name {
        font-size: 1.8rem;
    }

    #cert-score {
        font-size: 1.5rem !important;
    }

    #certificate-footer {
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.875rem;
    }
}

#certificate-header {
    text-align: center;
}

#certificate-header h1 {
    font-size: 3rem;
    color: #3730a3;
    font-weight: bold;
    margin: 0;
}

#certificate-header h2 {
    font-size: 1.5rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

#certificate-body {
    text-align: center;
    margin: 2rem 0;
}

#certificate-body p {
    font-size: 1.25rem;
    color: #374151;
    line-height: 1.8;
}

#certificate-body .user-name {
    font-size: 2.5rem;
    font-weight: bold;
    color: #1e293b;
    border-bottom: 2px solid #9ca3af;
    display: inline-block;
    padding-bottom: 0.5rem;
    margin: 1rem 0;
}

#certificate-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    color: #4b5563;
}