/**
 * Quiz Leaderboard - My Results Styles
 * Version: 1.1.0
 */

/* Results Wrapper */
.qll-my-results-wrapper {
    margin: 20px 0;
}

.qll-results-title {
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.qll-login-required {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
}

.qll-no-results {
    padding: 40px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 8px;
    color: #6c757d;
}

/* Results Table */
.qll-results-table-wrapper {
    overflow-x: auto;
}

.qll-results-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.qll-results-table th,
.qll-results-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.qll-results-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.qll-results-table tbody tr:hover {
    background: #f8f9fa;
}

.qll-results-table td.qll-quiz-name {
    font-weight: 500;
    max-width: 200px;
}

.qll-results-table td.qll-date small {
    color: #6c757d;
}

/* Score styling */
.qll-score-value {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

.qll-score-value.qll-pass {
    background: #d4edda;
    color: #155724;
}

.qll-score-value.qll-fail {
    background: #f8d7da;
    color: #721c24;
}

.qll-correct-count {
    color: #28a745;
    font-weight: 600;
}

.qll-wrong-count {
    color: #dc3545;
    font-weight: 600;
}

/* Rank columns */
.qll-rank strong {
    font-size: 14px;
    color: #333;
}

.qll-rank small {
    color: #6c757d;
    font-size: 11px;
}

/* Action buttons */
.qll-actions {
    display: flex;
    gap: 8px;
}

.qll-btn {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.qll-btn-view {
    background: #007bff;
    color: #fff;
}

.qll-btn-view:hover {
    background: #0056b3;
    color: #fff;
}

.qll-btn-download {
    background: #28a745;
    color: #fff;
}

.qll-btn-download:hover {
    background: #218838;
    color: #fff;
}

.qll-btn-primary {
    background: #007bff;
    color: #fff;
    padding: 10px 24px;
}

.qll-btn-primary:hover {
    background: #0056b3;
}

.qll-btn-secondary {
    background: #6c757d;
    color: #fff;
    padding: 10px 24px;
}

.qll-btn-secondary:hover {
    background: #545b62;
}

/* Modal Styles */
.qll-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.qll-modal.active {
    display: block;
}

.qll-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.qll-modal-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: qllModalSlideIn 0.3s ease;
}

@keyframes qllModalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.qll-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.qll-modal-close:hover {
    background: #fff;
    transform: scale(1.1);
}

.qll-modal-content {
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
}

.qll-modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    font-size: 16px;
    color: #666;
}

.qll-modal-loading span::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e0e0e0;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: qllSpin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes qllSpin {
    to { transform: rotate(360deg); }
}

/* Certificate/Result Detail Styles */
.qll-result-certificate {
    padding: 30px;
    background: #fff;
}

.qll-cert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #007bff;
    margin-bottom: 25px;
}

.qll-cert-logo {
    max-height: 60px;
    width: auto;
}

.qll-cert-site-name {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.qll-cert-title h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #007bff;
    letter-spacing: 2px;
}

/* User Info */
.qll-cert-user {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.qll-cert-avatar img {
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.qll-cert-user-info h3 {
    margin: 0 0 5px;
    font-size: 20px;
    color: #333;
}

.qll-cert-user-info p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.qll-cert-location {
    color: #007bff !important;
}

/* Quiz Title */
.qll-cert-quiz {
    text-align: center;
    margin-bottom: 25px;
}

.qll-cert-quiz h2 {
    margin: 0;
    font-size: 22px;
    color: #333;
}

/* Score Section */
.qll-cert-score-section {
    text-align: center;
    margin-bottom: 30px;
}

.qll-cert-score-main {
    display: inline-block;
    padding: 20px 40px;
    border-radius: 12px;
    margin-bottom: 10px;
}

.qll-cert-score-main.qll-pass {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
}

.qll-cert-score-main.qll-fail {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
    color: #fff;
}

.qll-score-number {
    font-size: 48px;
    font-weight: 700;
}

.qll-score-percent {
    font-size: 24px;
    font-weight: 500;
}

.qll-cert-status {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
}

.qll-cert-status.qll-pass {
    color: #28a745;
}

.qll-cert-status.qll-fail {
    color: #dc3545;
}

/* Details Grid */
.qll-cert-details {
    margin-bottom: 30px;
}

.qll-cert-detail-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.qll-cert-detail-item {
    flex: 1;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.qll-cert-detail-item label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.qll-cert-detail-item span {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.qll-cert-detail-item.qll-correct span {
    color: #28a745;
}

.qll-cert-detail-item.qll-wrong span {
    color: #dc3545;
}

/* Rankings */
.qll-cert-rankings {
    margin-bottom: 25px;
}

.qll-cert-rankings h4 {
    margin: 0 0 15px;
    font-size: 16px;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.qll-cert-rank-grid {
    display: flex;
    gap: 15px;
}

.qll-cert-rank-item {
    flex: 1;
    text-align: center;
    padding: 20px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: #fff;
}

.qll-rank-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.qll-rank-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.qll-rank-value strong {
    display: block;
    font-size: 24px;
    font-weight: 700;
}

.qll-rank-value small {
    font-size: 12px;
    opacity: 0.8;
}

/* Footer */
.qll-cert-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.qll-cert-footer p {
    margin: 5px 0;
    font-size: 12px;
    color: #999;
}

.qll-cert-id {
    font-family: monospace;
}

/* Action Buttons */
.qll-cert-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    
    .qll-modal-container,
    .qll-modal-container * {
        visibility: visible;
    }
    
    .qll-modal {
        position: static;
    }
    
    .qll-modal-overlay {
        display: none;
    }
    
    .qll-modal-container {
        position: static;
        transform: none;
        width: 100%;
        max-width: none;
        max-height: none;
        box-shadow: none;
        border-radius: 0;
    }
    
    .qll-modal-close,
    .qll-cert-actions,
    .no-print {
        display: none !important;
    }
    
    .qll-cert-score-main.qll-pass,
    .qll-cert-score-main.qll-fail,
    .qll-cert-rank-item {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .qll-results-table th,
    .qll-results-table td {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .qll-cert-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .qll-cert-user {
        flex-direction: column;
        text-align: center;
    }
    
    .qll-cert-detail-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .qll-cert-rank-grid {
        flex-direction: column;
    }
    
    .qll-modal-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .qll-result-certificate {
        padding: 20px;
    }
    
    .qll-score-number {
        font-size: 36px;
    }
}
