/* ============================================
   ZimLearn Tutor — Styles
   Separate file, no conflicts with existing CSS
   ============================================ */

/* Tutor page container */
.tutor-page { padding: 12px; width: 100%; box-sizing: border-box; }

/* Subject picker */
.tutor-subjects { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.tutor-subject-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 16px; padding: 20px 16px; text-align: center;
    color: #fff; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    border: none; font-size: 14px; font-weight: 600;
}
.tutor-subject-card:active { transform: scale(0.96); }
.tutor-subject-card.english { background: linear-gradient(135deg, #f093fb, #f5576c); }
.tutor-subject-card.maths { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.tutor-subject-card .subject-icon { font-size: 32px; display: block; margin-bottom: 8px; }
.tutor-subject-card .subject-label { font-size: 15px; }

/* Mode tabs */
.tutor-tabs { display: flex; gap: 4px; margin-bottom: 16px; background: #f0f0f5; border-radius: 12px; padding: 4px; }
.tutor-tab {
    flex: 1; padding: 10px 8px; border: none; background: none;
    border-radius: 10px; font-size: 13px; font-weight: 600;
    color: #666; cursor: pointer; transition: all 0.2s;
}
.tutor-tab.active { background: #fff; color: #6C63FF; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

/* Chat area */
.tutor-chat { display: flex; flex-direction: column; min-height: 50vh; }
.tutor-messages {
    flex: 1; overflow-y: auto; padding: 8px 0;
    display: flex; flex-direction: column; gap: 12px;
}

.tutor-msg {
    max-width: 100%; padding: 12px 16px; border-radius: 16px;
    font-size: 14px; line-height: 1.6; word-wrap: break-word;
}
.tutor-msg.user {
    align-self: flex-end; background: #6C63FF; color: #fff;
    border-bottom-right-radius: 4px;
}
.tutor-msg.ai {
    align-self: flex-start; background: #f0f0f5; color: #1a1a2e;
    border-bottom-left-radius: 4px;
}
.tutor-msg.ai h1, .tutor-msg.ai h2, .tutor-msg.ai h3 { margin: 8px 0 4px; font-size: 15px; }
.tutor-msg.ai p { margin: 4px 0; }
.tutor-msg.ai ul, .tutor-msg.ai ol { margin: 4px 0; padding-left: 20px; }
.tutor-msg.ai code { background: rgba(0,0,0,0.06); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.tutor-msg.ai pre { background: rgba(0,0,0,0.06); padding: 10px; border-radius: 8px; overflow-x: auto; margin: 8px 0; }
.tutor-msg.ai pre code { background: none; padding: 0; }
.tutor-msg.ai table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.tutor-msg.ai th, .tutor-msg.ai td { border: 1px solid #ddd; padding: 6px 8px; text-align: center; }
.tutor-msg.ai th { background: #e8e8f0; font-weight: 600; }
.tutor-msg.ai svg { max-width: 100%; height: auto; display: block; margin: 8px auto; }

.tutor-msg.ai .score-badge {
    display: inline-block; background: #6C63FF; color: #fff;
    padding: 4px 12px; border-radius: 20px; font-weight: 700; font-size: 15px; margin: 4px 0;
}

/* Typing indicator */
.tutor-typing { display: flex; gap: 4px; padding: 12px 16px; align-self: flex-start; }
.tutor-typing span {
    width: 8px; height: 8px; background: #aaa; border-radius: 50%;
    animation: tutorBounce 1.4s ease-in-out infinite;
}
.tutor-typing span:nth-child(2) { animation-delay: 0.2s; }
.tutor-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes tutorBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
}

/* Chat input */
.tutor-input-area {
    display: flex; gap: 8px; padding: 12px 0; align-items: flex-end;
    border-top: 1px solid #eee; margin-top: 8px;
}
.tutor-input {
    flex: 1; border: 2px solid #e0e0e8; border-radius: 20px;
    padding: 10px 16px; font-size: 14px; outline: none;
    resize: none; max-height: 120px; min-height: 42px;
    font-family: inherit; line-height: 1.4;
}
.tutor-input:focus { border-color: #6C63FF; }
.tutor-input::placeholder { color: #aaa; }

.tutor-btn-send, .tutor-btn-camera {
    width: 42px; height: 42px; border-radius: 50%;
    border: none; cursor: pointer; display: flex;
    align-items: center; justify-content: center; flex-shrink: 0;
}
.tutor-btn-send { background: #6C63FF; color: #fff; }
.tutor-btn-send:disabled { opacity: 0.4; }
.tutor-btn-camera { background: #f0f0f5; color: #666; }
.tutor-btn-camera:active { background: #e0e0e8; }

/* Usage badge */
.tutor-usage {
    text-align: center; font-size: 12px; color: #888;
    padding: 4px 0; margin-bottom: 8px;
}
.tutor-usage .remaining { font-weight: 700; color: #6C63FF; }
.tutor-usage .low { color: #e74c3c; }

/* Topic picker */
.tutor-topic-list { display: flex; flex-direction: column; gap: 8px; }
.tutor-topic-item {
    display: flex; justify-content: space-between; align-items: center;
    background: #fff; border: 1px solid #eee; border-radius: 12px;
    padding: 12px 16px; cursor: pointer; transition: all 0.2s;
}
.tutor-topic-item:active { background: #f8f8ff; border-color: #6C63FF; }
.tutor-topic-item .topic-name { font-size: 14px; font-weight: 500; color: #333; }
.tutor-topic-item .topic-score {
    font-size: 12px; font-weight: 700; padding: 4px 10px;
    border-radius: 12px; min-width: 40px; text-align: center;
}
.tutor-topic-item .topic-score.green { background: #d4edda; color: #155724; }
.tutor-topic-item .topic-score.orange { background: #fff3cd; color: #856404; }
.tutor-topic-item .topic-score.red { background: #f8d7da; color: #721c24; }
.tutor-topic-item .topic-score.new { background: #e8e8f0; color: #666; }

/* Progress summary */
.tutor-progress-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 16px; padding: 20px; color: #fff; margin-bottom: 16px;
    text-align: center;
}
.tutor-progress-card .progress-pct { font-size: 36px; font-weight: 800; }
.tutor-progress-card .progress-label { font-size: 13px; opacity: 0.9; margin-top: 4px; }
.tutor-progress-stats {
    display: flex; justify-content: space-around; margin-top: 12px;
    font-size: 12px; opacity: 0.9;
}
.tutor-progress-stats .stat-val { font-size: 18px; font-weight: 700; display: block; }

/* Project coach */
.tutor-project-stages { display: flex; flex-direction: column; gap: 8px; }
.tutor-stage {
    display: flex; gap: 12px; align-items: flex-start;
    background: #fff; border: 1px solid #eee; border-radius: 12px;
    padding: 14px 16px; cursor: pointer; transition: all 0.2s;
}
.tutor-stage.completed { border-color: #28a745; background: #f0fff4; }
.tutor-stage.current { border-color: #6C63FF; background: #f8f8ff; }
.tutor-stage.locked { opacity: 0.5; cursor: default; }

.tutor-stage-num {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; flex-shrink: 0;
    background: #e8e8f0; color: #666;
}
.tutor-stage.completed .tutor-stage-num { background: #28a745; color: #fff; }
.tutor-stage.current .tutor-stage-num { background: #6C63FF; color: #fff; }

.tutor-stage-info { flex: 1; }
.tutor-stage-title { font-size: 14px; font-weight: 600; color: #333; }
.tutor-stage-timeline { font-size: 12px; color: #888; margin-top: 2px; }
.tutor-stage-score { font-size: 12px; font-weight: 700; color: #28a745; margin-top: 2px; }

/* Project submit area */
.tutor-project-submit {
    background: #fff; border-radius: 16px; padding: 16px;
    border: 1px solid #eee; margin-top: 12px;
}
.tutor-project-submit h3 { font-size: 15px; margin: 0 0 8px; color: #333; }
.tutor-project-textarea {
    width: 100%; border: 2px solid #e0e0e8; border-radius: 12px;
    padding: 12px; font-size: 14px; min-height: 120px; resize: vertical;
    font-family: inherit; outline: none;
}
.tutor-project-textarea:focus { border-color: #6C63FF; }

/* Trial banner */
.tutor-trial-banner {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    border-radius: 16px; padding: 20px; color: #fff;
    text-align: center; margin-bottom: 16px;
}
.tutor-trial-banner h2 { font-size: 18px; margin: 0 0 8px; }
.tutor-trial-banner p { font-size: 13px; opacity: 0.9; margin: 4px 0; }
.tutor-trial-btn {
    background: #fff; color: #f5576c; border: none; border-radius: 20px;
    padding: 10px 24px; font-size: 14px; font-weight: 700;
    cursor: pointer; margin-top: 12px;
}

/* Paywall */
.tutor-paywall {
    text-align: center; padding: 40px 20px;
}
.tutor-paywall h2 { font-size: 20px; color: #333; margin-bottom: 8px; }
.tutor-paywall p { font-size: 14px; color: #666; margin: 4px 0; }
.tutor-paywall .price { font-size: 32px; font-weight: 800; color: #6C63FF; margin: 16px 0; }
.tutor-paywall .pay-info {
    background: #f8f8ff; border-radius: 12px; padding: 16px;
    font-size: 13px; color: #333; margin-top: 16px; text-align: left;
}

/* Back button in tutor */
.tutor-back {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: none; color: #6C63FF;
    font-size: 14px; font-weight: 600; cursor: pointer;
    padding: 8px 0; margin-bottom: 8px;
}

/* Image preview */
.tutor-img-preview {
    max-width: 200px; max-height: 150px; border-radius: 8px;
    margin: 8px 0; border: 2px solid #6C63FF;
}

/* ─── Scan My Paper ──────────────────────────── */

.scan-paper-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #6C63FF, #A855F7);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 16px;
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.3);
    transition: transform 0.2s;
}
.scan-paper-btn:active { transform: scale(0.96); }

.scan-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0 4px;
}

.scan-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.scan-title h3 { margin: 0; font-size: 17px; }
.scan-title span { font-size: 12px; color: #888; }

.scan-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px 0;
    flex: 1;
    overflow-y: auto;
    align-content: start;
}

.scan-thumb {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #E0E0E0;
    aspect-ratio: 3/4;
    animation: scanFadeIn 0.3s ease;
}
@keyframes scanFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.scan-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.scan-page-num {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #6C63FF;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.scan-btn-retake {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.scan-btn-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(220,53,69,0.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.scan-add-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 3px dashed #B0BEC5;
    border-radius: 10px;
    background: #F5F7FA;
    color: #78909C;
    cursor: pointer;
    aspect-ratio: 3/4;
    font-size: 14px;
    font-weight: 600;
    transition: border-color 0.2s, color 0.2s;
}
.scan-add-btn:active {
    border-color: #6C63FF;
    color: #6C63FF;
}

.scan-footer {
    flex-shrink: 0;
    padding: 12px 0;
    border-top: 1px solid #eee;
}
.scan-notes {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    resize: none;
    margin-bottom: 8px;
    font-family: inherit;
}
.scan-submit-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #6C63FF, #A855F7);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.3);
    transition: transform 0.2s;
}
.scan-submit-btn:active { transform: scale(0.97); }
.scan-submit-btn.disabled {
    background: #ccc;
    box-shadow: none;
    cursor: not-allowed;
}

.scan-loading-bar {
    width: 200px;
    height: 6px;
    background: #E0E0E0;
    border-radius: 3px;
    margin: 20px auto 0;
    overflow: hidden;
}
.scan-loading-fill {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, #6C63FF, #A855F7);
    border-radius: 3px;
    animation: scanLoad 1.5s ease-in-out infinite;
}
@keyframes scanLoad {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* ─── Written Exam Mode ──────────────────────── */

.exam-list { display: flex; flex-direction: column; gap: 10px; }
.exam-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #E0E0E0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s;
    width: 100%;
}
.exam-card:active { border-color: #6C63FF; }
.exam-card-icon { font-size: 28px; }
.exam-card-info { flex: 1; }
.exam-card-title { font-size: 14px; font-weight: 700; color: #333; }
.exam-card-meta { font-size: 12px; color: #888; margin-top: 2px; }
.exam-card-arrow { font-size: 24px; color: #bbb; }

.exam-paper { padding: 0 0 20px; }
.exam-paper-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 2px solid #6C63FF;
    margin-bottom: 12px;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}
.exam-paper-title { font-size: 14px; line-height: 1.4; }
.exam-paper-title span { display: block; font-size: 12px; color: #888; font-weight: 400; }
.exam-timer-box {
    background: #E8EAF6;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 20px;
    font-weight: 800;
    color: #6C63FF;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.exam-instructions {
    background: #FFF8E1;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: #795548;
    line-height: 1.6;
    margin-bottom: 16px;
}
.exam-section { margin-bottom: 20px; }
.exam-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #6C63FF;
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
}
.exam-section-header h3 { margin: 0; font-size: 15px; }
.exam-section-header span { font-size: 13px; opacity: 0.9; }
.exam-section-instructions {
    font-size: 13px;
    color: #555;
    font-style: italic;
    margin-bottom: 12px;
    padding: 0 4px;
}
.exam-passage {
    background: #F5F5F5;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border-left: 4px solid #6C63FF;
}
.exam-passage-title {
    font-size: 16px;
    font-weight: 800;
    color: #333;
    margin-bottom: 8px;
}
.exam-passage-text {
    font-size: 14px;
    line-height: 1.8;
    color: #333;
}
.exam-passage-source {
    font-size: 11px;
    color: #999;
    margin-top: 8px;
    font-style: italic;
}
.exam-question {
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 1px solid #E8E8E8;
    border-radius: 8px;
    background: #fff;
}
.exam-q-num {
    font-weight: 700;
    font-size: 14px;
    color: #6C63FF;
    margin-bottom: 6px;
}
.exam-q-marks {
    font-size: 12px;
    color: #888;
    font-weight: 600;
}
.exam-q-part {
    padding: 4px 0 4px 16px;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}
.exam-q-label {
    font-weight: 700;
    color: #555;
    margin-right: 4px;
}
.exam-q-text {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}
.exam-end-actions {
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.exam-quit-btn {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    color: #888;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 360px) {
    .tutor-subjects { grid-template-columns: 1fr; }
    .tutor-msg { max-width: 100%; }
    .scan-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

/* v2.2.8 — collapsible stage accordions on Project home */
.tutor-stage-details summary::-webkit-details-marker { display: none; }
.tutor-stage-details[open] .tutor-chevron { transform: rotate(180deg); }
.tutor-stage-details:hover { border-color: #6C63FF !important; }

/* v2.2.8 — pulsing "View full project" button to draw the student's eye */
@keyframes tutorFlash {
    0%, 100% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.6); transform: scale(1); }
    50%      { box-shadow: 0 0 0 10px rgba(39, 174, 96, 0); transform: scale(1.02); }
}
.tutor-flash {
    animation: tutorFlash 1.4s ease-in-out infinite;
}
