/* ============================================
   INLINE EXPLANATION ENGINE v2.0 — Premium CSS
   Expert-quality, glassmorphism design
   with Hindi/English language toggle
   ============================================ */

/* ── Container ──────────────────────────────── */
.inline-exp-container {
    display: none;
    margin-top: 1rem;
    width: 100%;
    animation: inlineExpSlideIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.inline-exp-container.visible {
    display: block;
}

@keyframes inlineExpSlideIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Card ────────────────────────────────────── */
.inline-exp-card {
    background: rgba(22, 22, 40, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 18px;
    padding: 1.25rem 1.35rem 1.15rem;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

/* ── Top glow accent ─────────────────────────── */
.inline-exp-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 18px 18px 0 0;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    transition: background 0.3s;
}

.inline-exp-glow.glow-correct {
    background: linear-gradient(90deg, #00c853, #69f0ae, #b2ff59);
    box-shadow: 0 0 20px rgba(0, 200, 83, 0.25);
}

.inline-exp-glow.glow-wrong {
    background: linear-gradient(90deg, #ff5252, #ff8a65, #ffd54f);
    box-shadow: 0 0 20px rgba(255, 82, 82, 0.2);
}

/* ── Header ──────────────────────────────────── */
.inline-exp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
    gap: 0.5rem;
}

.inline-exp-header-left {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

/* Status dot (animated pulse) */
.inline-exp-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #667eea;
    flex-shrink: 0;
    animation: dotPulse 2s ease-in-out infinite;
}

.inline-exp-status-dot.dot-correct {
    background: #69f0ae;
    box-shadow: 0 0 8px rgba(105, 240, 174, 0.5);
}

.inline-exp-status-dot.dot-wrong {
    background: #ff8a80;
    box-shadow: 0 0 8px rgba(255, 138, 128, 0.5);
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

/* Title */
.inline-exp-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.92);
    font-family: 'Outfit', 'Noto Sans Devanagari', sans-serif;
    letter-spacing: 0.01em;
}

.inline-exp-card.correct .inline-exp-title {
    color: #69f0ae;
}

.inline-exp-card.wrong .inline-exp-title {
    color: #ff8a80;
}

/* ── Language Toggle ─────────────────────────── */
.inline-exp-lang-toggle {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0.3rem 0.65rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'Outfit', 'Noto Sans Devanagari', sans-serif;
    flex-shrink: 0;
}

.inline-exp-lang-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
}

.inline-exp-lang-toggle:active {
    transform: scale(0.95);
}

.inline-exp-lang-toggle .lang-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.38);
    transition: all 0.25s ease;
    padding: 0.1rem 0.25rem;
    border-radius: 6px;
}

.inline-exp-lang-toggle .lang-label.active {
    color: #fff;
    background: rgba(102, 126, 234, 0.45);
    text-shadow: 0 0 10px rgba(102, 126, 234, 0.4);
}

.inline-exp-lang-toggle .lang-divider {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.15);
    margin: 0 0.15rem;
    pointer-events: none;
}

/* ── Correct Answer Pill ─────────────────────── */
.inline-exp-answer-pill {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.85rem;
    background: rgba(105, 240, 174, 0.08);
    border: 1px solid rgba(105, 240, 174, 0.15);
    border-radius: 12px;
    margin-bottom: 0.8rem;
    transition: all 0.3s;
}

.inline-exp-card.correct .inline-exp-answer-pill {
    background: rgba(105, 240, 174, 0.1);
    border-color: rgba(105, 240, 174, 0.2);
}

.inline-exp-card.wrong .inline-exp-answer-pill {
    background: rgba(255, 138, 128, 0.08);
    border-color: rgba(255, 138, 128, 0.15);
}

.inline-exp-answer-pill .pill-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.inline-exp-answer-pill .pill-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: #69f0ae;
    font-family: 'Outfit', 'Noto Sans Devanagari', sans-serif;
    line-height: 1.4;
    word-break: break-word;
}

.inline-exp-card.wrong .inline-exp-answer-pill .pill-text {
    color: #ff8a80;
}

/* ── Explanation Body ────────────────────────── */
.inline-exp-body {
    margin-bottom: 0.8rem;
}

.inline-exp-body .exp-content {
    font-size: 0.84rem;
    line-height: 1.72;
    color: rgba(255, 255, 255, 0.75);
    font-family: 'Outfit', 'Noto Sans Devanagari', sans-serif;
    padding: 0.7rem 0.9rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border-left: 3px solid rgba(102, 126, 234, 0.4);
}

.inline-exp-card.correct .exp-content {
    border-left-color: rgba(105, 240, 174, 0.4);
}

.inline-exp-card.wrong .exp-content {
    border-left-color: rgba(255, 138, 128, 0.35);
}

.inline-exp-body strong {
    color: #fff;
    font-weight: 700;
}

/* ── Quick Tip ───────────────────────────────── */
.inline-exp-tip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    margin-bottom: 0.8rem;
    background: rgba(255, 193, 7, 0.06);
    border: 1px solid rgba(255, 193, 7, 0.12);
    border-radius: 10px;
    animation: tipFadeIn 0.5s ease 0.3s both;
}

@keyframes tipFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.inline-exp-tip .tip-icon {
    font-size: 0.95rem;
    flex-shrink: 0;
}

