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

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

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

.screen {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.hidden {
    display: none !important;
}

h1 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
}

h2 {
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
}

.instructions {
    background: #e8f4fd;
    border-left: 4px solid #3498db;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 0 8px 8px 0;
}

.instructions p {
    margin-bottom: 10px;
}

.instructions ul {
    margin-left: 20px;
    margin-top: 10px;
}

.instructions li {
    margin-bottom: 5px;
}

.btn {
    padding: 12px 24px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #7f8c8d;
}

.btn-submit {
    background: #27ae60;
    color: white;
}

.btn-submit:hover:not(:disabled) {
    background: #219a52;
}

#start-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    padding: 15px 30px;
    font-size: 1.2rem;
}

.progress-bar {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px;
    background: #ecf0f1;
    border-radius: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.question-card {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
}

.question-prompt {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: #2c3e50;
    font-weight: 500;
}

.question-image {
    max-width: 100%;
    height: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    display: block;
}

.question-image-container {
    text-align: center;
    margin-bottom: 20px;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option:hover {
    border-color: #3498db;
    background: #f8fbfe;
}

.option.selected {
    border-color: #3498db;
    background: #e8f4fd;
}

.option input {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.option label {
    cursor: pointer;
    flex: 1;
}

.option.correct {
    border-color: #27ae60;
    background: #d5f4e6;
}

.option.incorrect {
    border-color: #e74c3c;
    background: #fde8e8;
}

.option.correct-answer {
    border-color: #27ae60;
    background: #d5f4e6;
}

.navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.navigation .btn {
    flex: 1;
    max-width: 200px;
}

.score-summary {
    text-align: center;
    padding: 30px;
    background: #e8f4fd;
    border-radius: 10px;
    margin-bottom: 30px;
}

.score-summary .score-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2c3e50;
}

.score-summary .score-text {
    font-size: 1.1rem;
    color: #555;
    margin-top: 10px;
}

.results-list {
    margin-bottom: 30px;
}

.result-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.result-item.correct {
    background: #d5f4e6;
    border-color: #27ae60;
}

.result-item.incorrect {
    background: #fde8e8;
    border-color: #e74c3c;
}

.result-icon {
    font-size: 1.5rem;
    margin-right: 15px;
    width: 30px;
    text-align: center;
}

.result-text {
    flex: 1;
}

.result-text .question-number {
    font-weight: bold;
}

.result-text .correct-answer-hint {
    font-size: 0.9rem;
    color: #555;
    margin-top: 5px;
}

.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.results-actions .btn {
    min-width: 180px;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.review-header h2 {
    margin-bottom: 0;
}

.review-question {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
}

.review-question .question-number-label {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.review-question .status-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.status-badge.correct {
    background: #27ae60;
    color: white;
}

.status-badge.incorrect {
    background: #e74c3c;
    color: white;
}

#restart-from-review-btn {
    display: block;
    margin: 20px auto;
}

.drag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

.drag-items {
    flex: 1;
    min-width: 200px;
}

.drag-targets {
    flex: 1;
    min-width: 200px;
}

.drag-section-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #555;
}

.drag-item {
    padding: 12px 16px;
    background: #3498db;
    color: white;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: grab;
    user-select: none;
    transition: all 0.2s ease;
    touch-action: none;
}

.drag-item:active {
    cursor: grabbing;
}

.drag-item.dragging {
    opacity: 0.5;
}

.drop-zone {
    padding: 15px;
    background: #ecf0f1;
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    margin-bottom: 8px;
    min-height: 50px;
    transition: all 0.2s ease;
}

.drop-zone.drag-over {
    border-color: #3498db;
    background: #e8f4fd;
}

.drop-zone .target-label {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.dropped-items-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.drop-zone .dropped-item {
    padding: 10px 14px;
    background: #27ae60;
    color: white;
    border-radius: 6px;
    display: inline-block;
    cursor: grab;
    margin-bottom: 4px;
}

.order-container {
    margin-top: 20px;
}

.order-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.order-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #3498db;
    color: white;
    border-radius: 8px;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.order-item .order-number {
    background: rgba(255,255,255,0.3);
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 12px;
    font-weight: bold;
}

.order-item.dragging {
    opacity: 0.5;
}

.order-item.drag-over {
    border: 2px solid #2c3e50;
}

.review-answer-info {
    margin-top: 15px;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.your-answer {
    margin-bottom: 10px;
}

.your-answer-label,
.correct-answer-label {
    font-weight: bold;
    margin-bottom: 5px;
}

.your-answer-value.wrong {
    color: #e74c3c;
}

.correct-answer-value {
    color: #27ae60;
}

.test-structure {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
}

.test-structure h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.1rem;
}

.part-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.part-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    white-space: nowrap;
}

.part-badge.part1 {
    background: #e74c3c;
    color: white;
}

.part-badge.part2 {
    background: #27ae60;
    color: white;
}

.part-description {
    flex: 1;
}

.question-count {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.transition-content {
    text-align: center;
    padding: 40px 20px;
}

.transition-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.transition-instructions {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    margin: 30px 0;
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.transition-instructions p {
    margin-bottom: 10px;
}

.question-range {
    text-align: center;
    font-weight: bold;
    color: #2c3e50;
    font-size: 1.1rem;
    margin-top: 15px !important;
}

#start-part-btn {
    padding: 15px 40px;
    font-size: 1.1rem;
}

.part-indicator {
    text-align: center;
    margin-bottom: 10px;
}

.part-label {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.85rem;
}

.part-indicator.part1 .part-label {
    background: #fde8e8;
    color: #c0392b;
    border: 1px solid #e74c3c;
}

.part-indicator.part2 .part-label {
    background: #d5f4e6;
    color: #1e8449;
    border: 1px solid #27ae60;
}

.results-part-header {
    background: #f8f9fa;
    padding: 10px 15px;
    margin: 20px 0 10px 0;
    border-radius: 8px;
    font-weight: bold;
    color: #2c3e50;
}

.question-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.question-timer.green {
    background: #d5f4e6;
    color: #1e8449;
}

.question-timer.yellow {
    background: #fef9e7;
    color: #b7950b;
    animation: pulse-yellow 1s infinite;
}

.question-timer.red {
    background: #fde8e8;
    color: #c0392b;
}

@keyframes pulse-yellow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.timer-icon {
    font-size: 1.2rem;
}

.timer-display {
    font-family: 'Courier New', monospace;
    min-width: 45px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 450px;
    margin: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.modal-content h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.modal-content p {
    margin-bottom: 15px;
    color: #555;
    line-height: 1.6;
}

.modal-tip {
    background: #e8f4fd;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.95rem;
}

.modal-content .btn {
    margin-top: 10px;
    min-width: 150px;
}

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

    .screen {
        padding: 20px;
    }

    h1 {
        font-size: 1.4rem;
    }

    .navigation {
        flex-direction: column;
    }

    .navigation .btn {
        max-width: none;
    }

    .drag-container {
        flex-direction: column;
    }

    .results-actions {
        flex-direction: column;
    }

    .results-actions .btn {
        width: 100%;
    }

    .review-header {
        flex-direction: column;
        text-align: center;
    }

    .part-info {
        flex-direction: column;
        text-align: center;
    }

    .transition-instructions {
        padding: 20px 15px;
    }
}

/* Feedback Container Styles */
.feedback-container {
    background: #fafafa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    margin-top: 10px;
}

.feedback-container.correct {
    background: #d5f4e6;
    border-color: #27ae60;
}

.feedback-container.incorrect {
    background: #fde8e8;
    border-color: #e74c3c;
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.feedback-icon {
    font-size: 1.8rem;
}

.feedback-status {
    font-size: 1.2rem;
    font-weight: bold;
}

.feedback-container.correct .feedback-status {
    color: #27ae60;
}

.feedback-container.incorrect .feedback-status {
    color: #e74c3c;
}

.feedback-explanation {
    padding: 12px;
    background: white;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.feedback-correct-answer {
    margin-top: 10px;
    padding: 10px;
    background: #d5f4e6;
    border-radius: 6px;
    color: #1e8449;
}

/* Print Report Styles */
.print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.print-header h2 {
    margin-bottom: 0;
}

#print-report-content {
    margin-bottom: 20px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 0.9rem;
}

.report-table th,
.report-table td {
    border: 1px solid #ddd;
    padding: 12px 8px;
    text-align: left;
}

.report-table th {
    background: #2c3e50;
    color: white;
    font-weight: 600;
}

.report-table tr:nth-child(even) {
    background: #f9f9f9;
}

.report-table .correct-cell {
    color: #27ae60;
    font-weight: bold;
}

.report-table .incorrect-cell {
    color: #e74c3c;
    font-weight: bold;
}

.report-summary {
    background: #e8f4fd;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.report-summary h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.report-date {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .screen {
        box-shadow: none;
        padding: 20px 0;
    }
    
    .report-table {
        font-size: 10pt;
    }
    
    .report-table th,
    .report-table td {
        padding: 8px 6px;
    }
    
    .chat-fab,
    .chat-panel {
        display: none !important;
    }
}

/* Chat Tutor Styles */
.chat-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 900;
}

.chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.5);
}

