/* Base styles and variables */
:root {
    --sidebar-width: 220px;
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --text-color: #333;
    --light-bg: #f9f9f9;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0,0,0,0.05);
    --transition-speed: 0.3s;
    --poetry-accent: #8e44ad;
}

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

body {
    height: 100vh;
    background-color: #f5f5f5;
    color: var(--text-color);
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Layout containers */
.app-container {
    height: 100vh;
    position: relative;
    display: flex;
    width: 100%;
}

.content-area {
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    height: 100vh;
    overflow-y: auto;
    transition: margin-left var(--transition-speed) ease;
    flex: 1;
    display: flex;
    justify-content: center;
}

.content-area.full-width {
    margin-left: 0;
    width: 100%;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0;
    padding: 1rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-height: 80vh;
}

/* Left panel / Sidebar */
.left-panel {
    width: var(--sidebar-width);
    background-color: var(--primary-color);
    color: white;
    height: 100%;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 10;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: transform var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.left-panel.hidden {
    transform: translateX(-100%);
}

.sidebar-toggle {
    position: fixed;
    left: var(--sidebar-width);
    top: 10px;
    z-index: 20;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: left var(--transition-speed) ease, transform var(--transition-speed) ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.sidebar-toggle:hover {
    background-color: var(--secondary-color);
}

.sidebar-toggle.collapsed i {
    transform: rotate(180deg);
}

.sidebar-toggle.collapsed {
    left: 10px;
}

.panel-buttons {
    display: flex;
    flex-direction: column;
    padding: 0.8rem;
    flex-grow: 1;
}

.panel-button {
    background-color: transparent;
    color: white;
    border: none;
    padding: 0.7rem 0.8rem;
    margin-bottom: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
}

.panel-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.panel-button.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: bold;
}

.panel-footer {
    width: 100%;
    padding: 10px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    line-height: 1.4;
    margin-top: auto;
    background-color: rgba(0, 0, 0, 0.15);
}

.panel-footer p {
    margin: 0 0 3px 0;
}

/* External services section */
.external-services {
    margin-top: 1rem;
    margin-bottom: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.external-button {
    background-color: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.6rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
    font-size: 0.85rem;
}

.external-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.external-button i {
    font-size: 0.75rem;
}

/* Dropdown Frames in Sidebar */
.dropdown-frames {
    margin: 0.5rem 0 1rem 0;
}

.sidebar-frame {
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 0.7rem;
    margin-bottom: 0.8rem;
}

.frame-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #ecf0f1;
    display: flex;
    align-items: center;
}

.frame-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 14px;
    background-color: var(--secondary-color);
    margin-right: 6px;
    border-radius: 2px;
}

.frame-content {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.dropdown-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.dropdown-container label {
    font-size: 0.8rem;
    color: #bdc3c7;
    width: 35px;
    flex-shrink: 0;
}

.dropdown-container select {
    padding: 0.35rem 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.07);
    color: white;
    font-size: 0.8rem;
    flex-grow: 1;
}

.dropdown-container select:focus {
    outline: none;
    border-color: var(--secondary-color);
    background-color: rgba(255, 255, 255, 0.12);
}

.dropdown-container select option {
    background-color: var(--primary-color);
    color: white;
}

/* Chat container */
.chat-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.input-container {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: white;
    border-radius: 8px 8px 0 0;
}

.welcome-message {
    margin-bottom: 1rem;
    padding: 0.8rem;
    color: #555;
    font-size: 0.95rem;
    text-align: left;
}

textarea#user-input {
    width: 100%;
    min-height: 100px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    resize: vertical;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-color);
    transition: border-color var(--transition-speed) ease;
}

textarea#user-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.button-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.right-controls {
    display: flex;
    gap: 10px;
}

/* Buttons */
button {
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 4px;
    background-color: #f0f0f0;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

button:hover {
    background-color: #e0e0e0;
}

button:active {
    background-color: #d0d0d0;
}

#submit-button {
    background-color: var(--secondary-color);
    color: white;
    font-weight: 500;
}

#submit-button:hover {
    background-color: #2980b9;
}

#optimize-button {
    background-color: #f8f9fa;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    font-weight: 500;
}

#optimize-button:hover {
    background-color: #e9ecef;
}

#optimize-button.optimizing {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: wait;
}

/* Output container */
.output-container {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-color: var(--light-bg);
    border-radius: 0 0 8px 8px;
}

#output {
    min-height: 100px;
    line-height: 1.6;
    width: 100%;
}

