/* ============================================================
   UREKA SPEAK v6.0  — Full UI Stylesheet
   ============================================================ */

/* --- Reset & Container --- */
#ureka-app {
    max-width: 420px;
    margin: 20px auto;
    background: #0d1117;
    border: 1px solid #1e2a38;
    border-radius: 28px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    height: 760px;
    position: relative;
}
#ureka-app * { box-sizing: border-box; }
#ureka-app img { max-width: 100%; height: auto; display: block; }
#ureka-app p, #ureka-app h2, #ureka-app h3 { margin: 0; padding: 0; line-height: 1.5; }
#ureka-app button { background: none; border: none; outline: none; padding: 0; cursor: pointer; }
.app-screen { display: flex; flex-direction: column; flex-grow: 1; overflow: hidden; height: 100%; }

/* --- Header --- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #111827;
    border-bottom: 1px solid #1e2a38;
    flex-shrink: 0;
}
.menu-icon { font-size: 20px; color: #94a3b8; cursor: pointer; padding: 5px; transition: color 0.2s; }
.menu-icon:hover { color: #e2e8f0; }
.title-area h2 { font-size: 15px; font-weight: 700; color: #f1f5f9; }
.subtitle { font-size: 11px; color: #64748b; }
.dot-green { display: inline-block; width: 6px; height: 6px; background: #22c55e; border-radius: 50%; margin-right: 4px; animation: blink 2s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }
.stats-area { display: flex; gap: 8px; font-size: 12px; font-weight: 600; min-width: 50px; justify-content: flex-end; }
.streak { background: #1f2937; color: #f97316; padding: 4px 10px; border-radius: 12px; border: 1px solid #374151; }

/* --- Global Progress Bar --- */
.global-progress-wrap {
    background: #1e2a38;
    height: 28px;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
}
.global-progress-bar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
    transition: width 0.6s ease;
    border-radius: 0 4px 4px 0;
}
.global-progress-label {
    position: relative;
    z-index: 1;
    font-size: 10px;
    color: #e2e8f0;
    font-weight: 700;
    width: 100%;
    text-align: center;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

/* ============================================================
   CALL SCREEN CENTER
   ============================================================ */
#call-screen-center {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 30%, #1a2540 0%, #0d1117 70%);
    padding: 20px 20px 10px;
    position: relative;
    overflow: hidden;
}

/* ============================================================
   ANIMATED AVATAR — Half-body cartoon teacher
   ============================================================ */
.avatar-stage {
    position: relative;
    width: 200px;
    height: 220px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: 18px;
    flex-shrink: 0;
}

/* Sound wave rings */
.sound-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
}
.avatar-speaking .sound-ring { animation: ring-expand 1.8s ease-out infinite; }
.r1 { width: 130px; height: 130px; animation-delay: 0s !important; }
.r2 { width: 170px; height: 170px; animation-delay: 0.4s !important; }
.r3 { width: 210px; height: 210px; animation-delay: 0.8s !important; }
.avatar-speaking .sound-ring { border-color: rgba(99, 102, 241, 0.6); }
.avatar-listening .sound-ring { border-color: rgba(34, 197, 94, 0.6); animation: ring-expand 1.2s ease-out infinite; }
.avatar-listening .r1 { animation-delay: 0s !important; }
.avatar-listening .r2 { animation-delay: 0.3s !important; }
.avatar-listening .r3 { animation-delay: 0.6s !important; }
@keyframes ring-expand {
    0%   { transform: translate(-50%,-50%) scale(0.7); opacity: 0.8; }
    100% { transform: translate(-50%,-50%) scale(1.4); opacity: 0; }
}

/* Body assembly */
.avatar-body {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
    transition: transform 0.15s ease;
}

