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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.main-content {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.panel {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.panel-header {
    background: white;
    padding: 15px 20px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.panel-header h2 {
    font-size: 1.3em;
    color: #495057;
}

.panel-actions {
    display: flex;
    gap: 8px;
}

.panel-content {
    padding: 20px;
}

.input-tabs {
    display: flex;
    gap: 5px;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: #e9ecef;
    color: #495057;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #dee2e6;
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.3s;
}

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

.rich-editor-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 6px;
}

.hint {
    color: #6c757d;
    font-size: 0.9em;
}

.rich-editor {
    min-height: 300px;
    max-height: 500px;
    padding: 20px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: white;
    overflow-y: auto;
    transition: border-color 0.3s;
    line-height: 1.6;
    font-size: 14px;
}

.rich-editor:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.rich-editor:empty::before {
    content: attr(data-placeholder);
    color: #adb5bd;
    font-style: italic;
}

.rich-editor .placeholder {
    color: #adb5bd;
    font-style: italic;
    pointer-events: none;
}

.rich-editor p {
    margin: 0 0 10px 0;
}

.rich-editor h1,
.rich-editor h2,
.rich-editor h3,
.rich-editor h4 {
    margin: 15px 0 10px 0;
    font-weight: bold;
}

.rich-editor ul,
.rich-editor ol {
    margin: 10px 0;
    padding-left: 30px;
}

.rich-editor li {
    margin: 5px 0;
}

.rich-editor table {
    border-collapse: collapse;
    margin: 10px 0;
    width: 100%;
}

.rich-editor td,
.rich-editor th {
    border: 1px solid #dee2e6;
    padding: 8px;
}

.rich-editor a {
    color: #667eea;
    text-decoration: underline;
}

.rich-editor p,
.rich-editor h1,
.rich-editor h2,
.rich-editor h3,
.rich-editor h4,
.rich-editor ul,
.rich-editor ol,
.rich-editor li {
    margin-bottom: 10px;
}

.upload-area {
    border: 3px dashed #dee2e6;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.upload-hint {
    color: #6c757d;
    margin: 15px 0;
}

#fileInput {
    display: none;
}

.file-info {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    display: none;
}

.file-info.show {
    display: block;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

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

.btn-primary:hover {
    background: #5568d3;
}

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9em;
}

.btn-large {
    padding: 15px 30px;
    font-size: 1.1em;
}

.action-bar {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

.output-panel {
    min-height: 300px;
}

.output-code {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
}

.output-code pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.output-code code {
    color: #f8f8f2;
}

.output-preview {
    padding: 20px;
    background: white;
    border-radius: 6px;
    border: 2px solid #dee2e6;
}

.output-preview h3 {
    margin-bottom: 15px;
    color: #495057;
}

.output-preview p {
    margin-bottom: 12px;
    line-height: 1.6;
}

.output-preview ul,
.output-preview ol {
    margin-left: 25px;
    margin-bottom: 12px;
}

.output-preview li {
    margin-bottom: 8px;
}

.output-preview a {
    color: #667eea;
    text-decoration: underline;
}

.status-message {
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    display: none;
}

.status-message.show {
    display: block;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    border-top: 2px solid #e9ecef;
}

.footer-credit {
    margin-top: 10px;
    font-weight: 500;
    color: #495057;
}

/* Header layout */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    margin: 0;
}

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

.btn-icon {
    padding: 8px 12px;
    font-size: 1.2em;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Side-by-side panels */
.panels-row {
    display: flex;
    gap: 25px;
}

.panel-half {
    flex: 1;
    min-width: 0;
}

.panel-half .panel-content {
    height: calc(100% - 60px);
}

.panel-half textarea {
    height: 100%;
    min-height: 300px;
}

.panel-half .rich-editor {
    height: 300px;
}

/* Dark mode */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
}

body.dark-mode .container {
    background: #1e1e1e;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

body.dark-mode header {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
}

body.dark-mode .panel {
    background: #2a2a2a;
    border-color: #3a3a3a;
}

body.dark-mode .panel-header {
    background: #252525;
    border-color: #3a3a3a;
}

body.dark-mode .panel-header h2 {
    color: #e0e0e0;
}

body.dark-mode textarea {
    background: #1a1a1a;
    color: #e0e0e0;
    border-color: #3a3a3a;
}

body.dark-mode textarea:focus {
    border-color: #667eea;
}

body.dark-mode .rich-editor {
    background: #1a1a1a;
    color: #e0e0e0;
    border-color: #3a3a3a;
}

body.dark-mode .rich-editor:focus {
    border-color: #667eea;
}

body.dark-mode .editor-toolbar {
    background: #252525;
}

body.dark-mode .hint {
    color: #a0a0a0;
}

body.dark-mode .upload-area {
    border-color: #3a3a3a;
    background: #1a1a1a;
}

body.dark-mode .upload-area:hover,
body.dark-mode .upload-area.dragover {
    border-color: #667eea;
    background: #252535;
}

body.dark-mode .file-info {
    background: #252525;
    color: #e0e0e0;
}

body.dark-mode .action-bar {
    background: #252525;
    border-color: #3a3a3a;
}

body.dark-mode .output-preview {
    background: #1a1a1a;
    border-color: #3a3a3a;
    color: #e0e0e0;
}

body.dark-mode .output-preview h3 {
    color: #e0e0e0;
}

body.dark-mode footer {
    background: #252525;
    border-color: #3a3a3a;
    color: #a0a0a0;
}

body.dark-mode .footer-credit {
    color: #e0e0e0;
}

body.dark-mode .tab-btn {
    background: #3a3a3a;
    color: #e0e0e0;
}

body.dark-mode .tab-btn:hover {
    background: #4a4a4a;
}

body.dark-mode .tab-btn.active {
    background: #667eea;
    color: white;
}

body.dark-mode .status-message.success {
    background: #1e4620;
    color: #75d97a;
    border-color: #2d5a30;
}

body.dark-mode .status-message.error {
    background: #4a1e1e;
    color: #f5a5a5;
    border-color: #5a2d2d;
}

body.dark-mode .status-message.info {
    background: #1e3a4a;
    color: #75c5d9;
    border-color: #2d4a5a;
}

@media (max-width: 768px) {
    .main-content {
        padding: 15px;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .input-tabs {
        width: 100%;
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1;
        min-width: 120px;
    }

    .action-bar {
        flex-direction: column;
    }
    
    /* Stack panels vertically on mobile */
    .panels-row {
        flex-direction: column;
    }
    
    .panel-half {
        width: 100%;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
}