/* AgileFingers Rust Integration Custom Styling */

/* Hide redundant generic agilefingers account icon */
#login-header .af-header-account-link {
    display: none !important;
}

/* Keyz Corporate Auth Navigation in Header */
.af-auth-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 8px;
}

.af-auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1.3;
    white-space: nowrap;
}

.af-auth-btn-login {
    color: #cbd5e1;
    background: transparent;
    border: 1px solid #475569;
}

.af-auth-btn-login:hover {
    color: #ffffff;
    background: #334155;
    border-color: #64748b;
}

.af-auth-btn-register {
    color: #ffffff;
    background: #2563eb;
    border: 1px solid #3b82f6;
}

.af-auth-btn-register:hover {
    background: #1d4ed8;
    border-color: #2563eb;
    color: #ffffff;
}

/* Authenticated User Menu */
.af-auth-user-dropdown {
    position: relative;
    display: inline-block;
}

.af-auth-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #f8fafc;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.af-auth-user-trigger:hover {
    background: #334155;
    border-color: #475569;
}

.af-auth-avatar {
    font-size: 1.15rem;
    line-height: 1;
}

.af-auth-username {
    font-weight: 600;
    color: #f1f5f9;
}

.af-auth-user-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    padding: 8px 0;
    animation: afFadeIn 0.15s ease-out;
}

@keyframes afFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.af-auth-user-dropdown.is-open .af-auth-user-menu {
    display: block;
}

.af-auth-menu-header {
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
}

.af-auth-menu-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.af-auth-menu-email {
    font-size: 0.8rem;
    color: #64748b;
    margin: 2px 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.af-auth-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.88rem;
    color: #334155;
    text-decoration: none;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    transition: background 0.15s;
    font-weight: 500;
}

.af-auth-menu-item:hover {
    background: #f8fafc;
    color: #0f172a;
}

.af-auth-menu-item--danger {
    color: #dc2626;
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
}

.af-auth-menu-item--danger:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.af-star-badge {
    background: rgba(0, 0, 0, 0.4);
    padding: 1px 7px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: bold;
    color: #f1c40f;
}

/* Level Control Bar inside Breadcrumb Row */
.af-level-bar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid #e2d9c8;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.af-btn-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    font-size: 0.84rem;
    font-weight: 600;
    color: #4a4036;
    background: #fdfaf4;
    border: 1px solid #d8cdba;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.af-btn-nav:hover:not(:disabled) {
    background: #ebd8be;
    color: #222;
    border-color: #bda98c;
}

.af-btn-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.af-level-select {
    padding: 5px 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #333;
    background: #fff;
    border: 1.5px solid #d35400;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    max-width: 280px;
}

.af-level-select:focus {
    box-shadow: 0 0 0 2px rgba(211, 84, 0, 0.25);
}

.af-btn-map {
    background: #27ae60;
    color: #fff;
    border: 1px solid #219653;
}

.af-btn-map:hover {
    background: #219653;
    color: #fff;
}

.af-btn-sound {
    background: #34495e;
    color: #fff;
    border: 1px solid #2c3e50;
}

.af-btn-sound:hover {
    background: #2c3e50;
    color: #fff;
}

.af-btn-sound.sound-off {
    background: #7f8c8d;
    border-color: #95a5a6;
    color: #eee;
}

/* Modal Overlay & Card Styling (AgileFingers theme) */
.af-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(30, 25, 20, 0.65);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.af-modal-card {
    background: #faf6ee;
    border: 2px solid #e0d2bc;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    padding: 28px;
    position: relative;
    box-sizing: border-box;
}

.af-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #e8decb;
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.af-modal-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c251d;
    display: flex;
    align-items: center;
    gap: 10px;
}

.af-modal-close {
    background: transparent;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    color: #7a6e60;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

.af-modal-close:hover {
    color: #d35400;
    background: rgba(0,0,0,0.05);
}

/* Level Grid in Map Modal */
.af-module-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #8c5b23;
    margin: 18px 0 10px 0;
    padding-left: 6px;
    border-left: 4px solid #d35400;
}

