/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    margin: 0;
}

.home-btn {
    background: #667eea;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    transition: transform 0.2s;
}

.home-btn:hover {
    transform: scale(1.05);
    background: #5568d3;
}

/* Main Content */
main {
    padding: 40px 20px;
    min-height: calc(100vh - 200px);
}

/* Hero Section */
.hero {
    text-align: center;
    color: white;
    margin-bottom: 50px;
}

.hero h2 {
    font-size: 48px;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 20px;
    opacity: 0.95;
}

/* Topics Grid */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.topic-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
}

.topic-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.topic-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.topic-card h3 {
    font-size: 28px;
    margin-bottom: 15px;
    color: #333;
}

.topic-card p {
    color: #666;
    margin-bottom: 25px;
    font-size: 16px;
}

/* Info Section */
.info-section {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.info-section h3 {
    text-align: center;
    font-size: 32px;
    margin-bottom: 30px;
    color: #667eea;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.step {
    text-align: center;
}

.step-number {
    display: inline-block;
    width: 50px;
    height: 50px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    line-height: 50px;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
}

.step p {
    font-size: 16px;
    color: #666;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: scale(1.05);
}

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

.btn-secondary:hover {
    background: #7f8c8d;
    transform: scale(1.05);
}

.btn-success {
    background: #2ecc71;
    color: white;
}

.btn-success:hover {
    background: #27ae60;
    transform: scale(1.05);
}

/* Breadcrumb */
.breadcrumb {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: #666;
}

/* Prompt Selection */
.prompt-selection {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.prompt-selection h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 40px;
    font-size: 36px;
}

.prompts-list {
    display: grid;
    gap: 25px;
}

.prompt-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    border-left: 5px solid #667eea;
    transition: transform 0.2s;
}

.prompt-card:hover {
    transform: translateX(10px);
}

.prompt-card h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 24px;
}

.sections-preview {
    margin: 20px 0;
}

.sections-preview p {
    color: #666;
    font-weight: bold;
    margin-bottom: 10px;
}

.sections-preview ul {
    list-style: none;
    padding-left: 0;
}

.sections-preview li {
    padding: 5px 0;
    color: #555;
    padding-left: 20px;
    position: relative;
}

.sections-preview li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #2ecc71;
    font-weight: bold;
}

/* Writing Interface */
.writing-interface {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.writing-interface h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
    font-size: 36px;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: #666;
    font-weight: bold;
    margin-bottom: 30px;
}

/* Section */
.section {
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid #667eea;
}

.section-header h3 {
    color: #667eea;
    font-size: 28px;
}

.section-number {
    background: #667eea;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}

/* Prompt Box */
.prompt-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.prompt-text {
    font-size: 18px;
    line-height: 1.6;
    margin: 0;
}

/* Writing Area */
.writing-area {
    margin-bottom: 25px;
}

.writing-textarea {
    width: 100%;
    padding: 20px;
    border: 3px solid #e0e0e0;
    border-radius: 15px;
    font-size: 16px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    resize: vertical;
    transition: border-color 0.3s;
    line-height: 1.8;
}

.writing-textarea:focus {
    outline: none;
    border-color: #667eea;
}

.char-count {
    text-align: right;
    color: #666;
    font-size: 14px;
    margin-top: 10px;
}

/* Section Actions */
.section-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 25px;
}

/* Feedback Box */
.feedback-box {
    background: #e8f5e9;
    border: 2px solid #2ecc71;
    border-radius: 15px;
    padding: 25px;
    margin-top: 25px;
}

.feedback-box h4 {
    color: #27ae60;
    margin-bottom: 15px;
    font-size: 22px;
}

.feedback-box p {
    color: #333;
    line-height: 1.8;
    font-size: 16px;
}

.loading {
    font-style: italic;
    color: #666;
}

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

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 50px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: #667eea;
    font-size: 36px;
    margin-bottom: 20px;
}

.modal-content p {
    color: #666;
    font-size: 18px;
    margin-bottom: 30px;
}

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

/* Footer */
footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 0;
    text-align: center;
    color: #666;
    margin-top: 50px;
}

