.result-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    backdrop-filter: blur(5px);
}

.result-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.result-popup.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.popup-header {
    background: linear-gradient(135deg, var(--theme-color) 0%, #4a6cf7 100%);
    color: white;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid rgba(255, 255, 255, 0.2);
}

.popup-title {
    margin: 0;
    font-size: 24px;
    display: flex;
    align-items: center;
}

.popup-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 20px;
}

.popup-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.popup-content {
    padding: 30px;
    overflow-y: auto;
    max-height: calc(85vh - 150px);
}

.popup-footer {
    padding: 20px 30px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
}

/* تنسيقات الجدول */
.table {
    border-color: #dee2e6;
    margin-bottom: 0;
}

.table th {
    background-color: #f8f9fa;
    color: var(--title-color);
    font-weight: 600;
    border-bottom: 2px solid var(--theme-color);
    text-align: center;
}

.table td {
    text-align: center;
    vertical-align: middle;
    padding: 12px 8px;
}

.table-hover tbody tr:hover {
    background-color: rgba(62, 102, 243, 0.05);
}

/* تنسيقات البادجات */
.badge {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 50px;
}

.badge.connected {
    background-color: #d1e7dd;
    color: #0a3622;
}

.badge.disconnected {
    background-color: #f8d7da;
    color: #58151c;
}

/* تنسيقات الحالة في الجدول */
.connection-status {
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
}

.status-connected {
    background-color: #d1e7dd;
    color: #0a3622;
}

.status-disconnected {
    background-color: #f8d7da;
    color: #58151c;
}

.status-possible {
    background-color: #fff3cd;
    color: #664d03;
}

/* تنسيقات السند الكامل */
.chain-text-container {
    border-left: 4px solid var(--theme-color);
}

/* تنسيقات الرواة في السند */
.narrator-highlight {
    color: var(--theme-color);
    font-weight: 600;
    position: relative;
    display: inline-block;
    padding: 0 5px;
}

.narrator-highlight::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: rgba(62, 102, 243, 0.2);
    border-radius: 2px;
}

/* تحسينات للجوال */
@media (max-width: 768px) {
    .chain-check-form {
        padding: 30px 20px;
    }
    
    .result-popup {
        width: 95%;
        max-height: 90vh;
    }
    
    .popup-header {
        padding: 20px;
    }
    
    .popup-title {
        font-size: 20px;
    }
    
    .popup-content {
        padding: 20px;
        max-height: calc(90vh - 140px);
    }
    
    .popup-footer {
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
    }
    
    .popup-footer .th-btn {
        width: 100%;
        margin: 0 !important;
    }
    
    .table {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 8px 5px;
    }
}

@media (max-width: 576px) {
    .table {
        display: block;
        overflow-x: auto;
    }
    
    .table th,
    .table td {
        min-width: 120px;
    }
}
