/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 2px solid #e9ecef;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    color: #6c757d;
    font-style: italic;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 8px;
    padding: 15px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toolbar button {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar button:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.toolbar button:active {
    transform: translateY(0);
    background: #e9ecef;
}

.toolbar .separator {
    width: 1px;
    background: #dee2e6;
    margin: 0 4px;
}

/* Editor Container */
.editor-container {
    flex: 1;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-height: 400px;
}

#editor {
    width: 100%;
    height: 100%;
    min-height: 400px;
}

/* Stats Bar */
.stats-bar {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-top: none;
    padding: 8px 15px;
    font-size: 14px;
    color: #6c757d;
    border-radius: 0 0 8px 8px;
}

/* Footer */
.footer {
    margin-top: 20px;
    padding: 20px 0;
    border-top: 2px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.theme-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-selector label {
    font-weight: 500;
    color: #495057;
}

.theme-selector select {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

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

.controls button {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.controls button:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.controls button:active {
    background: #e9ecef;
}

/* OverType Custom Styles */
.overtype-editor {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    padding: 20px;
    border: none;
    outline: none;
    resize: none;
    width: 100%;
    height: 100%;
    background: transparent;
}

.overtype-preview {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    padding: 20px;
    background: transparent;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Theme: Cave */
.overtype-theme-cave {
    --bg: #1a1a1a;
    --text: #e0e0e0;
    --text-muted: #888;
    --border: #333;
    --accent: #4a9eff;
    --accent-hover: #5ba8ff;
    --bg-secondary: #2a2a2a;
    --bg-tertiary: #333;
}

.overtype-theme-cave .overtype-editor,
.overtype-theme-cave .overtype-preview {
    background: var(--bg);
    color: var(--text);
}

.overtype-theme-cave .toolbar {
    background: var(--bg-secondary);
    border-color: var(--border);
}

.overtype-theme-cave .toolbar button {
    background: var(--bg-tertiary);
    border-color: var(--border);
    color: var(--text);
}

.overtype-theme-cave .toolbar button:hover {
    background: var(--accent);
    color: white;
}

/* Theme: Solar */
.overtype-theme-solar {
    --bg: #fdf6e3;
    --text: #586e75;
    --text-muted: #839496;
    --border: #93a1a1;
    --accent: #268bd2;
    --accent-hover: #2aa198;
    --bg-secondary: #eee8d5;
    --bg-tertiary: #fdf6e3;
}

.overtype-theme-solar .overtype-editor,
.overtype-theme-solar .overtype-preview {
    background: var(--bg);
    color: var(--text);
}

.overtype-theme-solar .toolbar {
    background: var(--bg-secondary);
    border-color: var(--border);
}

.overtype-theme-solar .toolbar button {
    background: var(--bg-tertiary);
    border-color: var(--border);
    color: var(--text);
}

.overtype-theme-solar .toolbar button:hover {
    background: var(--accent);
    color: white;
}

/* Theme: Forest */
.overtype-theme-forest {
    --bg: #f0f8f0;
    --text: #2d4a3e;
    --text-muted: #5a7c65;
    --border: #8fbc8f;
    --accent: #228b22;
    --accent-hover: #32cd32;
    --bg-secondary: #e8f5e8;
    --bg-tertiary: #f0f8f0;
}

.overtype-theme-forest .overtype-editor,
.overtype-theme-forest .overtype-preview {
    background: var(--bg);
    color: var(--text);
}

.overtype-theme-forest .toolbar {
    background: var(--bg-secondary);
    border-color: var(--border);
}

.overtype-theme-forest .toolbar button {
    background: var(--bg-tertiary);
    border-color: var(--border);
    color: var(--text);
}

.overtype-theme-forest .toolbar button:hover {
    background: var(--accent);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .toolbar {
        gap: 4px;
        padding: 10px;
    }
    
    .toolbar button {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 35px;
    }
    
    .footer {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .theme-selector,
    .controls {
        justify-content: center;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Focus states */
.toolbar button:focus,
.controls button:focus,
.theme-selector select:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .toolbar button,
    .controls button {
        transition: none;
    }
    
    .loading {
        animation: none;
    }
}

