/* Test Viewer Standalone CSS - Complete and Independent */

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header h1 {
    margin: 0 0 10px 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.header p {
    margin: 0;
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Navigation */
.navigation {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-link {
    padding: 10px 20px;
    background: #f8f9fa;
    color: #495057;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    background: #007bff;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

/* Test List Section */
.test-list-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 30px;
}

.test-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.test-list-header h2 {
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
}

.test-list-actions {
    display: flex;
    gap: 10px;
}

/* Test Filters */
.test-filters {
    display: flex;
    gap: 20px;
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    align-items: center;
}

.search-box {
    flex: 1;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.filter-options select {
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-options select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Tests Grid */
.tests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    padding: 30px;
}

.test-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.test-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.test-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
}

.test-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.test-card-title {
    font-size: 1.3em;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    line-height: 1.3;
}

.test-card-id {
    background: #e9ecef;
    color: #6c757d;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
}

.test-card-description {
    color: #6c757d;
    font-size: 0.95em;
    margin-bottom: 15px;
    line-height: 1.4;
}

.test-card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.test-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #495057;
}

.test-meta-icon {
    font-size: 1.1em;
}

.test-card-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.test-stats-item {
    text-align: center;
}

.test-stats-value {
    display: block;
    font-size: 1.2em;
    font-weight: 600;
    color: #007bff;
}

.test-stats-label {
    font-size: 0.8em;
    color: #6c757d;
    margin-top: 2px;
}

.test-card-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.test-card:hover .test-card-actions {
    opacity: 1;
}

.test-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
}

.test-action-btn.edit {
    background: #ffc107;
    color: #212529;
}

.test-action-btn.delete {
    background: #dc3545;
    color: white;
}

.test-action-btn:hover {
    transform: scale(1.1);
}

/* Loading State */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 1.1em;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 0 0 10px 0;
    color: #495057;
}

.empty-state p {
    margin: 0;
    font-size: 1.1em;
}

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

.large-modal {
    width: 90%;
    max-width: 1400px;
    max-height: 95vh;
}

/* Edit questions container - 2 columns layout */
.edit-questions-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.edit-questions-column {
    display: flex;
    flex-direction: column;
}

.current-questions-list,
.available-questions-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    background: #fafafa;
}

.no-questions {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

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

/* Improved question items in edit mode */
.test-question-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.test-question-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.test-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.test-question-id {
    font-weight: bold;
    color: #2c5aa0;
    background: #e3f2fd;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

.test-question-meta {
    display: flex;
    gap: 8px;
    font-size: 0.8em;
}

.test-question-meta span {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    color: #666;
}

.test-question-text {
    margin-bottom: 12px;
    line-height: 1.4;
    color: #333;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.test-question-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.test-question-points {
    display: flex;
    align-items: center;
    gap: 5px;
}

.points-label {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

.points-input {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 0.9em;
}

.points-input:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.1);
}

/* Available questions styling */
.available-question-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.available-question-item:hover {
    border-color: #2c5aa0;
    box-shadow: 0 2px 8px rgba(44, 90, 160, 0.1);
}

.available-question-item.selected {
    border-color: #4caf50;
    background: #f1f8e9;
}

.available-question-item .question-preview {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 8px;
    line-height: 1.3;
    max-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.available-question-item .question-meta {
    display: flex;
    gap: 6px;
    font-size: 0.75em;
    color: #888;
    margin-bottom: 8px;
}

.available-question-item .add-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8em;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.available-question-item:hover .add-button {
    opacity: 1;
}

.available-question-item.selected .add-button {
    background: #f44336;
    opacity: 1;
}

/* Responsive design for edit modal */
@media (max-width: 1200px) {
    .edit-questions-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .large-modal {
        width: 95%;
        max-width: 1000px;
    }
}

@media (max-width: 768px) {
    .large-modal {
        width: 98%;
        max-height: 98vh;
    }
    
    .test-question-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .test-question-points {
        justify-content: center;
    }
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
}

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

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 25px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Test Detail Styles */
.test-detail-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

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

.test-detail-meta-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.test-detail-meta-icon {
    font-size: 1.2em;
    color: #007bff;
}

.test-detail-meta-label {
    font-weight: 500;
    color: #495057;
    margin-right: 5px;
}

.test-detail-meta-value {
    color: #6c757d;
}

.test-detail-description {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    color: #6c757d;
    font-style: italic;
    margin-top: 15px;
}

.test-questions-section {
    margin-top: 20px;
}

.test-questions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.test-questions-header h4 {
    margin: 0;
    color: #495057;
    font-size: 1.2em;
}

/* Question Item Styles - Standalone */
.question-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.question-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.question-id {
    display: flex;
    align-items: center;
}

.id-badge {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.question-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.question-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.9rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #495057;
}

.question-content {
    padding: 1.5rem;
}

.question-text {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    color: #212529;
}

.question-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Options Display */
.options {
    margin: 1rem 0;
}

.option {
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.option.correct {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.option:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

/* Eval Answer Display */
.eval-answer {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-weight: bold;
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.eval-answer.true {
    background: #28a745;
    color: white;
}

.eval-answer.false {
    background: #dc3545;
    color: white;
}

/* Fill Blank Display */
.fill-blank-option {
    background: #e8f5e8;
    border: 2px solid #c3e6c3;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fill-blank-number {
    background: #28a745;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.fill-blank-answer {
    color: #2d5a2d;
    font-weight: 500;
    font-size: 1rem;
}

/* Explanation and Tags */
.explanation {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    color: #0c5460;
}

.tags {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem;
    margin: 1rem 0;
    color: #495057;
    font-size: 0.9rem;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

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

.btn-primary:hover {
    color: #fff;
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    color: #fff;
    background-color: #5c636a;
    border-color: #565e64;
}

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

.btn-success:hover {
    color: #fff;
    background-color: #157347;
    border-color: #146c43;
}

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

.btn-warning:hover {
    color: #000;
    background-color: #ffca2c;
    border-color: #ffc720;
}

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

.btn-danger:hover {
    color: #fff;
    background-color: #bb2d3b;
    border-color: #b02a37;
}

.btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tests-grid {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    
    .test-filters {
        flex-direction: column;
        gap: 15px;
    }
    
    .test-list-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .test-list-actions {
        width: 100%;
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .test-detail-meta {
        grid-template-columns: 1fr;
    }
    
    .question-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .nav-link {
        text-align: center;
    }
    
    .test-card-actions {
        position: static;
        opacity: 1;
        margin-top: 15px;
        justify-content: center;
    }
}
