/* ========================================= */
/* EXAM MODAL STYLES - Tích hợp 100% từ modal.html */
/* Tất cả class đều có prefix exam- để tránh xung đột */
/* ========================================= */

.exam-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.exam-modal-overlay.active {
    opacity: 1;
}

.exam-modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease-out;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.exam-modal-overlay.active .exam-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Loading overlay */
.exam-modal-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.92);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1010;
    transition: opacity 0.4s ease;
    pointer-events: none;
    opacity: 0;
    backdrop-filter: blur(3px);
}

.exam-modal.loading .exam-modal-loading-overlay {
    display: flex;
    pointer-events: all;
    opacity: 1;
}

@keyframes exam-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes exam-pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(0.95);
        opacity: 0.7;
    }
}

@keyframes exam-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.exam-spinner-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.exam-spinner {
    border: 4px solid rgba(52, 152, 219, 0.2);
    border-top: 4px solid #3498db;
    border-right: 4px solid #2ecc71;
    border-bottom: 4px solid #e74c3c;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: exam-spin 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.exam-loading-text {
    font-size: 0.95rem;
    color: #555;
    font-weight: 500;
    animation: exam-pulse 2s infinite;
}

.exam-loading-dots {
    display: flex;
    gap: 4px;
}

.exam-loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3498db;
    animation: exam-bounce 1.4s infinite ease-in-out;
}

.exam-loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.exam-loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

/* Button loading */
.exam-btn-loading {
    position: relative;
    pointer-events: none;
    cursor: default;
    overflow: hidden;
}

.exam-btn-loading>* {
    visibility: hidden;
}

.exam-btn-loading:before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    animation: exam-spin 0.8s linear infinite;
}

.exam-btn-send.exam-btn-loading:before {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: white;
}

.exam-btn-view.exam-btn-loading {
    background: #555;
}

.exam-btn-unlock-solution.exam-btn-loading {
    background: #218838;
}

/* Skeleton loading */
@keyframes exam-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.exam-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: exam-loading 1.5s infinite;
    border-radius: 4px;
}

.exam-skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.exam-skeleton-title {
    height: 1.5rem;
    margin-bottom: 1rem;
    width: 70%;
}

.exam-skeleton-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.exam-skeleton-button {
    height: 40px;
    width: 100%;
}

/* Tab loading */
.exam-tab-content.loading {
    position: relative;
    min-height: 200px;
}

.exam-tab-content.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

/* Modal header */
.exam-modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.exam-modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

.exam-btn-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #666;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.exam-btn-close:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
}

/* Tabs */
.exam-tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    background: #f8f9fa;
}

.exam-tab {
    flex: 1;
    padding: 14px 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.exam-tab.active {
    color: #3498db;
    border-bottom: 2px solid #3498db;
    font-weight: 600;
}

.exam-tab-content {
    display: none;
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    animation: exam-fadeIn 0.3s ease;
}

@keyframes exam-fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.exam-tab-content.active {
    display: block;
}

.exam-tab-title {
    font-size: 1rem;
    margin-bottom: 15px;
    text-align: left;
    font-weight: 600;
    color: #555;
}

/* Exam item */
.exam-item {
    background: #ffffff;
    border-radius: 8px;
    padding: 18px;
    text-align: left;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    margin-bottom: 16px;
}


.exam-name {
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #333;
}

.exam-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #eee;
    font-size: 0.9rem;
    flex-wrap: wrap;
    gap: 10px;
}

.exam-view-info {
    color: #666;
}

.exam-status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}

.exam-status-opened {
    background-color: #e6ffe6;
    color: #4CAF50;
}

.exam-status-locked {
    background-color: #ffeded;
    color: #f44336;
}

.exam-btn-view {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    font-weight: 600;
}

.exam-btn-view:hover:not(.exam-btn-loading) {
    background: #2980b9;
}

/* Comment form */
.exam-comment-form {
    display: flex;
    margin-bottom: 20px;
    gap: 10px;
}

.exam-comment-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    min-width: 0;
    transition: border 0.2s;
}

.exam-comment-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.exam-btn-send {
    background: #3498db;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.exam-btn-send:hover:not(.exam-btn-loading) {
    background: #2980b9;
}

