@import url('https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,400;0,700;1,300;1,400&family=Roboto:wght@300;400;500;700&display=swap');

:root{
    --aho-primary:#6C5CE7;
    --aho-primary-2:#8E7CFF;
    --aho-bg:#f5f7fb;
    --aho-card:#ffffff;
    --aho-text:#1f2937;
    --aho-muted:#6b7280;
    --aho-success:#10b981;
    --aho-border:#e5e7eb;
}

/* ===== HUB: TỔNG KHÓA HỌC ===== */
.aho-courses-hub{
    max-width: 1100px;
    margin: 20px auto;
    padding: 16px;
    background: linear-gradient(180deg,#f8f9ff 0%, #f5f7fb 100%);
    border:1px solid #eceffd;
    border-radius:16px;
    font-family:'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.aho-courses-head h2{margin:0 0 6px;font-size:24px;color:#111827;}
.aho-courses-head p{margin:0 0 14px;color:#6b7280;}
.aho-courses-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;}
.aho-course-card{background:#fff;border:1px solid #e5e7eb;border-radius:14px;transition:.2s;}
.aho-course-card:hover{transform:translateY(-2px);box-shadow:0 10px 24px rgba(17,24,39,.08);}
.aho-course-card-inner{padding:14px;}
.aho-course-badge{
    display:inline-block;
    font-size:11px;font-weight:700;
    color:#4f46e5;background:#eef2ff;
    border-radius:999px;padding:4px 8px;margin-bottom:8px;
}
.aho-course-title{margin:0 0 8px;font-size:17px;color:#111827;}
.aho-course-meta{font-size:13px;color:#6b7280;margin-bottom:10px;}
.aho-course-open-btn{
    display:inline-block;text-decoration:none;
    background:#111827;color:#fff;
    border-radius:10px;padding:9px 12px;font-weight:700;
}
.aho-course-open-btn:hover{background:#000;color:#fff;}
.aho-back-to-courses{max-width:1100px;margin:12px auto;font-family:'Roboto',sans-serif;}
.aho-back-to-courses a{text-decoration:none;font-weight:700;color:#374151;}

/* ===== SHOWCASE 1 KHÓA ===== */
.aho-showcase-app{
    max-width: 1100px;
    margin: 20px auto;
    padding: 16px;
    background: linear-gradient(180deg,#f8f9ff 0%, #f5f7fb 100%);
    border:1px solid #eceffd;
    border-radius:16px;
    font-family:'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    position:relative;
}
.aho-app-header{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:14px;}
.aho-app-title{margin:0;font-size:22px;color:#111827;}
.aho-app-subtitle{font-size:13px;color:#6b7280;margin-top:4px;}
.aho-btn-reset-progress{
    border:1px solid #e5e7eb;background:#fff;border-radius:10px;
    padding:8px 12px;cursor:pointer;font-weight:600;
}
.aho-btn-reset-progress:hover{background:#f9fafb;}

.aho-course-progress-box{background:#fff;border:1px solid #e5e7eb;border-radius:12px;padding:12px;margin-bottom:14px;}
.aho-progress-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;}
.aho-progress-label{font-size:13px;color:#374151;font-weight:600;}
.aho-progress-percent{font-weight:700;color:var(--aho-primary);}
.aho-course-progress-track{height:10px;background:#ecebff;border-radius:999px;overflow:hidden;}
.aho-course-progress-fill{
    height:100%;width:0;background: linear-gradient(90deg, var(--aho-primary), var(--aho-primary-2));
    transition: width .35s ease;
}
.aho-progress-meta{font-size:12px;color:#6b7280;margin-top:8px;}

.aho-filter-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px;}
.aho-filter-btn{
    border:1px solid #e5e7eb;background:#fff;padding:8px 12px;border-radius:999px;
    cursor:pointer;font-weight:600;font-size:13px;
}
.aho-filter-btn.active{background:var(--aho-primary);color:#fff;border-color:var(--aho-primary);}

.aho-lessons-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;}
.aho-lesson-card{
    background:#fff;border:1px solid #e5e7eb;border-radius:14px;overflow:hidden;position:relative;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.aho-lesson-card:hover{transform: translateY(-2px);box-shadow:0 10px 24px rgba(17,24,39,.08);}
.aho-lesson-card.is-hidden{display:none;}
.aho-lesson-card.is-done .aho-lesson-card-inner{opacity:.75;}
.aho-lesson-card-inner{padding:14px;}
.aho-lesson-badge{
    display:inline-block;font-size:11px;font-weight:700;color:var(--aho-primary);
    background:#f1efff;border-radius:999px;padding:4px 8px;margin-bottom:8px;
}
.aho-lesson-title{margin:0 0 12px 0;font-size:16px;color:#111827;min-height:42px;}
.aho-lesson-actions-row{display:flex;gap:8px;}
.aho-btn-open-lesson,.aho-btn-mark-complete{
    flex:1;border:none;border-radius:10px;padding:10px 8px;font-weight:600;cursor:pointer;font-size:13px;
}
.aho-btn-open-lesson{background:#111827;color:#fff;}
.aho-btn-open-lesson:hover{background:#000;}
.aho-btn-mark-complete{background:#ecfdf5;color:#047857;border:1px solid #a7f3d0;}
.aho-btn-mark-complete:hover{background:#d1fae5;}
.aho-done-ribbon{
    position:absolute;top:10px;right:10px;background:#10b981;color:#fff;
    font-size:11px;font-weight:700;padding:5px 8px;border-radius:999px;
    opacity:0;transform:translateY(-4px);transition:all .2s ease;
}
.aho-lesson-card.is-done .aho-done-ribbon{opacity:1;transform:translateY(0);}

.aho-lesson-viewer{margin-top:8px;}
.aho-inline-player-wrap{background:#fff;border:1px solid #e5e7eb;border-radius:14px;padding:10px;}
.aho-inline-player-header{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px;}
.aho-btn-back-inline{
    border:1px solid #e5e7eb;background:#fff;border-radius:10px;padding:8px 10px;cursor:pointer;font-weight:600;
}
.aho-inline-player-title{font-weight:700;color:#111827;font-size:14px;}

.aho-guest-note{
    margin-top:12px;color:#92400e;background:#fffbeb;border:1px solid #fde68a;
    padding:10px 12px;border-radius:10px;font-size:13px;
}
.aho-toast{
    position:fixed;right:16px;bottom:16px;background:#111827;color:#fff;padding:10px 14px;border-radius:10px;
    z-index:999999;opacity:0;transform:translateY(8px);transition:all .2s ease;pointer-events:none;font-size:13px;
}
.aho-toast.show{opacity:1;transform:translateY(0);}

/* ===== PLAYER ===== */
.aho-audio-wrapper {
    max-width: 760px; margin: 0 auto;
    background: #fff; border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    overflow: hidden;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    border: 1px solid #eee;
    position: relative;
}
.aho-header { background: #f8f9fa; padding: 15px 20px; text-align: center; border-bottom: 1px solid #eee; }
.aho-header h3 { margin: 0; font-size: 18px; color: #333; font-weight: 700; }
.aho-day-info { font-size: 12px; color: #888; margin-top: 5px; }

.aho-player-container { padding: 25px 20px 15px; text-align: center; }
.aho-progress-area { margin-bottom: 25px; padding: 0 5px; }
.aho-progress-bar { height: 8px; background: #e0e0e0; border-radius: 4px; cursor: pointer; position: relative; }
.aho-progress-current {
    height: 100%; width: 0%; background: #764ba2; border-radius: 4px;
    position: relative; transition: width 0.1s linear; z-index: 1;
}
.aho-progress-current::after {
    content: ''; position: absolute; right: -6px; top: -3px; width: 14px; height: 14px;
    background: #fff; border: 2px solid #764ba2; border-radius: 50%; opacity: 0; transition: opacity 0.2s;
}
.aho-progress-bar:hover .aho-progress-current::after { opacity: 1; }

.aho-marker-a, .aho-marker-b {
    position: absolute; top: -4px; width: 2px; height: 16px;
    background: #ff4757; z-index: 2; display: none; pointer-events: none;
}
.aho-marker-a::before { content: 'A'; position: absolute; top: -15px; left: -3px; font-size: 10px; color: #ff4757; font-weight: bold; }
.aho-marker-b::before { content: 'B'; position: absolute; top: -15px; left: -3px; font-size: 10px; color: #ff4757; font-weight: bold; }
.aho-loop-region { position: absolute; top: 0; height: 100%; background: rgba(255, 71, 87, 0.3); z-index: 0; display: none; pointer-events: none; }

.aho-timer { display: flex; justify-content: space-between; font-size: 12px; color: #666; margin-top: 8px; font-weight: 500; }

.aho-controls { display: flex; justify-content: center; align-items: center; gap: 15px; margin-bottom: 15px; }
.btn-control {
    background: none; border: none; cursor: pointer; color: #555; font-size: 18px; transition: all 0.2s;
    width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.btn-control:hover { background: #f0f0f0; color: #764ba2; }
.btn-loop.active { color: #764ba2; background: #ede7f6; border: 1px solid #d1c4e9; }

.btn-play {
    width: 55px; height: 55px; background: #764ba2; color: #fff; font-size: 24px;
    box-shadow: 0 4px 10px rgba(118, 75, 162, 0.3);
}
.btn-play:hover { background: #667eea; color: #fff; transform: scale(1.05); }

.btn-ab { font-size: 12px; font-weight: bold; border: 1px solid #ddd; border-radius: 4px; width: auto; padding: 0 10px; }
.btn-ab.status-a { background: #ffeaa7; border-color: #fdcb6e; color: #d35400; }
.btn-ab.status-b { background: #ff7675; border-color: #d63031; color: #fff; }
.btn-speed { font-size: 12px; font-weight: bold; width: auto; padding: 0 10px; border-radius: 15px; border: 1px solid #ddd; }

.aho-seek-settings {
    display: flex; justify-content: center; align-items: center; gap: 5px;
    font-size: 12px; color: #666; margin-top: 10px;
}
.aho-seek-input { border: 1px solid #ddd; border-radius: 4px; padding: 3px; font-size: 12px; }
.aho-btn-save-seek { background: #f0f0f0; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; padding: 3px 8px; font-size: 12px; }
.aho-btn-save-seek:hover { background: #e0e0e0; }

.aho-script-toggle-area {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 20px; border-top: 1px solid #eee; background: #fdfdfd;
}
.aho-btn-show-script {
    background: #fff; border: 1px solid #ccc; color: #555;
    padding: 6px 15px; border-radius: 20px; font-weight: 600; cursor: pointer; font-size: 13px;
    transition: all 0.2s; font-family: 'Roboto', sans-serif;
}
.aho-btn-show-script:hover { background: #f0f0f0; }
.aho-btn-show-script.active { background: #eef2f7; color: #354a5f; border-color: #dce4ec; }

.aho-btn-fullscreen-script {
    background: none; border: none; cursor: pointer; color: #777; font-size: 16px;
    padding: 5px; transition: color 0.2s;
}
.aho-btn-fullscreen-script:hover { color: #333; }

.aho-script-content {
    padding: 20px 25px;
    background: #fff;
    font-family: 'Merriweather', 'Palatino Linotype', serif;
    font-size: 18px;
    line-height: 1.8;
    color: #2a2a2a;
    text-align: justify;
    border-top: 1px dashed #eee;
    max-height: 400px;
    overflow-y: auto;
    position: relative;
    -webkit-overflow-scrolling: touch;
}
.aho-script-content p { margin-bottom: 1.2em; }

.aho-btn-close-fullscreen {
    display: none;
    position: fixed; bottom: 30px; right: 30px;
    background: #333; color: #fff; border: none; padding: 10px 20px;
    border-radius: 30px; font-weight: bold; cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 100001;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
}
.aho-btn-close-fullscreen:hover { background: #000; transform: translateY(-2px); }

.aho-audio-wrapper.is-script-fullscreen .aho-script-content {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    max-height: none; z-index: 100000;
    padding: 40px 20px 80px;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    box-shadow: none; border: none;
    animation: zoomIn 0.2s ease-out;
}
.aho-audio-wrapper.is-script-fullscreen .aho-btn-close-fullscreen { display: block; animation: fadeInUp 0.3s ease-out; }

@keyframes zoomIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeInUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.aho-lesson-actions{display:flex;gap:8px;justify-content:center;margin-top:12px;}
.aho-btn-complete-lesson, .aho-btn-back-showcase{
    border:none;border-radius:10px;padding:10px 12px;font-weight:700;cursor:pointer;
}
.aho-btn-complete-lesson{background:#10b981;color:#fff;}
.aho-btn-complete-lesson:hover{background:#059669;}
.aho-btn-back-showcase{background:#f3f4f6;color:#111827;}
.aho-btn-back-showcase:hover{background:#e5e7eb;}

/* ===== ADMIN SORTABLE (Danh sách bài nghe) ===== */
#aho-list .aho-item{
    user-select: none;
}
#aho-list .aho-item.ui-sortable-helper{
    box-shadow: 0 6px 18px rgba(0,0,0,.15);
    background:#fffef2 !important;
}
#aho-list .aho-item.ui-sortable-placeholder{
    visibility: visible !important;
    background:#f3f4f6 !important;
    border:1px dashed #cbd5e1;
    height:42px;
}
#aho-list .aho-item .aho-delete{
    cursor:pointer;
}
#aho-list .aho-item .aho-delete:hover{
    color:#b91c1c !important;
}

@media (max-width: 900px) {
    .aho-courses-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
    .aho-lessons-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media (max-width: 640px) {
    .aho-courses-grid{grid-template-columns:1fr;}
    .aho-showcase-app{padding:12px;border-radius:12px;}
    .aho-app-header{flex-direction:column;align-items:flex-start;}
    .aho-lessons-grid{grid-template-columns:1fr;}
    .aho-controls { gap: 10px; }
    .btn-control { width: 35px; height: 35px; font-size: 14px; }
    .btn-play { width: 45px; height: 45px; font-size: 18px; }
    .aho-script-content { font-size: 17px; padding: 15px; }
}