/* Output content styling */
#output p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

#output h1, #output h2, #output h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-weight: 600;
}

#output h1 {
    font-size: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

#output h2 {
    font-size: 1.3rem;
}

#output h3 {
    font-size: 1.1rem;
}

#output ul, #output ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    padding-left: 1rem;
}

#output li {
    margin-bottom: 0.5rem;
}

#output code {
    background-color: #f0f0f0;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #e74c3c;
}

#output pre {
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1rem;
    border-left: 3px solid var(--secondary-color);
}

#output pre code {
    background-color: transparent;
    padding: 0;
    color: #333;
    font-size: 0.9rem;
}

#output blockquote {
    border-left: 3px solid var(--secondary-color);
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 1rem;
    color: #555;
}

#output table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

#output th, #output td {
    padding: 0.5rem;
    text-align: left;
    border: 1px solid var(--border-color);
}

#output th {
    background-color: #f5f5f5;
    font-weight: 600;
}

#output tr:nth-child(even) {
    background-color: #f9f9f9;
}

#output a {
    color: var(--secondary-color);
    text-decoration: none;
    border-bottom: 1px dotted var(--secondary-color);
}

#output a:hover {
    border-bottom: 1px solid var(--secondary-color);
}

/* System messages */
.system-message {
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    background-color: #f8f9fa;
    border-left: 3px solid #6c757d;
    width: 100%;
}

.system-message.error {
    background-color: #f8d7da;
    border-left-color: #dc3545;
}

.system-message.warning {
    background-color: #fff3cd;
    border-left-color: #ffc107;
}

.system-message.success {
    background-color: #d4edda;
    border-left-color: #28a745;
}

/* AI message */
.ai-message {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1.2rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    font-size: 1rem;
    color: #333;
    width: 100%;
}

/* Loading indicator */
#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6c757d;
    font-size: 0.9rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: var(--secondary-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Math formatting */
.math-inline {
    display: inline-block;
    margin: 0 0.2em;
}

.math-display {
    display: block;
    margin: 1em 0;
    text-align: center;
}

.MathJax {
    overflow-x: auto;
    max-width: 100%;
}

.math-code {
    display: block;
    margin: 1em 0;
    padding: 1em;
    background-color: #f8f9fa;
    border-radius: 4px;
    overflow-x: auto;
}

/* Question form styles */
.question-form-container {
    background-color: #fff;
    border-radius: 8px;
    padding: 1.5rem 2rem;
    margin-top: 1rem;
    box-shadow: var(--shadow);
    transition: all var(--transition-speed) ease;
    width: 100%;
}

.question-form-container h3 {
    margin-bottom: 1.2rem;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.form-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1.5rem;
}

.form-group {
    flex: 1;
    min-width: 0;
}

.form-group:last-child {
    margin-right: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
}

.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: #fff;
    font-size: 1rem;
    color: var(--text-color);
    transition: border-color var(--transition-speed);
}

.form-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Questions display container */
.questions-display-container {
    background-color: #fff;
    border-radius: 8px;
    padding: 1.5rem 2rem;
    margin-top: 0;
    box-shadow: var(--shadow);
    transition: all var(--transition-speed) ease;
    width: 100%;
    margin-bottom: 20px;
    flex: 1;
}

#question-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

#question-counter {
    font-weight: 500;
    color: var(--primary-color);
}

.question-text {
    font-size: 1.2rem;
    line-height: 1.7;
    margin-bottom: 2rem;
    color: var(--text-color);
    padding: 0 1rem;
}

.choices-container {
    margin-bottom: 1.5rem;
}

.choice-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding: 1rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: background-color 0.2s;
}

.choice-item:hover {
    background-color: #f5f9ff;
}

.choice-item input[type="radio"] {
    margin-top: 0.2rem;
    margin-right: 0.8rem;
}

.choice-item label {
    flex: 1;
    cursor: pointer;
}

.answer-container {
    background-color: #f8f9fa;
    border-radius: 6px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--secondary-color);
}

.answer-header {
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
}

.answer-explanation {
    line-height: 1.6;
    color: var(--text-color);
}

/* Navigation controls */
.navigation-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.nav-button {
    padding: 10px 20px;
    background-color: #4299e1;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    font-weight: 500;
}

.nav-button:disabled {
    background-color: #cbd5e0;
    cursor: not-allowed;
}

.nav-button:not(:disabled):hover {
    background-color: #3182ce;
    transform: translateY(-1px);
}