.exam-comments {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.exam-comment {
    text-align: left;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s;
}

.exam-comment:hover {
    background: #f9f9f9;
}

.exam-comment:last-child {
    border-bottom: none;
}

.exam-comment-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 10px;
}

.exam-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
    font-weight: 600;
}

.exam-comment-author-info {
    flex: 1;
    min-width: 0;
}

.exam-comment-author {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exam-comment-time {
    font-size: 0.8rem;
    color: #666;
}

.exam-comment-text {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 8px;
    word-break: break-word;
}

.exam-comment-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.exam-vote-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.exam-btn-vote {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 0;
    transition: color 0.2s;
    border-radius: 4px;
}

.exam-btn-vote:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
}

.exam-btn-vote.exam-liked {
    color: #007bff;
    font-weight: 600;
}

.exam-btn-vote.exam-disliked {
    color: #dc3545;
    font-weight: 600;
}

.exam-btn-reply,
.exam-btn-show-replies {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 5px 0;
    white-space: nowrap;
    border-radius: 4px;
    transition: all 0.2s;
}

.exam-btn-reply:hover,
.exam-btn-show-replies:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
}

.exam-btn-show-replies i {
    margin-right: 5px;
}

.exam-replies {
    margin-top: 12px;
    padding-left: 15px;
    border-left: 2px solid #f0f0f0;
    display: none;
}

.exam-replies.exam-show {
    display: block;
    animation: exam-slideDown 0.3s ease;
}

@keyframes exam-slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.exam-reply {
    margin-top: 12px;
}

.exam-reply-form {
    display: block !important;
    margin-top: 10px;
}

.exam-reply-form .exam-comment-form {
    display: flex !important;
}

/* Solutions */
.exam-solutions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.exam-solution {
    background: #f8f8f8;
    border-radius: 8px;
    padding: 15px;
    text-align: left;
    border: 1px solid #eee;
    transition: all 0.2s;
}


.exam-solution-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.exam-solution-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
    font-weight: 600;
}

.exam-solution-author-info {
    flex: 1;
    min-width: 0;
}

.exam-solution-author {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exam-solution-rating {
    font-size: 0.85rem;
    color: #666;
}

.exam-solution-text {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 12px;
    max-height: 80px;
    overflow: hidden;
    position: relative;
    word-break: break-word;
}

.exam-solution-text.exam-expanded {
    max-height: none;
}

.exam-solution-text:not(.exam-expanded)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: linear-gradient(to bottom, rgba(248, 248, 248, 0) 0%, rgba(248, 248, 248, 1) 100%);
}

.exam-solution-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.exam-solution-utility-actions {
    display: flex;
    gap: 10px;
}

