/* Tool Specific Styles */
.tool-container {
    max-width: 1200px; /* Wider for split view */
    margin: 0 auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: calc(100vh - 140px); /* Full height on desktop */
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-surface);
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.tool-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-main);
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: serif;
}

.tool-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-blue);
    border-color: var(--primary-blue);
}

.tool-btn.italic { font-style: italic; }

.spacer { flex: 1; }

.small-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    height: 36px;
}

/* Editor Grid */
.editor-grid {
    display: flex;
    flex: 1;
    gap: 16px;
    min-height: 400px;
}

.editor-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.pane-header {
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Input Area */
textarea {
    flex: 1;
    width: 100%;
    padding: 16px;
    border: none;
    resize: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    background-color: var(--bg-surface);
    color: var(--text-main);
    outline: none;
    line-height: 1.6;
}

/* Preview Area (Standard Markdown Styles) */
.markdown-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    line-height: 1.7;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.25;
}

.markdown-body h1 { font-size: 2em; border-bottom: 1px solid var(--border-color); padding-bottom: 0.3em; }
.markdown-body h2 { font-size: 1.5em; border-bottom: 1px solid var(--border-color); padding-bottom: 0.3em; }
.markdown-body p { margin-bottom: 16px; }
.markdown-body a { color: var(--primary-blue); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body blockquote {
    margin: 0 0 16px;
    padding: 0 1em;
    color: var(--text-muted);
    border-left: 0.25em solid var(--border-color);
}
.markdown-body code {
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    background-color: rgba(175, 184, 193, 0.2);
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
}
.markdown-body pre {
    padding: 16px;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background-color: var(--bg-body);
    border-radius: 6px;
    margin-bottom: 16px;
}
.markdown-body pre code {
    background-color: transparent;
    padding: 0;
}
.markdown-body ul, .markdown-body ol {
    padding-left: 2em;
    margin-bottom: 16px;
}
.markdown-body img {
    max-width: 100%;
    box-sizing: border-box;
    border-radius: 8px;
}

/* Modal & Toast (Reused) */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5); z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px); transition: all 0.3s ease;
}
.modal-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.modal-content {
    background: var(--bg-surface); width: 90%; max-width: 400px;
    padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--border-color);
}
.modal-header { display: flex; justify-content: space-between; margin-bottom: 16px; }
.modal-header h3 { font-size: 1.2rem; font-weight: 700; color: var(--text-main); }
.modal-body p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 12px; }
.icon-button { background: none; border: none; padding: 6px; cursor: pointer; color: var(--text-muted); }

.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background-color: var(--accent-green); color: white; padding: 12px 24px;
    border-radius: 50px; font-weight: 600; font-size: 0.9rem;
    opacity: 0; visibility: hidden; transition: all 0.3s ease; z-index: 3000;
}
.toast.visible { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 768px) {
    .tool-container { height: auto; }
    .editor-grid { flex-direction: column; height: auto; }
    .editor-pane { height: 300px; }
}