* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

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

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

.tabs {
    display: flex;
    margin-bottom: 2rem;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab {
    flex: 1;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    background: white;
    border: none;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.tab.active {
    background: #667eea;
    color: white;
}

.tab:hover {
    background: #f0f0f0;
}

.tab.active:hover {
    background: #5a6fd8;
}

.tab-content {
    display: none;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-content.active {
    display: block;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
}

.options-container {
    margin-top: 1rem;
}

.option-input {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.option-input input {
    flex: 1;
    margin-right: 1rem;
}

.option-input input[type="radio"] {
    width: auto;
    margin-right: 0.5rem;
}

.btn {
    background: #667eea;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.btn:hover {
    background: #5a6fd8;
}

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

.btn-secondary:hover {
    background: #5a6268;
}

.question-list, .test-list {
    margin-top: 2rem;
}

.question-item, .test-item {
    background: #f8f9fa;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.question-item h3, .test-item h3 {
    color: #333;
    margin-bottom: 0.5rem;
}

.question-meta, .test-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.options {
    margin: 1rem 0;
}

.option {
    padding: 0.5rem;
    margin: 0.25rem 0;
    background: white;
    border-radius: 4px;
    border: 1px solid #ddd;
}

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

/* Eval question styles */
.eval-container {
    margin-top: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px solid #dee2e6;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.eval-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #dee2e6;
}

.eval-header h4 {
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.eval-instruction {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0;
}

.eval-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.eval-option {
    background: white;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    overflow: hidden;
}

.eval-option:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.eval-option-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 0.5rem 1rem;
    background: #f8f9fa;
}

.eval-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.9rem;
}

.eval-toggle {
    position: relative;
}

.eval-toggle input[type="checkbox"] {
    display: none;
}

.eval-toggle-label {
    display: flex;
    align-items: center;
    background: #dc3545;
    border-radius: 25px;
    padding: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 80px;
    height: 32px;
    position: relative;
}

.eval-toggle-label::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.eval-toggle input[type="checkbox"]:checked + .eval-toggle-label {
    background: #28a745;
}

.eval-toggle input[type="checkbox"]:checked + .eval-toggle-label::before {
    transform: translateX(48px);
}

.eval-toggle-text {
    position: absolute;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    transition: opacity 0.3s ease;
}

.eval-toggle-text:first-child {
    left: 8px;
    opacity: 1;
}

.eval-toggle-text:last-child {
    right: 8px;
    opacity: 0;
}

.eval-toggle input[type="checkbox"]:checked + .eval-toggle-label .eval-toggle-text:first-child {
    opacity: 0;
}

.eval-toggle input[type="checkbox"]:checked + .eval-toggle-label .eval-toggle-text:last-child {
    opacity: 1;
}

.eval-input {
    width: 100%;
    padding: 1rem;
    border: none;
    background: transparent;
    font-size: 1rem;
    outline: none;
    border-top: 1px solid #e9ecef;
}

.eval-input:focus {
    background: #f8f9fa;
}

.eval-input::placeholder {
    color: #adb5bd;
    font-style: italic;
}

.eval-preview {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    text-align: center;
}

.eval-preview h5 {
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.eval-preview-result {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: bold;
    color: #495057;
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    letter-spacing: 0.2em;
    min-height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Eval display styles */
.eval-answer {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    margin: 0.125rem;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
}

.eval-answer.true {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.eval-answer.false {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: end;
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 120px;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.25rem;
}

.filter-group select, .filter-group input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.filter-group select:focus, .filter-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: end;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-outline {
    background: transparent;
    color: #6c757d;
    border: 1px solid #6c757d;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: #6c757d;
    color: white;
}

.explanation {
    margin-top: 10px;
    padding: 10px;
    background: #e8f4fd;
    border-radius: 5px;
}

.tags {
    margin-top: 10px;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .tabs {
        flex-direction: column;
    }

    .filters {
        flex-direction: column;
    }

    .filters select, .filters input {
        min-width: 100%;
    }
}

/* Questions Summary */
.questions-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.summary-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.summary-item strong {
    font-weight: 600;
}

/* Enhanced Question Item */
.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 */
.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;
}

.btn-edit, .btn-delete {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit {
    background: #28a745;
    color: white;
}

.btn-edit:hover {
    background: #218838;
    transform: translateY(-1px);
}

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

.btn-delete:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Enhanced Question Meta */
.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;
}

.meta-item strong {
    color: #212529;
}

/* Question Content */
.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);
}

/* Fill Blank Question Styles */
.fill-blank-container {
    margin-top: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
    border-radius: 12px;
    border: 2px solid #c3e6c3;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.fill-blank-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #c3e6c3;
}

.fill-blank-header h4 {
    color: #2d5a2d;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.fill-blank-instruction {
    color: #4a7c4a;
    font-size: 0.9rem;
    margin: 0;
}

.fill-blank-answers {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.answer-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.answer-input-group label {
    font-weight: 600;
    color: #2d5a2d;
    font-size: 0.9rem;
}

.fill-input {
    padding: 0.75rem;
    border: 2px solid #c3e6c3;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.fill-input:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

.fill-input::placeholder {
    color: #6c757d;
    font-style: italic;
}

.fill-blank-note {
    background: #d4edda;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.fill-blank-note small {
    color: #155724;
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Fill Blank Display Styles */
.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;
}

/* Test Management Styles */
.test-management {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.test-list-section, .test-detail-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 1px solid #e9ecef;
}

.section-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.test-list {
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
}

.test-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.test-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

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

.test-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: inherit;
}

.test-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    color: inherit;
    opacity: 0.8;
}

.test-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.test-description {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: inherit;
    opacity: 0.8;
    line-height: 1.4;
}

.test-detail {
    padding: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
}

.test-detail-header {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #667eea;
}

.test-detail-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.5rem;
}

.test-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.test-detail-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #495057;
    font-size: 0.9rem;
}

.test-detail-description {
    color: #6c757d;
    font-size: 0.95rem;
    line-height: 1.5;
}

.test-questions {
    margin-top: 1.5rem;
}

.test-questions h4 {
    color: #495057;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.test-question-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.test-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

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

.test-question-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #6c757d;
}

.test-question-text {
    font-size: 1rem;
    line-height: 1.5;
    color: #212529;
    margin-bottom: 0.75rem;
}

.test-question-options {
    font-size: 0.9rem;
    color: #495057;
}

/* Mobile Responsive for Test Management */
@media (max-width: 768px) {
    .test-management {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .test-detail-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .test-question-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
}

/* Mobile Responsive for new elements */
@media (max-width: 768px) {
    .summary-info {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .question-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .question-actions {
        justify-content: center;
    }
    
    .question-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .fill-blank-answers {
        gap: 0.75rem;
    }
}