.exam-btn-action {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.exam-btn-action:hover {
    background: #f0f0f0;
}

.exam-btn-action.exam-voted {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.exam-btn-action.exam-reported {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
    cursor: not-allowed;
    opacity: 0.8;
}

.exam-btn-action.exam-reported:hover {
    background: #dc3545;
}

.exam-btn-view-detail {
    background: #3498db;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 1;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.exam-btn-view-detail:hover {
    background: #2980b9;
}

/* Solution Detail Modal */
.exam-solution-detail-modal .exam-modal {
    max-width: 700px;
}

.exam-detail-content {
    padding: 20px;
    text-align: left;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.exam-detail-author-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.exam-detail-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    font-weight: 600;
}

.exam-detail-name {
    font-weight: 700;
    font-size: 1.1rem;
}

.exam-detail-review {
    font-size: 0.9rem;
    color: #ffc107;
}

.exam-star-rating .fa-star,
.exam-star-rating .fa-star-half-stroke {
    font-size: 1rem;
    margin-right: 2px;
}

.exam-detail-description {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 20px;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 6px;
    word-break: break-word;
}

.exam-solution-images-container {
    flex-shrink: 0;
}

.exam-solution-images {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.exam-solution-images img {
    width: 100px;
    height: 75px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.exam-solution-images img:hover {
    border-color: #007bff;
}

/* Review Summary */
.exam-review-summary {
    background: #f0f8ff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.exam-rating-box {
    text-align: center;
    padding-right: 20px;
    border-right: 1px solid #ddd;
}

.exam-average-rating {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffc107;
    line-height: 1;
}

.exam-rating-text {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.exam-review-stats {
    flex-grow: 1;
}

.exam-stat-bar {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.exam-stat-bar span:first-child {
    width: 15px;
    color: #555;
    text-align: right;
    margin-right: 5px;
}

.exam-bar-container {
    flex-grow: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-left: 5px;
    margin-right: 10px;
}

.exam-bar-fill {
    height: 100%;
    background-color: #ffc107;
}

.exam-review-list-section {
    padding-top: 15px;
    border-top: 1px solid #eee;
    flex-grow: 1;
    overflow-y: auto;
}

.exam-review-item {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #eee;
}

.exam-review-item:last-child {
    border-bottom: none;
}

.exam-review-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.exam-review-author {
    font-weight: 600;
    font-size: 0.95rem;
}

.exam-review-rating-stars {
    color: #ffc107;
    font-size: 0.9rem;
    margin-right: 10px;
}

.exam-review-text {
    font-size: 0.9rem;
    color: #333;
    margin-top: 5px;
    word-break: break-word;
}

.exam-review-meta {
    font-size: 0.75rem;
    color: #999;
    margin-top: 5px;
}

.exam-review-action-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.exam-btn-unlock-solution {
    background: #2ecc71;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
    padding: 12px 25px;
    font-size: 1rem;
    width: 100%;
    max-width: 400px;
}

.exam-btn-unlock-solution:hover:not(.exam-btn-loading) {
    background: #27ae60;
}

.exam-solution-detail-modal.exam-unlocked .exam-btn-unlock-solution {
    display: none;
}

.exam-solution-detail-modal:not(.exam-unlocked) .exam-solution-images-container,
.exam-solution-detail-modal:not(.exam-unlocked) .exam-full-comment-section {
    display: none;
}

.exam-solution-detail-modal.exam-unlocked .exam-full-comment-section {
    display: block;
}

/* Image Modal */
.exam-image-modal-overlay {
    z-index: 2001;
}

.exam-image-modal-overlay .exam-modal {
    max-width: 90vw;
    width: auto;
}

.exam-image-modal-content {
    display: flex;
    max-height: 85vh;
    overflow: hidden;
}

.exam-image-viewer {
    flex: 2;
    padding: 10px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #333;
    position: relative;
}

.exam-full-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
}

.exam-image-comment-section {
    flex: 1;
    min-width: 300px;
    max-width: 350px;
    padding: 15px;
    border-left: 1px solid #eee;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.exam-image-comment-section .exam-comments-list {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 10px;
}

.exam-image-comment-section .exam-comment {
    padding-left: 0;
    padding-right: 0;
    border-bottom: 1px dashed #eee;
}

.exam-image-comment-section .exam-comment:last-child {
    border-bottom: none;
}

.exam-image-comment-section .exam-comment-text,
.exam-image-comment-section .exam-comment-actions {
    padding-left: 0;
}

.exam-image-nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 15px 10px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
    border-radius: 4px;
    user-select: none;
}

.exam-image-nav-button:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.8);
}

.exam-image-nav-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#examPrevImage {
    left: 10px;
}

#examNextImage {
    right: 10px;
}

/* Review Modal */
.exam-review-modal-overlay .exam-modal {
    max-width: 500px;
}

.exam-review-form-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
}

.exam-rating-selection {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 2.5rem;
    color: #ccc;
    cursor: pointer;
}

.exam-rating-selection .exam-star {
    transition: color 0.2s, transform 0.1s;
}


.exam-rating-selection .exam-star.exam-selected {
    color: #ffc107;
}

.exam-review-form-content input[type="text"],
.exam-review-form-content textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    outline: none;
    resize: vertical;
    transition: border 0.2s;
}

.exam-review-form-content input[type="text"]:focus,
.exam-review-form-content textarea:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.exam-btn-submit-review {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 600;
}

.exam-btn-submit-review:hover:not(.exam-btn-loading) {
    background: #2980b9;
}