.chat-fab-icon {
    font-size: 1.8rem;
    color: white;
}

.chat-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.chat-panel.open {
    transform: translateY(0);
}

.chat-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 15px 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header-icon {
    font-size: 1.5rem;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.chat-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-context-bar {
    background: #e8f4fd;
    padding: 10px 15px;
    font-size: 0.85rem;
    color: #2980b9;
    border-bottom: 1px solid #d4e9f7;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-context-icon {
    font-size: 1rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.chat-message.user {
    align-self: flex-end;
    background: #3498db;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    align-self: flex-start;
    background: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

.chat-message.typing {
    background: #f0f0f0;
    color: #888;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #888;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #3498db;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #3498db;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-send-btn:hover:not(:disabled) {
    background: #2980b9;
}

.chat-send-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.chat-send-icon {
    font-size: 1.2rem;
}

.chat-welcome {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
}

.chat-welcome-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.chat-welcome h4 {
    color: #2c3e50;
    margin-bottom: 8px;
}

.chat-welcome p {
    font-size: 0.9rem;
    line-height: 1.5;
}

@media (max-width: 600px) {
    .chat-panel {
        width: 100%;
        height: 70vh;
        border-radius: 16px 16px 0 0;
    }
    
    .chat-fab {
        bottom: 15px;
        right: 15px;
        width: 55px;
        height: 55px;
    }
}