/* Empty state styling */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    background-color: #f8fafc;
    border-radius: 12px;
    margin: 20px 0;
}

.empty-state-icon {
    font-size: 48px;
    color: #a0aec0;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 24px;
    color: #4a5568;
    margin-bottom: 15px;
}

.empty-state p {
    font-size: 16px;
    color: #718096;
    max-width: 500px;
    line-height: 1.6;
}

/* Utility classes */
.hidden {
    display: none !important;
}

.highlight {
    background-color: rgba(255, 255, 0, 0.3);
    padding: 0.1rem 0.2rem;
    border-radius: 2px;
}

/* Create container */
#create-container {
    display: flex;
    flex-direction: column;
    padding: 20px;
    height: auto;
    min-height: calc(100vh - 60px);
}

/* Loading indicator for tests */
#test-loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin: 20px auto;
    width: 80%;
    max-width: 500px;
}

.spinner-icon {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

/* Poetry panel specific styles */
/* Removing the poetry-config-frame style since we removed that section */

#poetry-container {
    display: flex;
    flex-direction: column;
    padding: 2rem;
    height: auto;
    min-height: calc(100vh - 60px);
}

.poetry-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.poetry-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.poetry-selectors {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.selector-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.selector-group label {
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
}

.poetry-select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    min-width: 100px;
}

.poetry-button {
    margin-left: auto;
    background-color: var(--poetry-accent, var(--primary-color));
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.poetry-button:hover {
    background-color: var(--poetry-accent-hover, var(--primary-color-hover));
}

.poetry-content {
    padding: 0 1rem 1rem;
    overflow-y: auto;
    flex: 1;
}

/* Poetry Navigation */
.poem-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.poem-nav-button {
    background-color: var(--button-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.poem-nav-button:hover:not(:disabled) {
    background-color: var(--button-hover-bg);
}

.poem-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.poem-counter {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Poem Display */
.poem-display {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.poem-title {
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    text-align: center;
}

.poem-author {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    text-align: center;
}

.poem-content {
    font-size: 1.2rem;
    line-height: 2;
    margin-bottom: 2rem;
    text-align: center;
    white-space: pre-wrap;
}

.poem-section {
    margin-bottom: 1.5rem;
}

.poem-section h3 {
    font-size: 1.2rem;
    color: var(--poetry-accent, var(--primary-color));
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.poem-background, .poem-explanation {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .poetry-selectors {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .poetry-button {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
    }
    
    .poem-display {
        padding: 1.5rem;
    }
    
    .poem-title {
        font-size: 1.5rem;
    }
    
    .poem-content {
        font-size: 1.1rem;
    }
}

/* Loading spinner for poetry */
#poetry-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--poetry-accent, var(--primary-color));
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Poetry Panel */
#poetry-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

#poetry-panel.hidden {
    display: none;
}

#poetry-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem;
    overflow-y: auto;
}

.poetry-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.poetry-header h2 {
    margin: 0;
    color: var(--primary-color);
}

.poetry-config-frame {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background-color: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.config-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.config-row label {
    font-weight: 500;
    min-width: 80px;
}

.config-row select {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 120px;
}

.poetry-button {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    align-self: flex-start;
}

.poetry-button:hover {
    background-color: #0056b3;
}

.poetry-content {
    flex: 1;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
    color: #666;
}

#poetry-display {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.poem-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.poem-nav-button {
    padding: 0.5rem 1rem;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.poem-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.poem-display {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.poem-title {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
    text-align: center;
}

.poem-author {
    margin: 0.5rem 0 1rem;
    font-style: italic;
    text-align: center;
    color: #666;
}

.poem-content {
    font-size: 1.2rem;
    line-height: 1.8;
    text-align: center;
    margin: 1rem 0;
    padding: 1rem;
    background-color: #f9f9f9;
    border-radius: 8px;
    white-space: pre-line;
}

.poem-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.poem-section {
    padding: 1rem;
    background-color: #f5f5f5;
    border-radius: 8px;
}

.poem-section h4 {
    margin: 0 0 0.5rem;
    color: var(--primary-color);
}

.poem-section p {
    margin: 0;
    line-height: 1.6;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .poetry-config-frame {
        flex-direction: column;
    }
    
    .poem-display {
        padding: 1rem;
    }
    
    .poem-title {
        font-size: 1.3rem;
    }
    
    .poem-content {
        font-size: 1rem;
    }
} 