/* Toast notification */
.exam-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #2ecc71;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 3000;
    transform: translateY(100px);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.exam-toast.exam-show {
    transform: translateY(0);
    opacity: 1;
}

.exam-toast.exam-error {
    background: #e74c3c;
}

/* Responsive */
@media (max-width: 768px) {
    .exam-modal-overlay {
        padding: 10px;
    }

    .exam-modal {
        max-height: 90vh;
    }

    .exam-modal-header {
        padding: 15px;
    }

    .exam-tab {
        font-size: 0.8rem;
        padding: 12px 0;
    }

    .exam-tab-content {
        padding: 15px;
    }

    .exam-solution-detail-modal .exam-modal {
        max-width: 95%;
    }

    .exam-image-modal-content {
        flex-direction: column;
        max-height: none;
    }

    .exam-image-viewer {
        padding: 5px;
        order: 1;
    }

    .exam-full-image {
        max-height: 50vh;
    }

    .exam-image-nav-button {
        padding: 10px 8px;
        font-size: 1.2rem;
    }

    .exam-image-comment-section {
        min-width: 100%;
        max-width: none;
        order: 2;
    }

    .exam-rating-box {
        border-right: none;
        padding-right: 0;
    }

    .exam-review-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .exam-review-stats {
        width: 100%;
    }

    .exam-solution-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .exam-solution-utility-actions {
        width: 100%;
        justify-content: space-between;
    }

    .exam-btn-view-detail {
        width: 100%;
        margin-top: 5px;
    }
}

