:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --bg-color: #FAF9F5;
    --text-color: #1e293b;
    --border-color: #e9e5dc;
    --card-bg: #FFFCF5;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --success-color: #10b981;
    --error-color: #ef4444;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    --transition: all 0.3s ease;
}

.dark-theme {
    --bg-color: #0f172a;
    --text-color: #e2e8f0;
    --border-color: #334155;
    --card-bg: #1e293b;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    --secondary-color: #94a3b8;
    --secondary-hover: #cbd5e1;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
}

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

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

header p {
    font-size: 1.1rem;
    color: var(--secondary-color);
}

.converter-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.editor-container {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: var(--transition);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.editor-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

textarea {
    width: 100%;
    height: 300px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    border: none;
    resize: none;
    background-color: var(--card-bg);
    color: var(--text-color);
    transition: var(--transition);
}

textarea:focus {
    outline: none;
}

.controls {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.9rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: transparent;
    color: var(--secondary-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
    color: var(--secondary-hover);
}

.preview-container {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: var(--transition);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.preview-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.settings {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.theme-toggle, .language-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--secondary-color);
    transition: var(--transition);
}

.theme-btn:hover, .theme-btn.active {
    color: var(--primary-color);
}

.lang-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--secondary-color);
    transition: var(--transition);
}

.lang-btn:hover, .lang-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.preview-content {
    padding: 1.5rem;
    min-height: 300px;
    overflow-y: auto;
}

/* Markdown preview styles */
.preview-content h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.preview-content h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
}

.preview-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    margin-top: 1.25rem;
}

.preview-content p {
    margin-bottom: 1rem;
}

.preview-content ul, .preview-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.preview-content li {
    margin-bottom: 0.25rem;
}

.preview-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.preview-content a:hover {
    text-decoration: underline;
}

.preview-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.preview-content code {
    font-family: 'Courier New', monospace;
    background-color: #f3f0e6;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.9em;
}

.dark-theme .preview-content code {
    background-color: #2d3748;
}

.preview-content pre {
    background-color: #f3f0e6;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.dark-theme .preview-content pre {
    background-color: #2d3748;
}

.preview-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

.preview-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.preview-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

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

.preview-content th {
    background-color: var(--border-color);
}

footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-color);
}

footer i {
    color: #ef4444;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    background-color: var(--success-color);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(1rem);
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    background-color: var(--error-color);
}

/* Responsive design */
@media (max-width: 992px) {
    .converter-container {
        grid-template-columns: 1fr;
    }
    
    .controls {
        flex-direction: row;
        justify-content: center;
        padding: 1rem 0;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    textarea {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .editor-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .preview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .settings {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .language-toggle, .theme-toggle {
        width: 100%;
        justify-content: space-between;
    }
}