/* Custom styles for SQLQuiz */

/* Code example styling - ensure visibility */
.bg-dark pre, .bg-dark code {
    color: #f8f9fa !important;
    background: transparent !important;
}

.bg-dark pre code {
    color: inherit !important;
}

/* Font size controls for query results */
.font-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.font-controls .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1;
    min-width: 2rem;
}

/* Query result font sizes */
.result-font-xs { font-size: 10px !important; }
.result-font-xs th, .result-font-xs td { padding: 0.25rem !important; }

.result-font-sm { font-size: 12px !important; }
.result-font-sm th, .result-font-sm td { padding: 0.375rem !important; }

.result-font-md { font-size: 14px !important; }
.result-font-md th, .result-font-md td { padding: 0.5rem !important; }

.result-font-lg { font-size: 16px !important; }
.result-font-lg th, .result-font-lg td { padding: 0.625rem !important; }

.result-font-xl { font-size: 18px !important; }
.result-font-xl th, .result-font-xl td { padding: 0.75rem !important; }

/* CodeMirror customizations */
.CodeMirror {
    border: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.CodeMirror-scroll {
    padding: 15px;
}

.CodeMirror-gutters {
    background-color: #f8f9fa;
    border-right: 1px solid #e9ecef;
}

.CodeMirror-linenumber {
    color: #6c757d;
    padding-right: 10px;
}

/* Card hover effects */
.card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

/* Result table styling */
.table-responsive {
    border-radius: 0.375rem;
}

.table th {
    border-top: none;
    font-weight: 600;
    white-space: nowrap;
}

/* Light table headers (default) */
.table thead:not(.table-dark) th {
    background-color: #f8f9fa;
    color: #495057;
}

/* Dark table headers (for results) */
.table thead.table-dark th {
    background-color: #343a40;
    color: #ffffff;
    border-color: #454d55;
}

.table td {
    vertical-align: middle;
}

/* Progress bar styling */
.progress {
    height: 8px;
    border-radius: 4px;
}

.progress-bar {
    transition: width 0.3s ease;
}

/* Alert customizations */
.alert {
    border: none;
    border-radius: 0.5rem;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
}

.alert-info {
    background-color: #d1ecf1;
    color: #055160;
}

/* Navigation styling */
.navbar-brand {
    font-weight: 600;
    font-size: 1.5rem;
}

.nav-link {
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: #ffffff !important;
}

/* Button enhancements */
.btn {
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-success {
    background-color: #198754;
    border-color: #198754;
}

.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #000;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

/* Code styling */
code {
    background-color: #f8f9fa;
    color: #d63384;
    padding: 2px 6px;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

/* Badge styling */
.badge {
    font-weight: 500;
    font-size: 0.75em;
}

/* Loading spinner */
.spinner-border {
    width: 2rem;
    height: 2rem;
}

/* Footer */
footer {
    margin-top: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2rem;
    }
    
    .card-body.py-5 {
        padding: 2rem 1rem !important;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 15px;
    }
    
    .card-header h6 {
        font-size: 0.875rem;
    }
    
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Quiz specific styling */
.quiz-question-card {
    border-left: 4px solid #ffc107;
}

.difficulty-easy {
    color: #198754;
}

.difficulty-medium {
    color: #ffc107;
}

.difficulty-hard {
    color: #dc3545;
}

/* Challenge Mode specific styling */
.challenge-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
}

.challenge-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15) !important;
}

.challenge-level-basic {
    border-left: 4px solid #198754;
}

.challenge-level-intermediate {
    border-left: 4px solid #ffc107;
}

.challenge-level-advanced {
    border-left: 4px solid #dc3545;
}

.challenge-level-expert {
    border-left: 4px solid #6f42c1;
}

.bg-light-success {
    background-color: #d1e7dd;
}

.bg-light-danger {
    background-color: #f8d7da;
}

.progress-dashboard {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.challenge-timer {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
}

.hint-box {
    background-color: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.attempt-history {
    max-height: 200px;
    overflow-y: auto;
}

.challenge-score {
    font-size: 1.5rem;
    font-weight: bold;
}

.challenge-feedback {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-top: 1rem;
}

/* Admin interface styling */
.admin-nav-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
}

.admin-nav-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15) !important;
}

.admin-stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.candidate-progress-bar {
    height: 8px;
    border-radius: 4px;
}

.query-code {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 0.75rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 200px;
    overflow-y: auto;
}

.attempt-status-correct {
    color: #198754;
}

.attempt-status-incorrect {
    color: #dc3545;
}

.difficulty-badge-1 {
    background-color: #198754;
}

.difficulty-badge-2 {
    background-color: #ffc107;
    color: #000;
}

.difficulty-badge-3 {
    background-color: #dc3545;
}

.difficulty-badge-4 {
    background-color: #6f42c1;
}

.admin-summary-card {
    border-radius: 0.5rem;
    overflow: hidden;
}

.candidate-detail-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
}

.performance-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.export-button {
    position: sticky;
    top: 1rem;
    z-index: 100;
}

/* Schema modal styling */
.modal-xl {
    max-width: 1200px;
}

.table-sm th,
.table-sm td {
    padding: 0.5rem;
    font-size: 0.875rem;
}

/* Sticky header for large result tables */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 1020;
}

/* Custom scrollbar for webkit browsers */
.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Pagination controls styling */
#paginationControls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

#paginationControls .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    line-height: 1.2;
    min-width: 2rem;
}

.pagination-info {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* Performance warning badge */
.badge.bg-warning {
    color: #000 !important;
}

/* Rows per page selector styling */
#rowsPerPageSelect {
    min-width: 80px;
    max-width: 100px;
}

.pagination-info .form-select-sm {
    font-size: 0.75rem;
    padding: 0.25rem 1.5rem 0.25rem 0.5rem;
}

/* Animation for quiz transitions */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* Success/error icons */
.text-success {
    color: #198754 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-info {
    color: #0dcaf0 !important;
}

/* Loading states */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Challenge Details Formatting */
.challenge-details {
    font-size: 14px;
    line-height: 1.6;
}

.challenge-details .detail-row {
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.challenge-details .detail-row:not(:last-child) {
    border-bottom: 1px solid #e9ecef;
}

.challenge-details .detail-row strong {
    color: #495057;
    font-weight: 600;
    display: inline-block;
    min-width: 120px;
    margin-bottom: 0.25rem;
}

.challenge-details ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

.challenge-details ul li {
    margin-bottom: 0.25rem;
    color: #6c757d;
}

.challenge-details .payor-list {
    columns: 2;
    column-gap: 1.5rem;
    margin-top: 0.5rem;
}

.challenge-details .payor-list li {
    break-inside: avoid;
    color: #495057;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}