/* --- General Wrapper --- */
.ahoquizper-wrapper, .ahovn-lms-course-wrapper, .ahovn-lms-goal-frontend {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    max-width: 960px;
    margin: 20px auto;
}

/* --- ROLE BADGE STYLES (NEW) --- */
.ahovn-role-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
    vertical-align: middle;
    cursor: help;
    text-shadow: 0 1px 1px rgba(0,0,0,0.1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    letter-spacing: 0.5px;
    color: #fff;
    text-transform: uppercase;
}
.badge-admin { background: linear-gradient(135deg, #e74c3c, #c0392b); border: 1px solid rgba(255,255,255,0.3); }
.badge-mod { background: linear-gradient(135deg, #3498db, #2980b9); border: 1px solid rgba(255,255,255,0.3); }
.badge-vip { background: linear-gradient(135deg, #f1c40f, #f39c12); border: 1px solid rgba(255,255,255,0.3); color: #fff; }

.ahovn-role-badge:hover { transform: scale(1.1); filter: brightness(1.1); }

/* --- Leaderboard Styles --- */
#ahovn-lms-leaderboard-container:not(:empty), .ahovn-goal-container {
    margin-bottom: 30px;
}
.leaderboard {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid #eee;
}
.leaderboard .leaderboard-title {
    background: linear-gradient(135deg, #0073aa, #005177);
    color: #fff;
    margin: 0;
    padding: 15px;
    font-size: 1.4em;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    border: none;
}
.leaderboard-table {
    width: 100%;
    border-collapse: separate; 
    border-spacing: 0;
}
.leaderboard-table thead tr {
    background-color: #f8f9fa;
    color: #555;
    font-size: 0.85em;
    font-weight: 600;
}
.leaderboard-table th {
    padding: 12px 10px;
    border-bottom: 2px solid #eee;
}
.leaderboard-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #f1f1f1;
    vertical-align: middle;
}

/* Rank Column */
.leaderboard-table .rank-col { width: 60px; text-align: center; font-weight: bold; font-size: 1.2em; color: #777; }
.rank-icon { font-size: 1.4em; line-height: 1; }
/* Crown Animation */
.rank-1-icon, .crown-icon { 
    font-size: 2em; 
    text-shadow: 0 2px 4px rgba(0,0,0,0.2); 
    display: inline-block; 
    animation: floatCrown 3s ease-in-out infinite; 
}
@keyframes floatCrown {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0px); }
}

/* User Column */
.leaderboard-table .name-col { text-align: left; }
.leaderboard-table .user-info { display: flex; align-items: center; gap: 10px; }
.leaderboard-table .user-info img.avatar { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.user-name { font-weight: 600; color: #333; }

/* Score & Time */
.leaderboard-table .score-col { font-weight: 700; color: #2c3e50; text-align: center; }
.leaderboard-table .time-col, .leaderboard-table .day-col { font-size: 0.9em; color: #666; text-align: center; }

/* Rank 1 (Gold) Special Styles */
.leaderboard-row.rank-1 {
    background: linear-gradient(to right, #fffdf0, #fff);
    position: relative;
    border-left: 5px solid #FFD700; 
}
.leaderboard-row.rank-1 .user-info img.avatar {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}
.leaderboard-row.rank-1 .user-name {
    color: #d35400;
    font-size: 1.1em;
}

/* Rank 2 & 3 */
.leaderboard-row.rank-2 { border-left: 5px solid #C0C0C0; }
.leaderboard-row.rank-3 { border-left: 5px solid #CD7F32; }
.leaderboard-row.current-user-row { background-color: #e3f2fd !important; }

/* --- Single Item View Styles --- */
.ahovn-lms-single-item-view {
    padding: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.ahovn-lms-back-link {
    display: inline-block;
    margin-bottom: 20px;
    font-size: 14px;
    color: #0073aa;
    text-decoration: none;
}
.ahovn-lms-back-link:hover { text-decoration: underline; }
.ahovn-lms-lesson-content { margin-top: 20px; }

/* --- Course Grid Styles --- */
.ahovn-lms-course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 20px;
    background-color: #fdf1f5; 
    border-radius: 12px;
    border: 2px dashed #fbcde2;
}
.course-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border-radius: 12px;
    padding: 15px 10px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s ease-in-out;
    min-height: 120px;
    text-align: center;
}
.course-grid-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.course-grid-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-bottom: 10px;
}
.course-grid-item-icon span {
    color: #fff;
    font-size: 24px;
    font-weight: bold;
}
.course-grid-item-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    word-break: break-word;
}
.course-grid-item.completed { opacity: 0.6; background-color: #f0f0f0; }
.course-grid-item.completed:hover { opacity: 1; }
.course-grid-item-unit .course-grid-item-icon { background-color: #C71585; }
.course-grid-item-quiz .course-grid-item-icon { background-color: #00008B; }
.course-grid-item-lesson .course-grid-item-icon { background-color: #8B4513; }

/* --- Quiz Page Styles --- */
#ahoquizper-quiz { max-width: 800px; margin: 20px auto; padding: 20px; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
#ahoquizper-quiz .quiz-title { font-size: 1.8em; font-weight: 700; text-align: center; border-bottom: 2px solid #f0f0f0; padding-bottom: 15px; margin-bottom: 25px; color: #2c3e50; }
#ahoquizper-quiz .quiz-topic h2 { font-size: 1.5em; font-weight: 600; text-align: center; border-bottom: 1px solid #eaeaea; padding-bottom: 15px; margin-bottom: 25px; color: #34495e; }
.quiz-topic { display: none; } 
.quiz-topic.active { display: block; animation: fadeIn 0.5s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
#free-email-capture { margin-bottom: 20px; padding: 15px; background: #fef9e7; border: 1px solid #f9e79f; border-radius: 5px; }
#login-prompt-wrapper { padding: 15px 20px; margin-bottom: 25px; background-color: #fffbe6; border: 1px solid #ffe58f; border-radius: 6px; text-align: center; display: flex; align-items: center; justify-content: center; gap: 10px; }
#login-prompt-wrapper .login-prompt-button { background-color: #0073aa; color: #fff; text-decoration: none; padding: 8px 16px; border-radius: 4px; font-weight: bold; transition: background-color 0.2s; }
#login-prompt-wrapper .login-prompt-button:hover { background-color: #005a87; }
#login-prompt-wrapper span { font-size: 14px; color: #555; }
.quiz-question { margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px dashed #ccc; position: relative; } 
.quiz-question .question-text { font-size: 1.1em; margin-bottom: 15px; }
.quiz-question .question-text strong { font-weight: bold !important; color: #000; }
.quiz-question .wp-audio-shortcode { margin-top: 10px; }
.quiz-lesson-content { margin-bottom: 25px; padding: 15px; background-color: #f9f9f9; border-left: 4px solid #3498db; line-height: 1.7; }
.quiz-lesson-content p:last-child { margin-bottom: 0; }
.quiz-options label { display: block; margin-bottom: 10px; cursor: pointer; font-size: 1em; padding: 10px; border-radius: 5px; border: 1px solid #ddd; transition: all 0.2s ease; }
.quiz-options label:hover { background-color: #f5f5f5; border-color: #3498db; }
.quiz-options input { margin-right: 12px; transform: scale(1.1); }
#ahovn-lms-quiz-navigation, #ahovn-lms-results-navigation { text-align: center; margin-top: 30px; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; }
#ahovn-lms-quiz-navigation > *, #ahovn-lms-results-navigation > * { margin: 5px 25px; }
#ahovn-lms-quiz-navigation, #ahovn-lms-results-navigation { display: none; }
#ahovn-lms-quiz-navigation button, #ahovn-lms-results-navigation button, #ahovn-lms-results-navigation a.button { padding: 10px 15px; font-size: 16px; font-weight: 600; cursor: pointer; border: none; border-radius: 5px; transition: all 0.2s ease; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; white-space: nowrap; }
#ahovn-lms-submit-btn { background-color: #27ae60; color: white; }
#ahovn-lms-submit-btn:hover { background-color: #229954; }
#ahovn-lms-next-topic-btn { background-color: #f39c12; color: white; }
#ahovn-lms-next-topic-btn:hover { background-color: #d68910; }
#ahovn-lms-redo-btn { background-color: #3498db; color: white; }
#ahovn-lms-redo-btn:hover { background-color: #2980b9; }
#ahovn-lms-next-item-btn { background-color: #27ae60; color: white; }
#ahovn-lms-next-item-btn:hover { background-color: #229954; }

/* Results View */
.quiz-results-view .quiz-options label:hover { background: none; border-color: #ddd; }
.quiz-options .result-correct { background-color: #d4edda !important; color: #155724; border-color: #c3e6cb !important; }
.quiz-options .result-incorrect { background-color: #f8d7da !important; color: #721c24; border-color: #f5c6cb !important; }
.quiz-options .user-choice.result-correct::before { content: '➔ '; font-weight: bold; margin-right: 5px; }
.quiz-options .user-choice.result-incorrect::before { content: '✘ '; font-weight: bold; margin-right: 5px; }
.quiz-explanation { margin-top: 15px; padding: 12px; background: #eaf2f8; border: 1px solid #ddd; border-left: 4px solid #3498db; font-size: 0.95em; }
.quiz-explanation-hint { font-size: 12px; color: #888; font-style: italic; margin-top: 8px; text-align: right; }
#quiz-score-summary { margin: 25px 0; border-collapse: collapse; width: 100%; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
#quiz-score-summary th, #quiz-score-summary td { border: 1px solid #ddd; padding: 10px 12px; text-align: left; }
#quiz-score-summary th { background-color: #f8f9fa; font-weight: 600; }
.feedback-icon { background: none; border: none; cursor: pointer; font-size: 18px; position: absolute; top: -5px; right: 0; opacity: 0.6; transition: opacity 0.2s; padding: 5px; }
.feedback-icon:hover { opacity: 1; }
.feedback-icon:disabled { cursor: default; opacity: 0.5; }

/* --- Flashcard Styles --- */
#ahoquizper-flashcard-container { max-width: 600px; margin: 20px auto; display: flex; flex-direction: column; align-items: center; position: relative; }
.flashcard { background-color: transparent; width: 100%; perspective: 1000px; min-height: 250px; height: auto !important; }
.flashcard-inner { position: relative; width: 100%; height: auto !important; min-height: 100%; text-align: center; transition: transform 0.6s, height 0.4s ease; transform-style: preserve-3d; }
.flashcard.is-flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back { position: relative; width: 100%; height: auto; min-height: 250px; -webkit-backface-visibility: hidden; backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); box-sizing: border-box; overflow-wrap: break-word; top: 0; left: 0; }
.flashcard-back { display: none; transform: rotateY(180deg); }
.flashcard.is-flipped .flashcard-front { display: none; }
.flashcard.is-flipped .flashcard-back { display: flex; }
.flashcard-front { background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%); color: #333; font-size: 1.5em; text-align: center; }
.flashcard-back { background: linear-gradient(135deg, #76b852 0%, #8DC26F 100%); color: white; font-size: 1em; text-align: center; }
.flashcard-back strong { font-weight: 700; }
.flashcard-back-content { width: 100%; }
.flashcard-section-top { border-bottom: 1px solid rgba(0,0,0,0.1); padding-bottom: 8px; margin-bottom: 8px; width: 100%;}
.flashcard-explanation-title { font-size: 1.3em; font-weight: 700; margin-bottom: 10px; line-height: 1.3; }
.flashcard-question { font-size: 1em; opacity: 0.9; margin-top: 5px; margin-bottom: 5px; }
.flashcard-divider { height: 1px; background: rgba(255,255,255, 0.4); margin: 15px auto; width: 80%; }
.flashcard-explanation-detail { font-size: 0.95em; line-height: 1.5; opacity: 0.95; }
#flashcard-fav-btn { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; background: rgba(255, 255, 255, 0.3); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 20; transition: all 0.2s ease; color: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.5); }
#flashcard-fav-btn .dashicons { font-size: 18px; width: 18px; height: 18px; line-height: 18px; }
#flashcard-fav-btn:hover { transform: scale(1.1); background: rgba(255, 255, 255, 0.8); color: #aaa; }
#flashcard-fav-btn.active { color: #e74c3c; background: rgba(255, 255, 255, 0.9); border-color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.flashcard-navigation { margin-top: 30px; display: flex; align-items: center; justify-content: center; gap: 20px; width: 100%; }
.flashcard-navigation button { background-color: #fff; color: #555; border: 1px solid #ddd; width: 45px; height: 45px; font-size: 24px; cursor: pointer; border-radius: 50%; transition: all 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.flashcard-navigation button:hover:not(:disabled) { background-color: #f0f0f0; border-color: #ccc; }
.flashcard-navigation button:disabled { opacity: 0.4; cursor: not-allowed; }
#flashcard-shuffle.active { background-color: #e3f2fd; border-color: #2196f3; color: #2196f3; }
#flashcard-counter { font-size: 1.1em; font-weight: 500; color: #777; min-width: 80px; text-align: center; }
.flashcard-instructions { margin-top: 15px; color: #888; font-size: 0.9em; word-break: keep-all; text-align: center; }
@media (max-width: 768px) { #login-prompt-wrapper { flex-direction: column; gap: 8px; } .ahovn-lms-single-item-view, #ahoquizper-quiz { padding: 10px; } #ahoquizper-flashcard-container { padding: 0 10px; width: 100%; box-sizing: border-box; } .flashcard { min-height: 200px; } .flashcard-front { font-size: 1.2em; } .flashcard-back { font-size: 0.9em; } .leaderboard-table th, .leaderboard-table td { padding: 8px 4px; font-size: 0.9em; } .user-name { display: block; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .day-col { display: none; } }
.ahovn-lms-end-media-wrapper { margin-top: 30px; padding-top: 20px; border-top: 1px solid #eee; text-align: center; }
.ahovn-lms-responsive-video { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; background: #000; }
.ahovn-lms-responsive-video iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.ahovn-lms-audio-player { margin: 0 auto; max-width: 600px; }
#ahovn-lms-resume-popup { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 100000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
#ahovn-lms-resume-popup.visible { opacity: 1; visibility: visible; }
.resume-popup-content { background: #fff; width: 90%; max-width: 400px; padding: 30px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); text-align: center; transform: translateY(20px); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
#ahovn-lms-resume-popup.visible .resume-popup-content { transform: translateY(0); }
.resume-icon { font-size: 40px; margin-bottom: 15px; display: block; }
.resume-popup-content h3 { margin: 0 0 10px 0; color: #333; font-size: 22px; font-weight: 700; }
.resume-popup-content p { color: #666; margin-bottom: 25px; font-size: 15px; line-height: 1.5; }
.resume-popup-content p strong { color: #0073aa; display: block; margin-top: 5px; font-size: 1.1em; }
.resume-actions { display: flex; gap: 10px; justify-content: center; }
.resume-btn { background-color: #0073aa !important; color: #fff !important; padding: 10px 20px !important; text-decoration: none !important; border-radius: 5px; font-weight: 600; border: none; cursor: pointer; transition: background 0.2s; flex: 1; }
.resume-btn:hover { background-color: #005177 !important; }
.resume-close-btn { background-color: #f0f0f1 !important; color: #555 !important; padding: 10px 20px !important; border-radius: 5px; border: 1px solid #ddd !important; cursor: pointer; font-weight: 500; flex: 1; }
.resume-close-btn:hover { background-color: #e5e5e5 !important; }
.ahovn-lms-extension-wrapper { margin-top: 25px; padding: 20px; background-color: #fefefe; border: 1px solid #e0e0e0; border-left: 5px solid #f1c40f; border-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.ahovn-lms-extension-wrapper .extension-header { font-size: 1.2em; font-weight: bold; color: #333; margin-bottom: 15px; display: flex; align-items: center; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.ahovn-lms-extension-wrapper .extension-header .dashicons { font-size: 24px; width: 24px; height: 24px; margin-right: 8px; color: #f39c12; }
.ahovn-lms-extension-wrapper .extension-content { font-size: 1em; color: #444; line-height: 1.6; }
.ahovn-lms-extension-wrapper .extension-content ul, .ahovn-lms-extension-wrapper .extension-content ol { margin-left: 20px; margin-bottom: 1em; }
.ahovn-lms-extension-wrapper .extension-content p { margin-bottom: 1em; }
.ahovn-lms-extension-wrapper .extension-content p:last-child { margin-bottom: 0; }