.inline-exp-tip .tip-text {
    font-size: 0.78rem;
    color: rgba(255, 193, 7, 0.85);
    font-weight: 500;
    font-family: 'Outfit', 'Noto Sans Devanagari', sans-serif;
    line-height: 1.5;
}

/* ── Next Button ─────────────────────────────── */
.inline-exp-next-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 13px;
    font-size: 0.92rem;
    font-weight: 700;
    font-family: 'Outfit', 'Noto Sans Devanagari', sans-serif;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 18px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
}

.inline-exp-next-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.12));
    opacity: 0;
    transition: opacity 0.3s;
}

.inline-exp-next-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 7px 25px rgba(102, 126, 234, 0.4);
}

.inline-exp-next-btn:hover::before {
    opacity: 1;
}

.inline-exp-next-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.inline-exp-next-btn svg {
    transition: transform 0.3s;
    flex-shrink: 0;
}

.inline-exp-next-btn:hover svg {
    transform: translateX(3px);
}

/* Correct variant */
.inline-exp-card.correct .inline-exp-next-btn {
    background: linear-gradient(135deg, #00c853, #00e676);
    box-shadow: 0 4px 18px rgba(0, 200, 83, 0.3);
}

.inline-exp-card.correct .inline-exp-next-btn:hover {
    box-shadow: 0 7px 25px rgba(0, 200, 83, 0.4);
}

/* Wrong variant */
.inline-exp-card.wrong .inline-exp-next-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

/* ════════════════════════════════════════════
   LIGHT THEME
   ════════════════════════════════════════════ */
[data-theme="light"] .inline-exp-card {
    background: rgba(255, 255, 255, 0.97);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.03) inset;
}

[data-theme="light"] .inline-exp-title {
    color: #1a1a2e;
}

[data-theme="light"] .inline-exp-card.correct .inline-exp-title {
    color: #00873e;
}

[data-theme="light"] .inline-exp-card.wrong .inline-exp-title {
    color: #c62828;
}

[data-theme="light"] .inline-exp-answer-pill {
    background: rgba(0, 200, 83, 0.06);
    border-color: rgba(0, 200, 83, 0.15);
}

[data-theme="light"] .inline-exp-answer-pill .pill-text {
    color: #00873e;
}

[data-theme="light"] .inline-exp-card.wrong .inline-exp-answer-pill {
    background: rgba(198, 40, 40, 0.05);
    border-color: rgba(198, 40, 40, 0.12);
}

[data-theme="light"] .inline-exp-card.wrong .inline-exp-answer-pill .pill-text {
    color: #c62828;
}

[data-theme="light"] .inline-exp-body .exp-content {
    color: #444;
    background: rgba(0, 0, 0, 0.02);
    border-left-color: rgba(102, 126, 234, 0.35);
}

[data-theme="light"] .inline-exp-card.correct .exp-content {
    border-left-color: rgba(0, 200, 83, 0.35);
}

[data-theme="light"] .inline-exp-card.wrong .exp-content {
    border-left-color: rgba(198, 40, 40, 0.3);
}

[data-theme="light"] .inline-exp-body strong {
    color: #1a1a2e;
}

[data-theme="light"] .inline-exp-lang-toggle {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .inline-exp-lang-toggle:hover {
    background: rgba(0, 0, 0, 0.07);
}

[data-theme="light"] .inline-exp-lang-toggle .lang-label {
    color: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .inline-exp-lang-toggle .lang-label.active {
    color: #fff;
    background: rgba(102, 126, 234, 0.55);
}

[data-theme="light"] .inline-exp-lang-toggle .lang-divider {
    color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .inline-exp-tip {
    background: rgba(255, 152, 0, 0.06);
    border-color: rgba(255, 152, 0, 0.12);
}

[data-theme="light"] .inline-exp-tip .tip-text {
    color: rgba(230, 126, 0, 0.9);
}

[data-theme="light"] .inline-exp-status-dot.dot-correct {
    background: #00c853;
    box-shadow: 0 0 6px rgba(0, 200, 83, 0.4);
}

[data-theme="light"] .inline-exp-status-dot.dot-wrong {
    background: #e53935;
    box-shadow: 0 0 6px rgba(229, 57, 53, 0.3);
}

/* ════════════════════════════════════════════
   MOBILE RESPONSIVE
   ════════════════════════════════════════════ */
@media (max-width: 600px) {
    .inline-exp-card {
        padding: 1rem 1rem 0.9rem;
        border-radius: 14px;
    }

    .inline-exp-title {
        font-size: 0.82rem;
    }

    .inline-exp-body .exp-content {
        font-size: 0.8rem;
        padding: 0.6rem 0.75rem;
        line-height: 1.65;
    }

    .inline-exp-answer-pill {
        padding: 0.45rem 0.7rem;
    }

    .inline-exp-answer-pill .pill-text {
        font-size: 0.78rem;
    }

    .inline-exp-next-btn {
        padding: 0.72rem 1rem;
        font-size: 0.85rem;
        border-radius: 11px;
    }

    .inline-exp-lang-toggle {
        padding: 0.25rem 0.5rem;
    }

    .inline-exp-lang-toggle .lang-label {
        font-size: 0.68rem;
    }

    .inline-exp-tip {
        padding: 0.4rem 0.65rem;
    }

    .inline-exp-tip .tip-text {
        font-size: 0.73rem;
    }
}