footer p {
    margin: 0;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero h2 {
        font-size: 32px;
    }
    
    .subtitle {
        font-size: 16px;
    }
    
    .topics-grid {
        grid-template-columns: 1fr;
    }
    
    .steps {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .modal-content {
        margin: 20px;
        padding: 30px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .btn-magic {
        width: 100%;
        padding: 15px;
    }
}

/* Magic Generator Styles */
.magic-generator-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 40px;
    text-align: center;
    border: 3px solid #ffd700;
}

.magic-generator-section h3 {
    color: #764ba2;
    margin-bottom: 15px;
}

.input-group {
    display: flex;
    max-width: 600px;
    margin: 20px auto;
    gap: 10px;
}

#magicInput {
    flex: 1;
    padding: 15px;
    border: 2px solid #ccc;
    border-radius: 25px;
    font-size: 1.1rem;
    outline: none;
}

#magicInput:focus {
    border-color: #667eea;
}

.btn-magic {
    background: linear-gradient(45deg, #ffd700, #ffa500);
    color: #fff;
    border: none;
    border-radius: 25px;
    padding: 0 30px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-magic:hover {
    transform: scale(1.05);
}

.magic-card {
    border: 3px solid #ffd700;
    background: #fff9e6;
}

.history-card {
    background: #f8f9fa;
    border: 2px dashed #ccc;
}

.btn-secondary {
    display: inline-block;
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    text-decoration: none;
    margin-top: 15px;
    font-weight: bold;
}

.btn-secondary-outline {
    background: transparent;
    border: 2px solid #6c757d;
    color: #6c757d;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 15px;
    transition: all 0.2s;
}

.btn-secondary-outline:hover {
    background: #6c757d;
    color: white;
}

.card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.hidden {
    display: none !important;
}

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

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

.error-message {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
}

.suggestion-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
    font-style: italic;
}

.suggestions-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.suggestion-chip {
    background: #eef2ff;
    border: 1px solid #667eea;
    color: #667eea;
    padding: 12px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
    text-align: left;
    white-space: normal;
    max-width: 100%;
}

.suggestion-chip:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* --- Dashboard & Admin Styles --- */

.dashboard-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}

.dash-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

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

.roster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.student-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
}

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

.avatar { font-size: 1.5rem; }

.track-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #edf2f7;
    padding: 15px 0;
}

.track-card:last-child { border-bottom: none; }

.badge {
    background: #eef2ff;
    color: #667eea;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.btn-sm {
    padding: 5px 15px;
    font-size: 0.9rem;
}

/* Dashboard specific form overrides */
.dash-section .modal-content { text-align: left; }
.form-group input, .form-group select { 
    width: 100%; padding: 10px; 
    border: 1px solid #cbd5e0; border-radius: 5px; 
}

/* --- Wizard Review Page Styles --- */

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

.wizard-animation {
    font-size: 5rem; 
    margin-bottom: 20px;
}

.loading-header {
    color: #4a5568; 
    margin-bottom: 15px;
}

.loading-text {
    font-size: 1.2rem; 
    color: #718096;
}

.progress-bar-container {
    width: 100%; 
    height: 10px; 
    background: #e2e8f0; 
    border-radius: 5px; 
    margin-top: 30px; 
    overflow: hidden;
}

.progress-indeterminate {
    width: 50%; 
    height: 100%; 
    background: #667eea; 
    border-radius: 5px; 
    animation: slide 2s infinite;
}

@keyframes slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

.completion-header {
    margin-bottom: 40px;
}

.completion-emoji {
    font-size: 4rem; 
    margin-bottom: 10px;
}

.completion-title {
    color: #2d3748;
}

.completion-subtitle {
     font-size: 1.2rem; 
     color: #718096;
}

.feedback-card {
    background: white; 
    border-radius: 15px; 
    padding: 30px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); 
    margin-bottom: 30px; 
    border-left: 5px solid #667eea;
}

.feedback-title {
    color: #4a5568; 
    margin-bottom: 15px;
}

.holistic-feedback-text {
    font-size: 1.1rem; 
    line-height: 1.6; 
    color: #2d3748;
}

.action-card {
    background: #f7fafc; 
    border-radius: 15px; 
    padding: 30px; 
    border: 2px dashed #cbd5e0;
}

.action-card-title {
    margin-bottom: 20px; 
    font-weight: bold; 
    color: #4a5568;
}

.next-actions-container {
     display: flex; 
     gap: 20px; 
     justify-content: center;
}

.details-toggle-btn {
    background: none; 
    border: none; 
    color: #667eea; 
    text-decoration: underline; 
    cursor: pointer; 
    display: block; 
    margin: 0 auto;
}

