/* =============================================================================
   MLA Calming Overlay — Myopic Loss Aversion intervention

   Shown when SGE detects PANIC_SPIRAL or OBSESSIVE checking patterns.
   Provides a calming "pause" with academic citation and countdown timer.

   Academic basis: Benartzi & Thaler (1995), Iqbal et al (2021).
   ============================================================================= */

/* Overlay backdrop */
.mla-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    z-index: 9600;
    align-items: center;
    justify-content: center;
    animation: mlaFadeIn 0.3s ease;
}

.mla-overlay.active {
    display: flex;
}

/* Card */
.mla-overlay-card {
    background: var(--bg-primary, #1a1a2e);
    border-radius: 16px;
    padding: 32px 36px;
    max-width: 460px;
    width: 92%;
    border-top: 4px solid var(--accent-blue, #4a9eff);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
    text-align: center;
    position: relative;
}

/* Severity variants */
.mla-overlay-card.severity-critical {
    border-top-color: var(--accent-red, #ff4a4a);
}

.mla-overlay-card.severity-high {
    border-top-color: var(--accent-yellow, #f5a623);
}

.mla-overlay-card.severity-medium {
    border-top-color: var(--accent-blue, #4a9eff);
}

/* Breathing animation icon */
.mla-breathing-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(74, 158, 255, 0.3), transparent 70%);
    animation: mlaBreathe 4s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

/* Label */
.mla-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-blue, #4a9eff);
    margin-bottom: 12px;
}

.mla-overlay-card.severity-critical .mla-label {
    color: var(--accent-red, #ff4a4a);
}

/* Title */
.mla-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary, #e8e8e8);
    margin-bottom: 12px;
    line-height: 1.4;
}

/* Message body */
.mla-message {
    font-size: 0.82rem;
    color: var(--text-secondary, #a0a0b0);
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Countdown timer */
.mla-countdown {
    font-size: 0.75rem;
    color: var(--text-tertiary, #707080);
    margin-bottom: 18px;
}

.mla-countdown-value {
    font-weight: 700;
    color: var(--accent-blue, #4a9eff);
    font-variant-numeric: tabular-nums;
}

/* Citation */
.mla-citation {
    font-size: 0.68rem;
    color: var(--text-tertiary, #606070);
    font-style: italic;
    margin-bottom: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--border, #2a2a3e);
}

/* Buttons */
.mla-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mla-btn-dismiss {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg-secondary, #232340);
    border: 1px solid var(--border, #2a2a3e);
    border-radius: 8px;
    color: var(--text-secondary, #a0a0b0);
    cursor: pointer;
    font-size: 0.78rem;
    transition: background 0.15s;
}

.mla-btn-dismiss:hover {
    background: var(--bg-tertiary, #2a2a4e);
}

.mla-btn-pause {
    flex: 1;
    padding: 10px 16px;
    background: var(--accent-blue, #4a9eff);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    transition: opacity 0.15s;
}

.mla-btn-pause:hover {
    opacity: 0.85;
}

/* "Show me why" toggle button */
.mla-why-toggle {
    margin-bottom: 12px;
    text-align: center;
}

.mla-btn-why {
    background: none;
    border: none;
    color: var(--accent-blue, #4a9eff);
    cursor: pointer;
    font-size: 0.72rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 4px 8px;
}

.mla-btn-why:hover {
    color: var(--text-primary, #e8e8e8);
}

/* "Show me why" expanded section */
.mla-why-section {
    background: var(--bg-secondary, #232340);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
    text-align: left;
}

.mla-why-header {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary, #a0a0b0);
    margin-bottom: 10px;
}

.mla-why-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.78rem;
}

.mla-why-label {
    color: var(--text-tertiary, #707080);
}

.mla-why-value {
    color: var(--text-primary, #e8e8e8);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.mla-why-value.mla-why-warn {
    color: var(--accent-yellow, #f5a623);
}

.mla-why-divider {
    border-top: 1px solid var(--border, #2a2a3e);
    margin: 10px 0;
}

.mla-why-explanation {
    font-size: 0.72rem;
    color: var(--text-tertiary, #707080);
    line-height: 1.5;
}

/* "Don't show again today" checkbox row */
.mla-suppress-row {
    margin-top: 12px;
    text-align: center;
}

.mla-suppress-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--text-tertiary, #707080);
}

.mla-suppress-label input[type="checkbox"] {
    accent-color: var(--accent-blue, #4a9eff);
    cursor: pointer;
}

.mla-suppress-label span {
    user-select: none;
}

/* Animations */
@keyframes mlaFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes mlaBreathe {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 1; }
}
