/* Modal Styles */

/* Changes Summary Modal */
.changes-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.changes-modal-overlay.show {
    opacity: 1;
}

.changes-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    max-height: 70vh;
    width: 90%;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.changes-modal-overlay.show .changes-modal {
    transform: scale(1) translateY(0);
}

.changes-modal-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #162d4a 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.changes-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.changes-modal-header .icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 14px;
}

.changes-modal-body {
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
}

.changes-summary {
    padding: 20px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    text-align: center;
}

.changes-count {
    font-size: 2rem;
    font-weight: bold;
    color: #059669;
    margin-bottom: 4px;
}

.changes-label {
    color: #64748b;
    font-size: 0.875rem;
}

.changes-list {
    padding: 16px 0;
}

.change-item {
    padding: 12px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.2s ease;
}

.change-item:hover {
    background: #f8fafc;
}

.change-item:last-child {
    border-bottom: none;
}

.change-item .arrow {
    color: #1e3a5f;
    font-weight: 600;
    font-size: 0.875rem;
}

.change-item .old-text {
    background: #fef2f2;
    color: #dc2626;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    border: 1px solid #fecaca;
}

.change-item .new-text {
    background: #f0fdf4;
    color: #059669;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    border: 1px solid #bbf7d0;
}

.changes-modal-footer {
    padding: 20px 24px;
    background: #f8fafc;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid #e2e8f0;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    border: none;
}

.modal-btn-copy {
    background: #1e3a5f;
    color: white;
}

.modal-btn-copy:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.modal-btn-close {
    background: #6b7280;
    color: white;
}

.modal-btn-close:hover {
    background: #4b5563;
}

.copy-success {
    background: #059669 !important;
    transform: scale(1.02);
}

/* Empty state */
.no-changes {
    padding: 40px 24px;
    text-align: center;
    color: #6b7280;
}

.no-changes-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Corrections Panel */
.corrections-panel {
    position: fixed;
    right: 20px;
    top: 100px;
    width: 300px;
    max-height: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    padding: 20px;
    overflow-y: auto;
    z-index: 1500;
    display: none;
}

.corrections-panel.active {
    display: block;
}

.corrections-header {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #1f2937;
}

.correction-item {
    padding: 10px;
    margin-bottom: 10px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.correction-original {
    color: #dc2626;
    text-decoration: line-through;
}

.correction-new {
    color: #16a34a;
    font-weight: 500;
}

.correction-reason {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 5px;
}

/* ============================
   Source Context Modal Styles
   ============================ */

.source-context-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.source-context-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

.context-modal-header {
    background: linear-gradient(135deg, #4a90d9 0%, #2563eb 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.context-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.context-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.context-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.context-modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
    direction: rtl;
    text-align: right;
    line-height: 1.8;
}

.context-verse {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 8px;
    transition: background 0.2s;
}

.context-verse .verse-num {
    font-weight: 600;
    color: #4a90d9;
    margin-left: 8px;
    font-size: 0.9em;
}

.context-before,
.context-after {
    color: #6b7280;
    background: #f9fafb;
}

.context-current {
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    border: 2px solid #3b82f6;
    color: #1e40af;
}

.context-current .verse-num {
    color: #1e40af;
}

/* ============================
   Sources Results Card Styles
   ============================ */

.sources-results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0;
}

.source-result-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 16px;
    transition: all 0.2s ease;
}

.source-result-card:hover {
    border-color: #4a90d9;
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.1);
}

.source-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.source-number {
    font-weight: 700;
    color: #4a90d9;
    font-size: 1rem;
}

.source-reference {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
}

.source-type-badge {
    background: #eff6ff;
    color: #3b82f6;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 12px;
    margin-right: auto;
}

.source-content {
    color: #374151;
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 10px;
    direction: rtl;
    text-align: right;
}

.source-explanation {
    color: #6b7280;
    font-size: 0.85rem;
    font-style: italic;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 10px;
}

.source-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

.source-action-btn {
    background: #f3f4f6;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.2s;
}

.source-action-btn:hover {
    background: #4a90d9;
    color: white;
}

.source-action-btn i.fa-check {
    color: #10b981;
}