@media (max-width: 480px) {
    .exam-modal-header {
        padding: 12px 15px;
    }

    .exam-modal-title {
        font-size: 1.1rem;
    }

    .exam-tab {
        font-size: 0.75rem;
        padding: 10px 0;
    }

    .exam-tab-content {
        padding: 12px;
    }

    .exam-status-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .exam-comment-actions {
        gap: 10px;
    }

    .exam-vote-buttons {
        gap: 5px;
    }

    .exam-btn-vote {
        font-size: 0.8rem;
    }

    .exam-btn-reply,
    .exam-btn-show-replies {
        font-size: 0.8rem;
    }

    .exam-detail-author-info {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .exam-detail-avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .exam-detail-name {
        font-size: 1rem;
    }

    .exam-btn-unlock-solution {
        font-size: 0.9rem;
        padding: 10px 20px;
    }

    .exam-rating-selection {
        font-size: 2rem;
    }
}

@media (max-width: 360px) {
    .exam-tabs {
        flex-direction: column;
    }

    .exam-tab {
        padding: 10px 5px;
        text-align: center;
    }

    .exam-comment-form {
        flex-direction: column;
    }

    .exam-btn-send {
        transition: background 0.2s;
        font-weight: 600;
    }

    .exam-btn-submit-review:hover:not(.exam-btn-loading) {
        background: #2980b9;
    }

    /* Toast notification */
    .exam-toast {
        position: fixed;
        bottom: 20px;
        right: 20px;
        background: #2ecc71;
        color: white;
        padding: 12px 20px;
        border-radius: 6px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        z-index: 3000;
        transform: translateY(100px);
        opacity: 0;
        transition: transform 0.3s, opacity 0.3s;
    }

    .exam-toast.exam-show {
        transform: translateY(0);
        opacity: 1;
    }

    .exam-toast.exam-error {
        background: #e74c3c;
    }

    /* Responsive */
    @media (max-width: 768px) {
        .exam-modal-overlay {
            padding: 10px;
        }

        .exam-modal {
            max-height: 90vh;
        }

        .exam-modal-header {
            padding: 15px;
        }

        .exam-tab {
            font-size: 0.8rem;
            padding: 12px 0;
        }

        .exam-tab-content {
            padding: 15px;
        }

        .exam-solution-detail-modal .exam-modal {
            max-width: 95%;
        }

        .exam-image-modal-content {
            flex-direction: column;
            max-height: none;
        }

        .exam-image-viewer {
            padding: 5px;
            order: 1;
        }

        .exam-full-image {
            max-height: 50vh;
        }

        .exam-image-nav-button {
            padding: 10px 8px;
            font-size: 1.2rem;
        }

        .exam-image-comment-section {
            min-width: 100%;
            max-width: none;
            order: 2;
        }

        .exam-rating-box {
            border-right: none;
            padding-right: 0;
        }

        .exam-review-summary {
            flex-direction: column;
            align-items: flex-start;
        }

        .exam-review-stats {
            width: 100%;
        }

        .exam-solution-actions {
            flex-direction: column;
            align-items: flex-start;
        }

        .exam-solution-utility-actions {
            width: 100%;
            justify-content: space-between;
        }

        .exam-btn-view-detail {
            width: 100%;
            margin-top: 5px;
        }
    }

    @media (max-width: 480px) {
        .exam-modal-header {
            padding: 12px 15px;
        }

        .exam-modal-title {
            font-size: 1.1rem;
        }

        .exam-tab {
            font-size: 0.75rem;
            padding: 10px 0;
        }

        .exam-tab-content {
            padding: 12px;
        }

        .exam-status-row {
            flex-direction: column;
            align-items: flex-start;
        }

        .exam-comment-actions {
            gap: 10px;
        }

        .exam-vote-buttons {
            gap: 5px;
        }

        .exam-btn-vote {
            font-size: 0.8rem;
        }

        .exam-btn-reply,
        .exam-btn-show-replies {
            font-size: 0.8rem;
        }

        .exam-detail-author-info {
            flex-direction: column;
            text-align: center;
            gap: 10px;
        }

        .exam-detail-avatar {
            width: 40px;
            height: 40px;
            font-size: 1rem;
        }

        .exam-detail-name {
            font-size: 1rem;
        }

        .exam-btn-unlock-solution {
            font-size: 0.9rem;
            padding: 10px 20px;
        }

        .exam-rating-selection {
            font-size: 2rem;
        }
    }

    @media (max-width: 360px) {
        .exam-tabs {
            flex-direction: column;
        }

        .exam-tab {
            padding: 10px 5px;
            text-align: center;
        }

        .exam-comment-form {
            flex-direction: column;
        }

        .exam-btn-send {
            width: 100%;
            height: 40px;
        }
    }


    /* ========================================= */
    /* DARK MODE SUPPORT */
    /* ========================================= */

    [data-theme="dark"] .exam-modal {
        background: var(--card-bg);
        color: var(--text);
    }

    [data-theme="dark"] .exam-modal-header {
        background: var(--card-bg);
        border-bottom-color: var(--border);
    }

    [data-theme="dark"] .exam-modal-title {
        color: var(--text);
    }

    [data-theme="dark"] .exam-btn-close {
        color: var(--text-light);
    }

    [data-theme="dark"] .exam-btn-close:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--text);
    }

    [data-theme="dark"] .exam-tabs {
        background: var(--bg);
        border-bottom-color: var(--border);
    }

    [data-theme="dark"] .exam-tab {
        color: var(--text-light);
    }

    [data-theme="dark"] .exam-tab.active {
        color: var(--primary);
        border-bottom-color: var(--primary);
    }

    [data-theme="dark"] .exam-tab-title {
        color: var(--text);
    }

    [data-theme="dark"] .exam-item {
        background: var(--bg);
        border-color: var(--border);
    }

    [data-theme="dark"] .exam-name {
        color: var(--text);
    }

    [data-theme="dark"] .exam-view-info {
        color: var(--text-light);
    }

    [data-theme="dark"] .exam-status-row {
        border-bottom-color: var(--border);
    }

    [data-theme="dark"] .exam-comment-input {
        background: var(--bg);
        border-color: var(--border);
        color: var(--text);
    }

    [data-theme="dark"] .exam-comment-input:focus {
        border-color: var(--primary);
    }

    [data-theme="dark"] .exam-comment {
        border-bottom-color: var(--border);
    }

    [data-theme="dark"] .exam-comment:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    [data-theme="dark"] .exam-comment-author {
        color: var(--text);
    }

    [data-theme="dark"] .exam-comment-time {
        color: var(--text-light);
    }

    [data-theme="dark"] .exam-comment-text {
        color: var(--text);
    }

    [data-theme="dark"] .exam-replies {
        border-left-color: var(--border);
    }

    [data-theme="dark"] .exam-solution {
        background: var(--bg);
        border-color: var(--border);
    }

    [data-theme="dark"] .exam-solution-author {
        color: var(--text);
    }

    [data-theme="dark"] .exam-solution-rating {
        color: var(--text-light);
    }

    [data-theme="dark"] .exam-solution-text {
        color: var(--text);
    }

    [data-theme="dark"] .exam-solution-text:not(.exam-expanded)::after {
        background: linear-gradient(to bottom, rgba(31, 41, 55, 0) 0%, rgba(31, 41, 55, 1) 100%);
        /* var(--bg) is #1F2937 */
    }

    [data-theme="dark"] .exam-btn-action {
        background: var(--bg);
        border-color: var(--border);
        color: var(--text);
    }

    [data-theme="dark"] .exam-btn-action:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    [data-theme="dark"] .exam-detail-content {
        background: var(--card-bg);
    }

    [data-theme="dark"] .exam-detail-author-info {
        border-bottom-color: var(--border);
    }

    [data-theme="dark"] .exam-detail-name {
        color: var(--text);
    }

    [data-theme="dark"] .exam-detail-description {
        background: var(--bg);
        color: var(--text);
    }

    [data-theme="dark"] .exam-image-modal-content {
        background: var(--card-bg);
    }

    [data-theme="dark"] .exam-image-comment-section {
        background: var(--card-bg);
        border-left: 1px solid var(--border);
    }

    [data-theme="dark"] .exam-image-comment-section h4 {
        color: var(--text);
    }

    [data-theme="dark"] .exam-btn-vote {
        color: var(--text-light);
    }

    [data-theme="dark"] .exam-btn-vote:hover {
        color: var(--text);
        background: rgba(255, 255, 255, 0.05);
    }

    [data-theme="dark"] .exam-btn-reply,
    [data-theme="dark"] .exam-btn-show-replies {
        color: var(--text-light);
    }

    [data-theme="dark"] .exam-btn-reply:hover,
    [data-theme="dark"] .exam-btn-show-replies:hover {
        color: var(--text);
        background: rgba(255, 255, 255, 0.05);
    }
    }
