/* Test edit: Multi-file coordination - Styling module v3.0 */
/* Coordinated test changes across the Socratic learning platform */
/* Third edit: Final styling update 2025-07-23 */
/* Fourth edit: Advanced CSS coordination v4.0 - final timestamp 2025-07-23T14:30:00 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    min-height: 100vh;
    overflow-y: auto;
}

/* Welcome Modal */
.welcome-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    cursor: default;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 30px 20px;
    border-radius: 15px 15px 0 0;
    text-align: center;
    position: relative;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
}

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

.modal-body {
    padding: 30px;
}

.modal-body p {
    margin: 0 0 15px 0;
    color: #555;
    line-height: 1.6;
    font-size: 1.1rem;
}

.modal-input-group {
    margin: 25px 0;
    display: flex;
    gap: 10px;
}

.modal-topic-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.modal-topic-input:focus {
    outline: none;
    border-color: #667eea;
}

.modal-start-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.modal-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

@media (max-width: 768px) {
    .modal-input-group {
        flex-direction: column;
    }

    .modal-start-btn {
        width: 100%;
    }
}

.modal-examples {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e1e5e9;
}

.modal-examples p {
    margin-bottom: 15px;
    color: #666;
    font-size: 0.95rem;
}

.example-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.example-topic {
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 20px;
    color: #495057;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-topic:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
}

.header {
    padding: 20px;
    border-bottom: 1px solid #e1e5e9;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

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

.version-info {
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
}

.version-badge {
    font-family: 'Monaco', 'Menlo', monospace;
    background: rgba(102, 126, 234, 0.15);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: #667eea;
    font-size: 11px;
    font-weight: 500;
}

.header h1 {
    margin: 0;
    color: #495057;
    font-size: 1.8em;
}

.title-link {
    color: #495057;
    text-decoration: none;
    transition: color 0.2s ease;
}

.title-link:hover {
    color: #667eea;
    text-decoration: underline;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    background: #ffffff;
    scroll-behavior: smooth;
    min-height: 0;
}

.message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
}

.message.user {
    justify-content: flex-end;
}

.message-content {
    max-width: 90%;
    padding: 12px 16px;
    border-radius: 20px;
    word-wrap: break-word;
    line-height: 1.4;
    flex: 1;
}

.image-sidebar {
    flex-shrink: 0;
}

/* Tutor messages - white background */
.message.tutor .message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 20px 20px 20px 5px;
}

/* User messages - blue background, right-aligned */
.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 5px 20px;
    margin-left: auto;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

/* 2-column grid for media elements in tutor messages */
.media-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: auto;
    gap: 16px;
    padding: 12px 0;
    margin-top: 8px;
    max-width: 100%;
    align-items: start;
}

