:root {
    --bg-color: #f4f4f9;
    --editor-bg: #1e1e1e;
    --text-color: #333;
    --accent: #2563eb;
    --error: #ef4444;
    --code-bg: #e4e4e7;
    --card-bg: #ffffff;
}

/* === SHARED BASE STYLES === */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Header - shared across pages */
header {
    background: var(--card-bg);
    padding: 1rem 2rem;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

h1 { margin: 0; font-size: 1.4rem; color: #111; }

.nav-link {
    text-decoration: none;
    color: var(--accent);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 4px;
}
.nav-link:hover { background: rgba(37, 99, 235, 0.1); }

/* Shared button styles */
.btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn:hover { opacity: 0.9; }

/* === EDITOR PAGE STYLES === */
body.editor-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.editor-pane, .preview-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-pane { border-right: 1px solid #ddd; }

textarea {
    flex: 1;
    background: var(--editor-bg);
    color: #d4d4d4;
    border: none;
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
}

.preview-pane {
    padding: 20px;
    background: white;
    overflow-y: auto;
}

/* --- PREVIEW STYLES (Based on HTML generated by syntax.js) --- */
.preview-pane form { max-width: 600px; margin: 0 auto; }
.preview-pane h1 { font-size: 2em; margin-bottom: 0.5em; border-bottom: 2px solid #eee; padding-bottom: 10px;}
.preview-pane h2 { font-size: 1.5em; margin-top: 1em; margin-bottom: 0.5em; color: var(--accent); }
.preview-pane p { margin-bottom: 1em; line-height: 1.6; color: #444; }

.form-group { margin-bottom: 15px; }
.preview-pane label { display: block; font-weight: 600; margin-bottom: 5px; color: #444; }
.form-link {
    color: var(--accent);
    text-decoration: underline;
    font-weight: 500;
}
.form-link:hover {
    color: #1d4ed8;
    text-decoration: none;
}

/* Validation Styles */
.req-star { color: var(--error); margin-left: 2px; }
.req-legend { font-size: 0.85rem; color: #666; margin-bottom: 20px; font-style: italic; background: #fdf2f2; padding: 5px 10px; border-radius: 4px; display: inline-block;}

.preview-pane input[type="text"],
.preview-pane input[type="email"],
.preview-pane input[type="password"],
.preview-pane input[type="date"],
.preview-pane select,
.preview-pane textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
}

.preview-pane input:invalid:not(:placeholder-shown),
.preview-pane select:invalid {
    border-color: var(--error);
    background-color: #fff8f8;
}

.form-btn {
    width: 100%;
    padding: 12px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 10px;
}
.form-btn:hover { background: #059669; }

.check-item, .radio-item { margin-bottom: 5px; display: flex; align-items: baseline; }
.check-item input, .radio-item input { margin-right: 10px; }
.check-item label, .radio-item label { font-weight: normal; display: inline; }

/* === ABOUT/DOCUMENTATION PAGE STYLES === */
main {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

.intro {
    text-align: center;
    margin-bottom: 50px;
}
.intro p { font-size: 1.2rem; color: #666; }

/* Documentation Sections */
section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

h2 { margin-top: 0; color: var(--accent); border-bottom: 2px solid #f0f0f0; padding-bottom: 10px; }
h3 { margin-top: 20px; margin-bottom: 10px; font-size: 1rem; color: #555; }

/* Code Blocks */
pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
}

code {
    background: var(--code-bg);
    color: #d63384;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

/* Syntax Table */
.syntax-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 600px) {
    .syntax-grid { grid-template-columns: 1fr; }
}

.example-box {
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 6px;
}
.example-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    margin-bottom: 8px;
    display: block;
}

footer {
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 0.9rem;
}