/* ========================================= */
/* DARK MODE SUPPORT - Bổ sung cho Modal Exams */
/* ========================================= */

[data-theme="dark"] .exam-modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .exam-modal {
    background: var(--card-bg);
    color: var(--text);
}

[data-theme="dark"] .exam-modal-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .exam-modal-title {
    color: var(--text);
}

[data-theme="dark"] .exam-btn-close {
    color: var(--text-light);
}

[data-theme="dark"] .exam-btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

[data-theme="dark"] .exam-tabs {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .exam-tab {
    color: var(--text-light);
}

[data-theme="dark"] .exam-tab.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

[data-theme="dark"] .exam-tab-title {
    color: var(--text);
}

[data-theme="dark"] .exam-item {
    background: var(--bg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .exam-name {
    color: var(--text);
}

[data-theme="dark"] .exam-view-info {
    color: var(--text-light);
}

[data-theme="dark"] .exam-status-row {
    border-bottom: 1px dashed var(--border);
}

[data-theme="dark"] .exam-status-opened {
    background-color: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
}

[data-theme="dark"] .exam-status-locked {
    background-color: rgba(244, 67, 54, 0.15);
    color: #f44336;
}

[data-theme="dark"] .exam-comment-input {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}

[data-theme="dark"] .exam-comment-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(58, 152, 185, 0.2);
}

[data-theme="dark"] .exam-comment {
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .exam-comment:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .exam-comment-author {
    color: var(--text);
}

[data-theme="dark"] .exam-comment-time {
    color: var(--text-light);
}

[data-theme="dark"] .exam-comment-text {
    color: var(--text);
}

[data-theme="dark"] .exam-replies {
    border-left: 2px solid var(--border);
}

[data-theme="dark"] .exam-solution {
    background: var(--bg);
    border: 1px solid var(--border);
}

[data-theme="dark"] .exam-solution-author {
    color: var(--text);
}

[data-theme="dark"] .exam-solution-rating {
    color: var(--text-light);
}

[data-theme="dark"] .exam-solution-text {
    color: var(--text);
}

[data-theme="dark"] .exam-solution-text:not(.exam-expanded)::after {
    background: linear-gradient(to bottom, 
        rgba(31, 41, 55, 0) 0%, 
        var(--bg) 100%
    );
}

[data-theme="dark"] .exam-btn-action {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text);
}

[data-theme="dark"] .exam-btn-action:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .exam-detail-content {
    background: var(--card-bg);
}

[data-theme="dark"] .exam-detail-author-info {
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .exam-detail-name {
    color: var(--text);
}

[data-theme="dark"] .exam-detail-description {
    background: var(--bg);
    color: var(--text);
}

[data-theme="dark"] .exam-solution-images-container h4 {
    color: var(--text);
}

[data-theme="dark"] .exam-review-summary {
    background: var(--bg);
}

[data-theme="dark"] .exam-review-summary h4 {
    color: var(--text);
}

[data-theme="dark"] .exam-review-stats {
    color: var(--text-light);
}

[data-theme="dark"] .exam-bar-container {
    background: var(--border);
}

[data-theme="dark"] .exam-review-list-section {
    border-top: 1px solid var(--border);
}

[data-theme="dark"] .exam-review-item {
    border-bottom: 1px dashed var(--border);
}

[data-theme="dark"] .exam-review-author {
    color: var(--text);
}

[data-theme="dark"] .exam-review-text {
    color: var(--text);
}

[data-theme="dark"] .exam-review-meta {
    color: var(--text-lighter);
}

[data-theme="dark"] .exam-image-modal-content {
    background: var(--card-bg);
}

[data-theme="dark"] .exam-image-viewer {
    background: var(--bg);
}

[data-theme="dark"] .exam-image-comment-section {
    background: var(--card-bg);
    border-left: 1px solid var(--border);
}

[data-theme="dark"] .exam-image-comment-section h4 {
    color: var(--text);
}

[data-theme="dark"] .exam-image-nav-button {
    background: rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .exam-image-nav-button:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .exam-review-form-content {
    color: var(--text);
}

[data-theme="dark"] .exam-review-form-content h5 {
    color: var(--text);
}

[data-theme="dark"] .exam-rating-selection {
    color: var(--border);
}

[data-theme="dark"] .exam-review-form-content textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}

[data-theme="dark"] .exam-review-form-content textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(58, 152, 185, 0.2);
}

[data-theme="dark"] .exam-modal-loading-overlay {
    background: rgba(55, 65, 81, 0.92); /* var(--card-bg) với độ trong suốt */
}

[data-theme="dark"] .exam-spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--primary);
    border-right: 4px solid var(--success);
    border-bottom: 4px solid var(--error);
}