.media-card {
    /* No borders, backgrounds, or rounding - let content style itself */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Text-based cards (joke, exercise) - compact sizing */
.media-card-text {
    max-height: 120px;
    overflow-y: auto;
}

/* Ensure content inside media cards fits */
.media-card > * {
    max-width: 100%;
    box-sizing: border-box;
}

.media-card iframe {
    max-width: 100%;
    min-height: 200px;
}

.input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.input-group {
    display: flex;
    gap: 10px;
    position: relative;
}

.textarea-wrapper {
    flex: 1;
    position: relative;
}

.topic-input {
    flex: 1;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

.topic-input:focus {
    border-color: #667eea;
}

.start-btn, .send-btn, .restart-btn {
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
}

.restart-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.start-btn:hover, .send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.start-btn:disabled, .send-btn:disabled, .restart-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.response-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s, height 0.2s ease;
    resize: none;
    min-height: 50px;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.4;
    font-family: inherit;
    box-sizing: border-box;
}

.response-input:focus {
    border-color: #667eea;
}

.input-hint {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 10px;
    color: #bbb;
    pointer-events: none;
    white-space: nowrap;
}

/* Mobile input layout */
@media (max-width: 768px) {
    .input-group {
        flex-wrap: wrap;
    }

    .input-group .response-input {
        width: 100%;
        flex: none;
        min-height: 60px;
        margin-bottom: 8px;
    }

    .input-group .send-btn,
    .input-group .restart-btn {
        flex: 1;
        padding: 12px 16px;
        font-size: 14px;
    }

    .input-group .input-hint {
        display: none;
    }
}

/* Auth status indicator */
.auth-status {
    font-size: 12px;
    margin-right: 12px;
}

.auth-status.logged-out .auth-warning {
    color: #e67e22;
}

.auth-status .auth-link {
    color: #667eea;
    text-decoration: none;
}

.auth-status .auth-link:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .auth-status {
        font-size: 10px;
        margin-right: 8px;
    }
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: white;
    margin-top: 10px;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.conversation-info {
    margin: 10px 20px 0 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.conversation-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 24px;
}

.back-link {
    color: #6c757d;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    font-size: 0.9rem;
    margin-right: 0;
}

.back-link:hover {
    color: #495057;
    text-decoration: underline;
}

.topic-display {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topic-label {
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
}

.topic-name {
    font-weight: 600;
    color: #495057;
    font-size: 1rem;
}

.knowledge-level {
    background: rgba(255,255,255,0.15);
    color: #fff;
    padding: 10px 18px;
    border-radius: 16px;
    margin: 12px auto;
    text-align: center;
    font-size: 15px;
    border: 1px solid rgba(255,255,255,0.25);
    transition: all 0.3s ease;
    opacity: 0.95;
    max-width: 800px;
    width: 100%;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.knowledge-level.updated {
    animation: pulse 0.6s ease-in-out;
}

.knowledge-progress {
    margin-top: 8px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.message-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 8px;
    cursor: pointer;
    object-fit: contain;
}

.image-wrapper {
    position: relative;
    margin-bottom: 15px;
    width: 100%;
    max-width: 100%;
}

/* Image Grid/Lightbox System */
.image-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 0;
    margin-bottom: 10px;
    width: 100%;
}

.query-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.query-header {
    font-size: 13px;
    font-weight: bold;
    color: #444;
    margin-bottom: 4px;
}

.query-images {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.image-thumbnail-wrapper {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    background: #f0f0f0;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

.image-sidebar .image-thumbnail-wrapper {
    width: 100%;
    max-width: 180px;
    max-height: 180px;
}

.image-sidebar .query-group {
    margin-bottom: 8px;
}

.image-sidebar .query-header {
    font-size: 11px;
    margin-bottom: 4px;
    color: #666;
}

.inline-gallery {
    width: 100%;
}

.inline-gallery img {
    cursor: pointer;
    transition: opacity 0.2s;
}

.inline-gallery img:hover {
    opacity: 0.9;
}

.image-thumbnail-wrapper:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.image-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 12px;
    text-align: center;
    width: 100%;
    padding: 8px;
}

/* Lightbox */
#image-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

#lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

#lightbox-counter {
    color: white;
    margin-top: 15px;
    font-size: 14px;
    font-weight: 500;
}

/* Ensure YouTube videos and other media don't break layout */
.video-content iframe,
.tiktok-content iframe {
    max-width: 100%;
    height: auto;
    aspect-ratio: 16/9;
}

.video-content,
.tiktok-content {
    max-width: 100%;
    overflow: hidden;
}

.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 11px;
    font-style: italic;
    background: rgba(255,255,255,0.9);
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.topic-suggestion {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 15px;
    margin: 10px auto;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    animation: slideIn 0.5s ease-out;
    position: relative;
    max-width: 800px;
    width: 100%;
}

.topic-suggestion h3 {
    margin-bottom: 8px;
    font-size: 1.1em;
}

.topic-suggestion p {
    margin-bottom: 15px;
    opacity: 0.9;
}

.suggestion-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 10px;
}

.suggestion-topic {
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(255,255,255,0.3);
}

.suggestion-topic:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

.close-suggestion {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.close-suggestion:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Previous conversation separator */
.previous-conversation {
    text-align: center;
    margin: 20px 0;
    color: #6c757d;
    font-size: 0.9em;
    font-style: italic;
    border-top: 1px solid #dee2e6;
    padding-top: 15px;
}

.previous-conversation::before {
    content: "Previous conversation";
    background: #f8f9fa;
    padding: 5px 15px;
    border-radius: 15px;
    border: 1px solid #dee2e6;
} 

/* Curriculum Display */
.curriculum-display {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-note {
    font-size: 0.9em;
    color: #868e96;
    margin-top: 10px;
    font-style: italic;
}

.conversation-status {
    margin-top: 20px;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    text-align: center;
}

.status-badge {
    display: inline-block;
    background: #f39c12;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    margin-bottom: 10px;
}

.conversation-status p {
    margin: 0;
    color: #856404;
    font-size: 0.9em;
}

/* Curriculum Display Styles */
.curriculum-display {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    font-size: 14px;
}

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

.curriculum-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-toggle.inline {
    padding: 2px 8px;
}

.curriculum-header h4 {
    margin: 0;
    color: #495057;
    font-size: 16px;
}

.curriculum-progress {
    background: #28a745;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 12px;
}

.curriculum-model-info {
    margin-left: auto;
    margin-right: 8px;
}

.model-badge {
    background: #e7f5ff;
    color: #1971c2;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-family: monospace;
    cursor: help;
}

.curriculum-subtopics h5 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 14px;
}

.subtopics-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subtopic-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.subtopic-item.current {
    background: #e3f2fd;
    border-color: #2196f3;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.1);
}

.subtopic-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.subtopic-status {
    font-size: 16px;
    min-width: 20px;
}

.subtopic-name {
    flex: 1;
    font-weight: 500;
    color: #212529;
}

.subtopic-knowledge {
    background: #17a2b8;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
}

.subtopic-difficulty {
    color: #6c757d;
    font-size: 11px;
    min-width: 80px;
    text-align: right;
}

.current-subtopic {
    margin-top: 15px;
    padding: 10px;
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 6px;
    text-align: center;
    color: #0c5460;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .curriculum-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .subtopic-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .subtopic-difficulty {
        min-width: auto;
        text-align: left;
    }

    /* =====================================================
       MOBILE LAYOUT REDESIGN - Single column, widgets first
       ===================================================== */

    /* Mobile: Sidebar as slide-in overlay */
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        width: 85%;
        max-width: 350px;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }

    .sidebar.mobile-open {
        left: 0;
    }

    /* Mobile: Overlay backdrop */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-backdrop.visible {
        display: block;
    }

    /* Mobile: Main content takes full width */
    .main-content {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Mobile: Show hamburger menu */
    .mobile-menu-btn {
        display: block !important;
    }

    /* Mobile: Simplified header */
    .header {
        padding: 12px !important;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .header h1 {
        font-size: 1.1rem !important;
        flex: 1;
    }

    .header-actions {
        gap: 6px;
    }

    /* Hide version info on mobile */
    .header .version-info {
        display: none;
    }

    /* Smaller New Conversation button */
    .header .start-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Mobile: Chat container - full width, minimal padding */
    .chat-container {
        padding: 8px !important;
    }

    /* Mobile: Messages - single column */
    .message {
        max-width: 100% !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        margin-bottom: 12px;
    }

    .message-content {
        max-width: 100% !important;
        padding: 10px 14px;
        font-size: 15px;
    }

    /* Mobile: User messages - slight indent from right */
    .message.user .message-content {
        max-width: 85%;
    }

    /* =====================================================
       KEY: Tutor messages - widgets ABOVE text on mobile
       So user sees the question when typing their response
       ===================================================== */

    /* The leftColumnContainer holds: contentDiv (text) then mediaStrip (widgets)
       We reverse this order on mobile so widgets appear first */
    .message.tutor > div:first-child {
        display: flex !important;
        flex-direction: column-reverse !important;
    }

    /* Media strip - single column on mobile */
    .media-strip {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        margin-bottom: 12px;
    }

    /* Image container - single column */
    .image-container {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }

    /* Image thumbnails - larger on mobile for easier tapping */
    .image-thumbnail-wrapper {
        max-height: 200px;
        aspect-ratio: 16/9;
    }

    .image-sidebar {
        width: 100% !important;
        margin-top: 0;
        margin-bottom: 12px;
    }

    .image-sidebar .image-thumbnail-wrapper {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 180px;
    }

    .image-sidebar .query-group {
        width: 100%;
    }

    /* YouTube videos - full width */
    .video-content iframe {
        width: 100% !important;
        height: auto;
        min-height: 200px;
        aspect-ratio: 16/9;
    }

    /* Charts - full width */
    .media-card {
        width: 100%;
    }

    /* Jokes and exercises - full width, readable */
    .media-card-text {
        max-height: none !important;
        overflow-y: visible !important;
    }

    /* Stack joke and exercise vertically */
    .joke-exercise-row {
        flex-direction: column !important;
        gap: 12px !important;
    }

    /* Debug/time row - simplified */
    .debug-time-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    /* =====================================================
       Mobile Input Area - Clean and accessible
       ===================================================== */

    .input-container {
        padding: 10px !important;
        border-top: 2px solid #e0e0e0;
    }

    .input-group {
        flex-direction: column;
        gap: 8px;
    }

    .textarea-wrapper {
        width: 100%;
    }

    .response-input {
        width: 100% !important;
        min-height: 50px;
        max-height: 120px;
        font-size: 16px; /* Prevents iOS zoom */
        border-radius: 20px;
        padding: 12px 16px;
    }

    /* Buttons row */
    .input-group .send-btn,
    .input-group .restart-btn {
        flex: 1;
        padding: 14px 16px;
        font-size: 15px;
        min-height: 48px; /* Touch-friendly */
    }

    /* Hide input hint on mobile */
    .input-hint {
        display: none;
    }

    /* =====================================================
       Conversation info bar - compact
       ===================================================== */

    .conversation-info {
        margin: 8px 10px !important;
        padding: 8px 12px;
        background: #f8f9fa;
        border-radius: 8px;
    }

    .topic-display {
        font-size: 14px;
    }

    /* =====================================================
       Status checklist - compact header
       ===================================================== */

    #statusChecklist {
        font-size: 11px;
    }

    #statusChecklistHeader {
        padding: 6px 12px !important;
    }

    #modelBadge {
        font-size: 10px !important;
    }

    /* =====================================================
       Welcome modal - mobile friendly
       ===================================================== */

    .modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .modal-header h2 {
        font-size: 1.4rem;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-input-group {
        flex-direction: column;
        gap: 10px;
    }

    .modal-start-btn {
        width: 100%;
        padding: 14px;
    }

    .example-topics {
        justify-content: center;
    }

    .example-topic {
        font-size: 13px;
        padding: 6px 12px;
    }
} 

