/* Referral Details Modal Styles */
.referral-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.referral-modal.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.referral-modal-content {
    background-color: #fff;
    margin: 15px;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.referral-modal-header {
    background: linear-gradient(135deg, #2271b1, #1e5a8a);
    color: white;
    padding: 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.referral-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.referral-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.referral-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.referral-modal-body {
    padding: 20px;
}

.referral-summary {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    border-left: 4px solid #2271b1;
}

.referral-summary h4 {
    margin: 0 0 10px 0;
    color: #2271b1;
    font-size: 16px;
}

.referral-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    transition: box-shadow 0.3s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #2271b1;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.referral-details-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.referral-details-table th,
.referral-details-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.referral-details-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2271b1;
    font-size: 14px;
}

.referral-details-table tbody tr:hover {
    background: #f8f9fa;
}

.referral-progress {
    margin: 15px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 5px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    transition: width 0.3s ease;
}

.modal-section {
    margin-bottom: 25px;
}

.modal-section h5 {
    margin: 0 0 15px 0;
    color: #2271b1;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2271b1;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    margin-right: 10px;
}

.user-info-inline {
    display: flex;
    align-items: center;
}

.user-details {
    line-height: 1.4;
}

.user-name {
    font-weight: 600;
    color: #2271b1;
}

.user-email {
    color: #666;
    font-size: 13px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .referral-modal-content {
        margin: 10px;
        width: calc(100% - 20px);
        max-height: 90vh;
    }
    
    .referral-modal-header {
        padding: 15px;
    }
    
    .referral-modal-title {
        font-size: 16px;
    }
    
    .referral-modal-body {
        padding: 15px;
    }
    
    .referral-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .referral-details-table {
        font-size: 14px;
    }
    
    .referral-details-table th,
    .referral-details-table td {
        padding: 8px;
    }
}

/* Loading State */
.modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}

.modal-loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tooltip styles */
.referral-tooltip {
    position: relative;
    cursor: help;
}

.referral-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
}

.referral-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}