/* Torso */
.avatar-torso {
    width: 120px;
    height: 80px;
    background: linear-gradient(160deg, #f97316 40%, #1e40af 100%);
    border-radius: 20px 20px 0 0;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-top: -6px;
}
.avatar-collar {
    width: 36px;
    height: 20px;
    background: #1e3a8a;
    border-radius: 0 0 18px 18px;
    margin-top: 0;
}
.avatar-arm {
    position: absolute;
    width: 22px;
    height: 65px;
    background: linear-gradient(180deg, #f97316, #c2410c);
    border-radius: 10px;
    top: 12px;
}
.left-arm  { left: -18px; transform: rotate(8deg); }
.right-arm { right: -18px; transform: rotate(-8deg); }

/* Neck */
.avatar-neck {
    width: 28px;
    height: 14px;
    background: #fbbf8a;
    border-radius: 4px;
}

/* Head */
.avatar-head {
    width: 110px;
    height: 110px;
    background: linear-gradient(160deg, #fde3c0 60%, #f5c193 100%);
    border-radius: 55% 55% 50% 50%;
    position: relative;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    overflow: visible;
}

/* Hair */
.avatar-hair {
    position: absolute;
    top: -12px; left: 10px;
    width: 90px;
    height: 42px;
    background: #5c3317;
    border-radius: 50% 50% 0 0;
    z-index: 1;
}
.avatar-hair-side {
    position: absolute;
    width: 22px;
    height: 38px;
    background: #5c3317;
    bottom: 8px;
    border-radius: 50%;
}
.avatar-hair-side.left  { left: -6px; }
.avatar-hair-side.right { right: -6px; }

/* Face */
.avatar-face {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 18px;
}
.avatar-eye {
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 36px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}
.left-eye  { left: 24px; }
.right-eye { right: 24px; }
.pupil {
    width: 10px;
    height: 10px;
    background: #1e293b;
    border-radius: 50%;
    position: absolute;
    top: 4px; left: 4px;
    transition: transform 0.3s ease;
}
/* Pupil moves on thinking */
.avatar-thinking .pupil { transform: translateY(-3px); }
/* Eyes slightly widen when speaking */
.avatar-speaking .avatar-eye { height: 20px; }

.avatar-nose {
    position: absolute;
    width: 6px;
    height: 8px;
    background: #e8a070;
    border-radius: 50%;
    top: 58px; left: 50%;
    transform: translateX(-50%);
}

/* Mouth */
.avatar-mouth {
    position: absolute;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.mouth-top {
    width: 36px;
    height: 5px;
    background: #c0705a;
    border-radius: 5px 5px 0 0;
}
.mouth-gap {
    width: 32px;
    height: 2px; /* opened by JS lip sync */
    background: #1e293b;
    transition: height 0.08s ease;
    overflow: hidden;
}
.mouth-bottom {
    width: 36px;
    height: 5px;
    background: #c0705a;
    border-radius: 0 0 5px 5px;
}

/* Cheek blush */
.avatar-face::before,
.avatar-face::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 10px;
    background: rgba(255, 130, 120, 0.25);
    border-radius: 50%;
    top: 64px;
}
.avatar-face::before { left: 10px; }
.avatar-face::after  { right: 10px; }

/* Pointing finger */
.pointing-finger {
    position: absolute;
    bottom: -10px;
    right: -8px;
    font-size: 22px;
    opacity: 0;
    transform: rotate(0deg);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.pointing-finger.finger-active {
    opacity: 1;
    animation: finger-wag 0.5s ease-in-out infinite alternate;
}
@keyframes finger-wag {
    from { transform: rotate(-15deg); }
    to   { transform: rotate(10deg); }
}

/* Avatar ring states */
.avatar-listening { /* rings handled above */ }
.avatar-thinking .avatar-body {
    animation: head-tilt 1.8s ease-in-out infinite alternate;
}
@keyframes head-tilt {
    from { transform: rotate(-3deg); }
    to   { transform: rotate(3deg); }
}
.avatar-speaking .avatar-body {
    animation: body-sway 0.6s ease-in-out infinite alternate;
}
@keyframes body-sway {
    from { transform: translateX(-3px); }
    to   { transform: translateX(3px); }
}

/* --- Tutor name & status --- */
#tutor-call-name {
    font-size: 18px;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 6px !important;
}
#tutor-status-text {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
    height: 20px;
    text-align: center;
}

/* --- Feedback Badge --- */
.feedback-badge {
    margin-top: 10px;
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.3s ease;
    animation: badge-pop 0.3s ease;
}
.feedback-badge.hidden { opacity: 0; pointer-events: none; transform: scale(0.8); }
.badge-perfect { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; box-shadow: 0 4px 15px rgba(34,197,94,0.4); }
.badge-close   { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; box-shadow: 0 4px 15px rgba(245,158,11,0.4); }
@keyframes badge-pop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ============================================================
   LEVEL PROGRESS BAR (in-call)
   ============================================================ */
.level-progress-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: #111827;
    border-top: 1px solid #1e2a38;
    flex-shrink: 0;
}
.level-prog-title { font-size: 10px; color: #64748b; font-weight: 700; white-space: nowrap; min-width: 48px; }
.level-progress-track {
    flex-grow: 1;
    height: 8px;
    background: #1e2a38;
    border-radius: 4px;
    overflow: hidden;
}
.level-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    border-radius: 4px;
    transition: width 0.5s ease;
}
.level-prog-pct { font-size: 10px; color: #94a3b8; font-weight: 700; white-space: nowrap; min-width: 36px; text-align: right; }

/* ============================================================
   CONTROL AREA
   ============================================================ */
.control-area {
    background: #111827;
    padding: 18px 20px;
    text-align: center;
    border-top: 1px solid #1e2a38;
    flex-shrink: 0;
}
.call-btn {
    color: #ffffff;
    border: none;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 700;
    width: 100%;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}
.call-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-green { background: linear-gradient(135deg, #22c55e, #16a34a); box-shadow: 0 4px 15px rgba(34,197,94,0.35); }
.btn-red   { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 4px 15px rgba(239,68,68,0.35); }

#active-mic-ui { display: flex; justify-content: center; margin-top: 12px; }
.mic-btn {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #7c3aed) !important;
    color: white;
    font-size: 26px;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.recording-pulse {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5) !important;
    animation: mic-pulse 1.2s infinite;
}
@keyframes mic-pulse {
    0%   { transform: scale(1);   box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
    70%  { transform: scale(1.08); box-shadow: 0 0 0 14px rgba(239,68,68,0); }
    100% { transform: scale(1);   box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

/* ============================================================
   CURRICULUM SCREEN
   ============================================================ */
#screen-curriculum .app-header { background: #111827; }
.curriculum-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 14px;
    background: #0d1117;
    scrollbar-width: thin;
    scrollbar-color: #2d3748 transparent;
}
.curriculum-list::-webkit-scrollbar { width: 4px; }
.curriculum-list::-webkit-scrollbar-thumb { background: #2d3748; border-radius: 4px; }

.curr-level-box { margin-bottom: 22px; }
.level-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #1e2a38;
}
.level-title { font-size: 12px; font-weight: 700; color: #94a3b8; flex-grow: 1; margin: 0 !important; }
.level-mini-bar-wrap {
    width: 60px;
    height: 5px;
    background: #1e2a38;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}
.level-mini-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    border-radius: 3px;
    transition: width 0.5s ease;
}
.level-mini-pct { font-size: 10px; color: #64748b; font-weight: 700; min-width: 26px; text-align: right; }

.topic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.topic-card {
    background: #111827 !important;
    border: 1px solid #1e2a38;
    border-radius: 10px;
    padding: 10px 8px;
    text-align: left;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
    position: relative;
}
.topic-card:hover { border-color: #6366f1; box-shadow: 0 4px 12px rgba(99,102,241,0.2); transform: translateY(-2px); }
.topic-card.completed { border-color: #166534; background: #052e16 !important; }
.topic-num  { background: #1e2a38; color: #64748b; font-size: 9px; font-weight: 700; padding: 3px 6px; border-radius: 5px; flex-shrink: 0; }
.topic-name { font-size: 11px; font-weight: 600; color: #e2e8f0; line-height: 1.4; flex-grow: 1; }
.topic-tick { font-size: 13px; flex-shrink: 0; align-self: center; }
.topic-tick.done { color: #22c55e; }