/* Mobile menu button - hidden on desktop */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    margin-right: 10px;
}

/* Sidebar backdrop - only used on mobile */
.sidebar-backdrop {
    display: none;
}

/* Mobile loading indicator - hidden on desktop, shown on mobile */
.mobile-loading-indicator {
    display: none;
    padding: 20px;
    text-align: center;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid #e1e5e9;
    border-radius: 8px;
    margin: 10px;
}

.mobile-loading-content {
    max-width: 400px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .mobile-loading-indicator {
        display: block;
    }
}

/* Main Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-right: 1px solid #e1e5e9;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow: hidden;
    padding-top: 12px;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

.sidebar.collapsed {
    width: 60px;
}

/* Keep sidebar content visible when collapsed, but hide text/details */
.sidebar.collapsed .sidebar-content {
    display: block;
}

.sidebar.collapsed .curriculum-header h4,
.sidebar.collapsed .curriculum-header .curriculum-progress,
.sidebar.collapsed .curriculum-subtopics,
.sidebar.collapsed .topic-suggestion,
.sidebar.collapsed .knowledge-level {
    display: none;
}

.sidebar-controls {
    padding: 15px 20px 10px;
    border-bottom: 1px solid #e1e5e9;
    background: #ffffff;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.sidebar-toggle {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.sidebar-toggle:hover {
    background: #5a6268;
}

