/**
 * Interactive Element Styles
 *
 * Styles for LEx interactive learning elements:
 * - reflection, checklist, scenario, commitment, before_after
 */

/* ============================================================================
   BASE STYLES
   ============================================================================ */

.interactive-element {
    margin: 1.5rem 0;
    padding: 1.25rem;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(139, 126, 200, 0.08) 0%, rgba(139, 126, 200, 0.03) 100%);
    border: 1px solid rgba(139, 126, 200, 0.2);
    font-family: var(--font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

.interactive-element:hover {
    border-color: rgba(139, 126, 200, 0.35);
    box-shadow: 0 2px 12px rgba(139, 126, 200, 0.1);
}

/* ============================================================================
   HEADER
   ============================================================================ */

.ie-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(139, 126, 200, 0.15);
}

.ie-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.ie-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8B7EC8;
}

.ie-time {
    margin-left: auto;
    font-size: 0.7rem;
    color: #888;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
}

/* ============================================================================
   PROMPT
   ============================================================================ */

.ie-prompt {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* ============================================================================
   INPUT ELEMENTS
   ============================================================================ */

.ie-input-area {
    margin-bottom: 0.75rem;
}

.ie-textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.ie-textarea:focus {
    outline: none;
    border-color: #8B7EC8;
    box-shadow: 0 0 0 3px rgba(139, 126, 200, 0.15);
}

.ie-textarea-small {
    min-height: 60px;
}

.ie-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.ie-input:focus {
    outline: none;
    border-color: #8B7EC8;
    box-shadow: 0 0 0 3px rgba(139, 126, 200, 0.15);
}

.ie-select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.ie-select:focus {
    outline: none;
    border-color: #8B7EC8;
    box-shadow: 0 0 0 3px rgba(139, 126, 200, 0.15);
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.ie-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(139, 126, 200, 0.1);
}

.ie-status {
    font-size: 0.8rem;
    color: #888;
}

.ie-status.success {
    color: #22c55e;
}

.ie-status.error {
    color: #ef4444;
}

.ie-save-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #8B7EC8 0%, #7B6EB8 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.ie-save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 126, 200, 0.3);
}

.ie-save-btn:active {
    transform: translateY(0);
}

.ie-hint {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
}

.ie-selected-count {
    font-size: 0.8rem;
    color: #8B7EC8;
    font-weight: 500;
}

/* ============================================================================
   CHECKLIST
   ============================================================================ */

.interactive-element.checklist .ie-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ie-checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.ie-checkbox-item:hover {
    border-color: #8B7EC8;
    background: rgba(139, 126, 200, 0.03);
}

.ie-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #8B7EC8;
    cursor: pointer;
}

.ie-checkbox-item input[type="checkbox"]:checked + .ie-checkbox-label {
    color: #333;
}

.ie-checkbox-label {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.4;
}

/* ============================================================================
   SCENARIO
   ============================================================================ */

.interactive-element.scenario .ie-scenario-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ie-scenario-option {
    padding: 0.75rem 1rem;
    background: #fff;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.ie-scenario-option:hover:not(.correct):not(.incorrect) {
    border-color: #8B7EC8;
    background: rgba(139, 126, 200, 0.05);
}

.ie-scenario-option.correct {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
    cursor: default;
}

.ie-scenario-option.incorrect {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
    cursor: default;
}

.ie-option-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.ie-option-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all 0.2s;
}

.ie-scenario-option:hover:not(.correct):not(.incorrect) .ie-option-indicator {
    border-color: #8B7EC8;
}

.ie-scenario-option.correct .ie-option-indicator {
    border-color: #22c55e;
    background: #22c55e;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M10 3L4.5 8.5 2 6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.ie-scenario-option.incorrect .ie-option-indicator {
    border-color: #f59e0b;
    background: #f59e0b;
}

.ie-option-text {
    font-size: 0.95rem;
    color: #333;
    line-height: 1.4;
}

.ie-feedback {
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.ie-feedback.positive {
    background: rgba(34, 197, 94, 0.12);
    color: #166534;
}

.ie-feedback.negative {
    background: rgba(245, 158, 11, 0.12);
    color: #92400e;
}

.interactive-element.scenario.answered .ie-scenario-option:not(.correct):not(.incorrect) {
    opacity: 0.5;
    cursor: default;
}

/* ============================================================================
   COMMITMENT
   ============================================================================ */

.interactive-element.commitment .ie-fields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ie-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ie-field-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
}

/* ============================================================================
   BEFORE/AFTER
   ============================================================================ */

.ie-before-after-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: start;
}

.ie-before-section,
.ie-after-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ie-section-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ie-before-section .ie-section-label {
    color: #888;
}

.ie-after-section .ie-section-label {
    color: #8B7EC8;
}

.ie-arrow {
    font-size: 1.5rem;
    color: #8B7EC8;
    padding-top: 1.8rem;
    font-weight: bold;
}

/* Mobile: Stack vertically */
@media (max-width: 640px) {
    .ie-before-after-container {
        grid-template-columns: 1fr;
    }

    .ie-arrow {
        text-align: center;
        padding: 0.5rem 0;
        transform: rotate(90deg);
    }
}

/* ============================================================================
   ERROR STATE
   ============================================================================ */

.interactive-element.error {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
}

.ie-error-message {
    color: #dc2626;
    font-size: 0.9rem;
}

/* ============================================================================
   DARK MODE SUPPORT
   ============================================================================ */

[data-theme="dark"] .interactive-element {
    background: linear-gradient(135deg, rgba(139, 126, 200, 0.12) 0%, rgba(139, 126, 200, 0.05) 100%);
    border-color: rgba(139, 126, 200, 0.25);
}

[data-theme="dark"] .ie-prompt {
    color: #e5e5e5;
}

[data-theme="dark"] .ie-textarea,
[data-theme="dark"] .ie-input,
[data-theme="dark"] .ie-select {
    background: #2a2a2a;
    border-color: #444;
    color: #e5e5e5;
}

[data-theme="dark"] .ie-checkbox-item,
[data-theme="dark"] .ie-scenario-option {
    background: #2a2a2a;
    border-color: #444;
}

[data-theme="dark"] .ie-checkbox-label,
[data-theme="dark"] .ie-option-text {
    color: #e5e5e5;
}

[data-theme="dark"] .ie-field-label,
[data-theme="dark"] .ie-section-label {
    color: #aaa;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes ie-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.interactive-element {
    animation: ie-fade-in 0.3s ease-out;
}

@keyframes ie-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(139, 126, 200, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(139, 126, 200, 0);
    }
}

.ie-save-btn:focus {
    animation: ie-pulse 1s ease-in-out;
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .interactive-element {
        break-inside: avoid;
        border: 1px solid #ccc;
        background: #f9f9f9;
    }

    .ie-save-btn {
        display: none;
    }

    .ie-textarea,
    .ie-input {
        border: 1px solid #ccc;
    }
}