[data-theme="dark"] .exam-loading-text {
    color: var(--text-light);
}

[data-theme="dark"] .exam-loading-dots span {
    background: var(--primary);
}

[data-theme="dark"] .exam-skeleton {
    background: linear-gradient(90deg, 
        var(--border) 25%, 
        var(--text-lighter) 50%, 
        var(--border) 75%
    );
}

/* Sử dụng màu từ app.css */
[data-theme="dark"] .exam-btn-view {
    background: var(--primary);
}

[data-theme="dark"] .exam-btn-view:hover:not(.exam-btn-loading) {
    background: var(--primary-dark);
}

[data-theme="dark"] .exam-btn-send {
    background: var(--primary);
}

[data-theme="dark"] .exam-btn-send:hover:not(.exam-btn-loading) {
    background: var(--primary-dark);
}

[data-theme="dark"] .exam-btn-unlock-solution {
    background: var(--success);
}

[data-theme="dark"] .exam-btn-unlock-solution:hover:not(.exam-btn-loading) {
    background: #27ae60;
}

[data-theme="dark"] .exam-btn-view-detail {
    background: var(--primary);
}

[data-theme="dark"] .exam-btn-view-detail:hover {
    background: var(--primary-dark);
}

[data-theme="dark"] .exam-btn-submit-review {
    background: var(--primary);
}

[data-theme="dark"] .exam-btn-submit-review:hover:not(.exam-btn-loading) {
    background: var(--primary-dark);
}

/* Loading states */
[data-theme="dark"] .exam-btn-loading:before {
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
}