.sidebar.collapsed .sidebar-content {
    display: none;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

/* Header */
.header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background: #fff;
}

.header h1 {
    margin: 0;
    color: #495057;
}

.conversation-info {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.back-link {
    color: #6c757d;
    text-decoration: none;
    font-size: 0.9em;
}

.back-link:hover {
    color: #495057;
}

.conversation-title {
    font-weight: bold;
    color: #495057;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

/* Input Container */
.input-container {
    padding: 20px;
    border-top: 1px solid #dee2e6;
    background: #fff;
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.topic-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 16px;
}

.response-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 16px;
    min-height: 60px;
    resize: vertical;
    font-family: inherit;
}

.start-btn, .send-btn, .restart-btn {
    padding: 12px 24px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

.start-btn:hover, .send-btn:hover {
    background: #0056b3;
}

.restart-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.restart-btn:hover {
    background: linear-gradient(135deg, #ee5a6f 0%, #dc4a5f 100%);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
    transform: translateY(-1px);
}

/* Loading */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
    z-index: 1000;
    display: none;
    color: #495057;
    font-weight: 500;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
} 

.sidebar-toggle.collapsed-only {
    display: none;
    position: absolute;
    top: 16px;
    left: 12px;
    z-index: 2;
}

.sidebar.collapsed .sidebar-toggle.collapsed-only {
    display: inline-block;
}

/* Ensure sidebar has positioning context (desktop only - mobile uses fixed) */
@media (min-width: 769px) {
    .sidebar {
        position: relative;
    }
} 