.af-levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.af-level-card {
    background: #ffffff;
    border: 1.5px solid #dcd1be;
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 85px;
    text-decoration: none;
    color: inherit;
}

.af-level-card:hover {
    transform: translateY(-2px);
    border-color: #d35400;
    box-shadow: 0 6px 14px rgba(211, 84, 0, 0.15);
}

.af-level-card.current {
    border: 2px solid #d35400;
    background: #fff8f0;
    box-shadow: 0 4px 12px rgba(211, 84, 0, 0.2);
}

.af-level-card.completed {
    border-color: #27ae60;
}

.af-card-num {
    font-size: 0.95rem;
    font-weight: 700;
    color: #333;
}

.af-card-keys {
    font-family: "Roboto Mono", monospace;
    font-size: 0.8rem;
    color: #666;
    margin: 4px 0;
    word-break: break-all;
}

.af-card-stars {
    font-size: 0.82rem;
    color: #f1c40f;
    margin-top: auto;
}

/* Celebration Modal */
.af-celeb-card {
    text-align: center;
    max-width: 520px;
}

.af-celeb-stars {
    font-size: 3.2rem;
    margin: 12px 0;
    letter-spacing: 6px;
    filter: drop-shadow(0 2px 8px rgba(241, 196, 15, 0.4));
    animation: af-star-pop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes af-star-pop {
    0% { transform: scale(0.3); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.af-celeb-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.af-celeb-stat-box {
    background: #ffffff;
    border: 1px solid #e0d4c0;
    border-radius: 10px;
    padding: 12px 8px;
}

.af-celeb-stat-val {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2c251d;
}

.af-celeb-stat-label {
    font-size: 0.78rem;
    color: #777;
    margin-top: 4px;
    text-transform: uppercase;
}

.af-celeb-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.af-btn-primary {
    background: #d35400;
    color: #fff;
    border: none;
    padding: 10px 22px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.af-btn-primary:hover {
    background: #ba4a00;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(211, 84, 0, 0.3);
}

.af-btn-secondary {
    background: #fdfaf4;
    color: #4a4036;
    border: 1.5px solid #d8cdba;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
}

.af-btn-secondary:hover {
    background: #ebd8be;
}

/* Decorations display on wide screens */
.af-page-content-rail-decorations {
    display: none !important;
}

/* Summary Page Kid Badge */
.af-kid-summary-badge {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #faf4ea;
    border: 1.5px solid #e2d2ba;
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

/* Syllabus Table Buttons & Speed Level Badges */
.af-practice-action-cell--dual {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 6px !important;
    align-items: center !important;
}

.af-practice-action-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 5px 12px !important;
    border-radius: 20px !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    line-height: 1.15 !important;
    box-sizing: border-box !important;
    transition: all 0.15s ease !important;
    cursor: pointer !important;
}

.af-practice-action-link--restart {
    background-color: #ffd2ce !important;
    color: #1a1a1a !important;
    border: 1px solid #4a4a4a !important;
}

.af-practice-action-link--restart:hover {
    background-color: #ffbfb8 !important;
    transform: translateY(-1px);
}

.af-practice-action-link--continue {
    background-color: #ff6f61 !important;
    color: #ffffff !important;
    border: 1px solid #e05d50 !important;
}

.af-practice-action-link--continue:hover {
    background-color: #f45b4c !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

.af-practice-action-link--start {
    background-color: #ffffff !important;
    color: #1a1a1a !important;
    border: 1px solid #4a4a4a !important;
}

.af-practice-action-link--start:hover {
    background-color: #f5f5f5 !important;
    transform: translateY(-1px);
}

/* Speed level animal avatar badge */
.af-speed-level {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    background-color: #ffffff !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 22px 22px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
    vertical-align: middle !important;
}

.af-speed-level--empty {
    background: none !important;
    box-shadow: none !important;
    width: auto !important;
    height: auto !important;
    font-size: 1rem !important;
    color: inherit !important;
}

.af-speed-level--1 { background-image: url(/static/img/speed-levels/level-1-icon-01.svg) !important; }
.af-speed-level--2 { background-image: url(/static/img/speed-levels/level-2-icon-01.svg) !important; }
.af-speed-level--3 { background-image: url(/static/img/speed-levels/level-3-icon-01.svg) !important; }
.af-speed-level--4 { background-image: url(/static/img/speed-levels/level-4-icon-01.svg) !important; }
.af-speed-level--5 { background-image: url(/static/img/speed-levels/level-5-icon-01.svg) !important; }
.af-speed-level--6 { background-image: url(/static/img/speed-levels/level-6-icon-01.svg) !important; }
.af-speed-level--7 { background-image: url(/static/img/speed-levels/level-7-icon-01.svg) !important; }
.af-speed-level--8 { background-image: url(/static/img/speed-levels/level-8-icon-01.svg) !important; }
.af-speed-level--9 { background-image: url(/static/img/speed-levels/level-9-icon-01.svg) !important; }
.af-speed-level--10 { background-image: url(/static/img/speed-levels/level-10-icon-01.svg) !important; }

/* Lesson Title Dropdown Chevron */
.texts-list-title::after {
    content: " ▾";
    font-size: 0.82rem;
    color: #4a4a4a;
    margin-left: 5px;
    display: inline-block;
    vertical-align: middle;
}

/* Lesson Summary Exact Styles (Matching user screenshots) */
.af-summary-action-buttons-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 16px !important;
    margin-top: 28px !important;
    align-items: center !important;
}

.af-summary-pill-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 32px !important;
    border-radius: 999px !important;
    border: 2.5px solid #111312 !important;
    font-size: 1.08rem !important;
    font-weight: 700 !important;
    color: #111312 !important;
    text-decoration: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
    cursor: pointer !important;
    transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease !important;
}

.af-summary-pill-btn:hover {
    transform: translateY(-1.5px) !important;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12) !important;
    color: #111312 !important;
}

.af-summary-pill-btn--continue {
    background-color: #ff6f61 !important;
}
.af-summary-pill-btn--continue:hover {
    background-color: #f75d4e !important;
}

.af-summary-pill-btn--restart {
    background-color: #ffd2ce !important;
}
.af-summary-pill-btn--restart:hover {
    background-color: #ffc4bf !important;
}

.af-summary-pill-btn--next {
    background-color: #ffbf35 !important;
}
.af-summary-pill-btn--next:hover {
    background-color: #f5b222 !important;
}

/* Progress Meter in Summary */
.af-summary-current__progress {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-top: 6px !important;
}

.af-summary-current__progress-meter {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.af-summary-current__progress-track {
    display: inline-block !important;
    width: 140px !important;
    height: 12px !important;
    background-color: #554f47 !important;
    border-radius: 999px !important;
    overflow: hidden !important;
    position: relative !important;
}

.af-summary-current__progress-bar {
    height: 100% !important;
    background-color: #f6c944 !important;
    border-radius: 999px !important;
    transition: width 0.3s ease !important;
}

#typing-summary-current-progress-value {
    font-size: 1.12rem !important;
    font-weight: 700 !important;
    color: #111312 !important;
}

/* History Section and Card */
#typing-summary-history {
    display: block !important;
    background: #ffffff !important;
    border-radius: 16px !important;
    padding: 32px 36px !important;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.05) !important;
    margin-top: 40px !important;
    margin-bottom: 40px !important;
    border: 1px solid #ebe2d5 !important;
}

#typing-summary-history-title {
    font-size: 2.1rem !important;
    font-weight: 800 !important;
    color: #111312 !important;
    margin-bottom: 24px !important;
}