/* Tab loading background */
[data-theme="dark"] .exam-tab-content.loading::after {
    background: rgba(55, 65, 81, 0.8);
}

/* Scrollbar styling cho dark mode */
[data-theme="dark"] .exam-modal::-webkit-scrollbar,
[data-theme="dark"] .exam-tab-content::-webkit-scrollbar,
[data-theme="dark"] .exam-detail-content::-webkit-scrollbar {
    width: 8px;
}

[data-theme="dark"] .exam-modal::-webkit-scrollbar-track,
[data-theme="dark"] .exam-tab-content::-webkit-scrollbar-track,
[data-theme="dark"] .exam-detail-content::-webkit-scrollbar-track {
    background: var(--bg);
}

[data-theme="dark"] .exam-modal::-webkit-scrollbar-thumb,
[data-theme="dark"] .exam-tab-content::-webkit-scrollbar-thumb,
[data-theme="dark"] .exam-detail-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

[data-theme="dark"] .exam-modal::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .exam-tab-content::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .exam-detail-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ========================================= */
/* AI SOLUTION CARD STYLES - Tối giản */
/* ========================================= */

.exam-ai-solution-card {
    background: #f8f8f8;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #eee;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.exam-ai-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.exam-ai-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

.exam-ai-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text, #333);
}

.exam-ai-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.exam-ai-option {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 6px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.2s;
    color: var(--text, #666);
}

.exam-ai-option:hover {
    border-color: #667eea;
    color: #667eea;
}

.exam-ai-option input[type="radio"] {
    margin-right: 6px;
    cursor: pointer;
    margin: 0;
    accent-color: #667eea;
}

.exam-ai-option input[type="radio"]:checked ~ span {
    color: #667eea;
    font-weight: 500;
}

.exam-ai-option:has(input[type="radio"]:checked),
.exam-ai-option.exam-ai-option-selected {
    border-color: #667eea;
    background: #f0f4ff;
}

.exam-ai-option span {
    cursor: pointer;
    user-select: none;
}

/* Dark theme support */
[data-theme="dark"] .exam-ai-solution-card {
    background: var(--bg);
    border-color: var(--border);
}

[data-theme="dark"] .exam-ai-title {
    color: var(--text);
}

[data-theme="dark"] .exam-ai-option {
    background: var(--bg);
    border-color: var(--border);
    color: var(--text-light);
}

[data-theme="dark"] .exam-ai-option:hover {
    border-color: #667eea;
    color: #667eea;
}

/* Input placeholder color */
[data-theme="dark"] .exam-comment-input::placeholder {
    color: var(--text-lighter);
}

[data-theme="dark"] .exam-review-form-content textarea::placeholder {
    color: var(--text-lighter);
}

/* Transition đồng bộ với app.css */
[data-theme="dark"] .exam-modal-overlay,
[data-theme="dark"] .exam-modal,
[data-theme="dark"] .exam-btn-close,
[data-theme="dark"] .exam-tab,
[data-theme="dark"] .exam-item,
[data-theme="dark"] .exam-comment-input,
[data-theme="dark"] .exam-btn-action {
    transition: var(--transition);
}

/* Đảm bảo các border radius đồng nhất */
[data-theme="dark"] .exam-modal {
    border-radius: var(--radius-md);
}

[data-theme="dark"] .exam-item,
[data-theme="dark"] .exam-solution,
[data-theme="dark"] .exam-review-summary,
[data-theme="dark"] .exam-detail-description {
    border-radius: var(--radius-sm);
}

[data-theme="dark"] .exam-comment-input,
[data-theme="dark"] .exam-btn-view,
[data-theme="dark"] .exam-btn-send,
[data-theme="dark"] .exam-btn-unlock-solution,
[data-theme="dark"] .exam-btn-view-detail,
[data-theme="dark"] .exam-btn-submit-review {
    border-radius: var(--radius-sm);
}

/* Avatar colors phù hợp với chủ đề */
[data-theme="dark"] .exam-comment-avatar,
[data-theme="dark"] .exam-detail-avatar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

[data-theme="dark"] .exam-solution-avatar {
    background: linear-gradient(135deg, var(--success), #27ae60);
}
