/* Diff Visualization Styles - Phase 6: Educational Diffs */

/* Addition decorations - green background with left border */
.diff-addition {
    background-color: rgba(0, 255, 0, 0.15) !important;
    border-left: 3px solid #4caf50 !important;
}

.diff-glyph-addition {
    background-color: #4caf50 !important;
    width: 5px !important;
}

/* Deletion decorations - red background with strikethrough */
.diff-deletion {
    background-color: rgba(255, 0, 0, 0.1) !important;
    text-decoration: line-through !important;
    opacity: 0.6 !important;
}

.diff-glyph-deletion {
    background-color: #f44336 !important;
    width: 5px !important;
}

/* Modification decorations - orange (treat as special addition) */
.diff-modification {
    background-color: rgba(255, 165, 0, 0.15) !important;
    border-left: 3px solid #ff9800 !important;
}

.diff-glyph-modification {
    background-color: #ff9800 !important;
    width: 5px !important;
}

/* Info icon widget for explanations */
.diff-info-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #2196F3;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
    user-select: none;
    line-height: 1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.diff-info-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Modal overlay - transparent over editor, frosted over chat */
.diff-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    pointer-events: auto;
}

.diff-modal-overlay-editor {
    position: absolute;
    top: 0;
    left: 0;
    width: 33.33%; /* 1/3 of viewport - matches editor panel */
    height: 100%;
    background: transparent;
}

.diff-modal-overlay-chat {
    position: absolute;
    top: 0;
    left: 33.33%;
    right: 33.33%; /* middle panel */
    height: 100%;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(2px);
}

/* Explanation popup - extends rightward from editor */
.diff-explanation-popup {
    position: fixed;
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 320px;
    font-size: 14px;
    z-index: 1001;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    animation: slideIn 0.2s ease-out;
}

.diff-explanation-popup .popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.diff-explanation-popup .popup-title {
    font-weight: 600;
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.diff-explanation-popup .close-button {
    background: transparent;
    border: none;
    color: #999;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.diff-explanation-popup .close-button:hover {
    background: #f0f0f0;
    color: #333;
}

.diff-explanation-popup .explanation-text {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #333;
}

.diff-explanation-popup .delete-button {
    background: #f44336;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
    width: 100%;
}

.diff-explanation-popup .delete-button:hover {
    background: #d32f2f;
}

.diff-explanation-popup .delete-button:active {
    background: #b71c1c;
}

/* Popup slide-in animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Special fade-in for late-arriving explanations (two-pass) */
.explanation-fade-in {
    animation: explanationFadeIn 0.4s ease-out !important;
}

@keyframes explanationFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
    .diff-info-icon {
        background: #1976D2;
    }

    .diff-modal-overlay-chat {
        background: rgba(0, 0, 0, 0.25);
    }

    .diff-explanation-popup {
        background: #2d2d2d;
        border-color: #555;
        color: #e0e0e0;
    }

    .diff-explanation-popup .popup-title {
        color: #aaa;
    }

    .diff-explanation-popup .close-button {
        color: #999;
    }

    .diff-explanation-popup .close-button:hover {
        background: #3d3d3d;
        color: #fff;
    }

    .diff-explanation-popup .explanation-text {
        color: #e0e0e0;
    }
}