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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --surface-light: #334155;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --success-color: #10b981;
    --error-color: #ef4444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

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

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

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.options-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-color);
    user-select: none;
}

.checkbox-container input {
    display: none;
}

.checkmark {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: var(--surface-color);
}

.checkbox-container:hover .checkmark {
    border-color: var(--primary-color);
}

.checkbox-container input:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-container input:checked + .checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 500px;
}

.editor-panel {
    display: flex;
    flex-direction: column;
    background: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow);
}

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

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn svg {
    flex-shrink: 0;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

.btn-secondary:hover {
    background: var(--secondary-hover);
    transform: translateY(-1px);
}

textarea {
    flex: 1;
    width: 100%;
    padding: 1.25rem;
    border: none;
    background: var(--surface-color);
    color: var(--text-color);
    font-family: 'SF Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

textarea::placeholder {
    color: var(--text-muted);
}

textarea:focus {
    background: rgba(99, 102, 241, 0.05);
}

#markdown-output {
    background: var(--bg-color);
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 0.875rem 1.5rem;
    background: var(--surface-color);
    color: var(--text-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    font-size: 0.95rem;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.toast.error {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

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

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .editor-container {
        grid-template-columns: 1fr;
        min-height: auto;
    }

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

    header h1 {
        font-size: 2rem;
    }

    .logo {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .logo-container {
        gap: 0.75rem;
    }

    .logo {
        width: 36px;
        height: 36px;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .options-bar {
        padding: 0.875rem 1rem;
    }

    .checkbox-container {
        font-size: 0.875rem;
    }

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

    .action-buttons {
        width: 100%;
    }

    .action-buttons .btn {
        flex: 1;
        justify-content: center;
    }

    .btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.8rem;
    }

    textarea {
        padding: 1rem;
        font-size: 0.85rem;
    }

    .editor-panel {
        min-height: 250px;
    }
}

/* Scrollbar styling */
textarea::-webkit-scrollbar {
    width: 8px;
}

textarea::-webkit-scrollbar-track {
    background: var(--surface-color);
}

textarea::-webkit-scrollbar-thumb {
    background: var(--surface-light);
    border-radius: 4px;
}

textarea::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}
