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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    padding: 0;
}

header {
    background-color: #3498db;
    padding: 20px 20px 0 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #ffffff;
}

.header-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
    padding: 15px;
    border-radius: 8px 8px 0 0;
    position: relative;
    top: 10px;
}

.categories {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 5px;
    max-width: 100%;
}

.categories::-webkit-scrollbar {
    height: 4px;
}

.categories::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

.category-btn {
    padding: 8px 16px;
    background-color: #e9ecef;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.category-btn:hover {
    background-color: #dee2e6;
}

.category-btn.active {
    background-color: #3498db;
    color: white;
}

.search-container {
    display: flex;
    gap: 10px;
}

#search-input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    width: 250px;
}

#search-btn {
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

#search-btn:hover {
    background-color: #2980b9;
}

main {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 1200px;
    margin: 0 auto 20px;
}

.question-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background-color: #fff;
}

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

.question-metadata {
    font-size: 0.9rem;
    color: #6c757d;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

.question-metadata > span {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    line-height: 1.4;
}

.question-number {
    font-weight: bold;
    font-size: 1.1rem;
    color: #2c3e50;
    display: inline-flex;
    align-items: center;
    margin-bottom: 0;
    vertical-align: middle;
}

.category-tag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    background-color: #f8f9fa;
    margin-left: 10px;
}

.question-text {
    margin-bottom: 20px;
}

.question-item {
    margin-bottom: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.item-letter {
    font-weight: bold;
    margin-right: 5px;
}

.answer-container {
    margin-top: 10px;
}

textarea.user-answer {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 80px;
    font-family: inherit;
    resize: vertical;
}

.action-buttons {
    display: flex;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
    gap: 15px;
    align-items: center;
}

.respond-btn {
    padding: 10px 25px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
}

.respond-btn:hover:not(:disabled) {
    background-color: #218838;
}

.respond-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.comment-btn, .report-btn {
    padding: 8px 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.comment-btn:hover {
    background-color: #e9ecef;
}

.report-btn {
    color: #dc3545;
}

.report-btn:hover {
    background-color: #ffebee;
}

.user-answer:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
    color: #495057;
}

.expected-answer {
    margin-top: 10px;
    padding: 10px;
    background-color: #e2f3e5;
    border-left: 4px solid #28a745;
    display: none;
}

.expected-answer.shown {
    display: block;
}

.comment-popup, .popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.comment-popup.shown, .popup.shown {
    display: flex;
}

.comment-content, .popup-content {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 800px;
    width: 80%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close-comment, .close-popup {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.close-comment:hover, .close-popup:hover {
    color: #000;
}

#comment-text, #question-details {
    margin-top: 15px;
    line-height: 1.6;
}

#question-details {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

#error-description {
    width: 100%;
    min-height: 150px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

#send-report {
    padding: 10px 20px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    float: right;
    min-width: 100px;
    transition: background-color 0.3s;
}

#send-report:hover:not(:disabled) {
    background-color: #c82333;
}

#send-report:disabled {
    background-color: #6c757d;
    cursor: wait;
}

.send-status {
    display: inline-block;
    margin-right: 10px;
    font-size: 14px;
    vertical-align: middle;
}

.send-status.success {
    color: #28a745;
}

.send-status.error {
    color: #dc3545;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 15px;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.pagination button {
    padding: 8px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button:hover:not([disabled]) {
    background-color: #2980b9;
}

.pagination button[disabled] {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

.loading {
    text-align: center;
    padding: 30px;
    color: #6c757d;
}

.no-results {
    text-align: center;
    padding: 30px;
    color: #6c757d;
}

#refresh-btn {
    display: block;
    margin: 20px auto 0;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#refresh-btn:hover {
    background-color: #e9ecef;
}

.refresh-icon {
    display: inline-block;
    margin-right: 5px;
    font-size: 16px;
}

.fallback-btn {
    padding: 8px 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
    display: block;
    transition: all 0.2s ease;
}

.fallback-btn:hover {
    background-color: #e9ecef;
}

@media (max-width: 768px) {
    .header-bottom {
        flex-direction: column;
    }
    
    .search-container {
        width: 100%;
        margin-top: 15px;
    }
    
    #search-input {
        width: 100%;
    }
    
    .question-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .question-metadata {
        flex-wrap: wrap;
    }
    
    .category-tag {
        margin-left: 0;
        margin-top: 5px;
    }

    .action-buttons {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-buttons button {
        margin-bottom: 10px;
    }
}