.detailed-feedback-container {
    display: none; 
    margin-top: 20px;
}

.detail-item {
    margin-bottom: 15px;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.detail-text {
    color: #4a5568;
}

/* Report Grid Layout */
.read-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.report-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
    align-items: start;
}

.story-column {
    background: white;
    border-radius: 15px;
    padding: 50px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    min-height: 80vh;
}

.report-column {
    position: sticky;
    top: 100px; /* Adjust for fixed navbar */
}

.report-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-top: 5px solid #667eea;
}

/* Story Typography */
.story-paper {
    font-family: 'Georgia', serif;
    font-size: 1.2rem;
    line-height: 1.8;
    color: #2c3e50;
    white-space: pre-wrap; /* For raw basic content */
}

/* Report Widgets */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.report-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #444;
}

.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.status-pass {
    background: #2ecc71;
    color: white;
}

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

.report-section {
    margin-bottom: 25px;
}

.report-section h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.insight-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid #6c5ce7;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.5;
}

.feedback-box {
    background: #fff8e1;
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid #f1c40f;
    font-style: italic;
    color: #665c2e;
}

/* Responsive */
@media (max-width: 900px) {
    .report-grid {
        grid-template-columns: 1fr;
    }
    .report-column {
        position: static;
        order: -1; 
    }
}


/* Switch Profile Button */
.nav-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.switch-btn {
    text-decoration: none;
    color: #555;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 15px;
    border-radius: 20px;
    transition: background 0.2s;
}

.switch-btn:hover {
    background: rgba(0,0,0,0.05);
    color: #333;
}


/* Mission Status Bar */
.mission-status-bar {
    background: rgba(255,255,255,0.2);
    display: inline-flex;
    align-items: center;
    gap: 15px;
    padding: 10px 20px;
    border-radius: 30px;
    margin-bottom: 20px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.3);
}

.badge-mission {
    background: #f1c40f;
    color: #8e44ad;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.8rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.mission-title {
    color: white;
    font-weight: 500;
}

.resume-banner {
    background: white;
    max-width: 600px;
    margin: 0 auto 40px auto;
    padding: 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    color: #333;
    animation: slideDown 0.5s ease-out;
}

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


/* Section Feedback Notes */
.section-feedback-note {
    background-color: #f0f7ff;
    border-left: 4px solid #667eea;
    padding: 15px;
    margin-top: 15px;
    margin-bottom: 25px;
    font-family: 'Segoe UI', sans-serif; /* Distinct from story serif font */
    font-size: 0.95rem;
    color: #4a5568;
    border-radius: 0 5px 5px 0;
}

.section-feedback-note strong {
    color: #5a67d8;
    margin-right: 5px;
}


/* Stats Bar on Hub */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 15px;
    font-size: 1rem;
    color: rgba(255,255,255,0.9);
    font-weight: bold;
}

.stats-bar span {
    background: rgba(0,0,0,0.2);
    padding: 5px 15px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}


/* Phase 6: Grammar & Remaster */
.grammar-error { text-decoration: underline wavy #ff4444; background-color: rgba(255, 0, 0, 0.05); cursor: help; }
.story-controls { display: flex; gap: 10px; margin: 15px 0; justify-content: flex-end; }

/* Dashboard Button */
.dashboard-btn { background: #48bb78; color: white; text-decoration: none; padding: 10px 20px; border-radius: 25px; font-weight: bold; transition: transform 0.2s; margin-right: 10px; }
.dashboard-btn:hover { transform: scale(1.05); background: #38a169; text-decoration: none; color: white; }

/* Grammar Feedback Styles */
.grammar-stats { display: flex; gap: 15px; margin: 10px 0; background: #f0f4f8; padding: 10px; border-radius: 8px; font-size: 0.9em; flex-wrap: wrap; }
.stat-pill { background: white; padding: 5px 10px; border-radius: 15px; border: 1px solid #cbd5e0; color: #4a5568; font-weight: bold; }
.marked-text-container { margin-top: 15px; padding: 15px; background: #fff; border: 2px solid #e2e8f0; border-radius: 8px; line-height: 1.6; font-family: 'Segoe UI', sans-serif; }
.grammar-error { text-decoration: underline wavy #ff4444; text-decoration-thickness: 2px; cursor: help; background: rgba(255,0,0,0.05); }
.feedback-history { margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px dashed #cbd5e0; color: #718096; font-style: italic; font-size: 0.9em; }
