/* Shared styles for all SquibView examples */

/* Reset and base typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0 6rem;
    padding: 10px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #212529;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Example header section */
.example-header {
    padding: 0px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
}

.example-title {
    margin: 0 0 5px 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #212529;
}

.example-version {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0;
}

.example-description {
    font-size: 0.875rem;
    color: #495057;
    margin-top: 0.25rem;
    max-width: 900px;
}

/* Controls section */
.controls,
.demo-controls {
    padding: 8px 0;
    background: #ffffff;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.controls button,
.demo-controls button {
    margin-right: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: #0066cc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    transition: background-color 0.2s ease;
}

.controls button:hover,
.demo-controls button:hover {
    background: #0052a3;
}

.controls button:active,
.demo-controls button:active {
    transform: translateY(1px);
}

.controls button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.65;
}

/* Editor container */
.editor-container {
    flex: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    margin-bottom: 10px;
}

/* Default editor height */
#editor,
#editorContainer {
    height: calc(100vh - 120px);
    min-height: 400px;
}

/* Editor with controls above */
#editor.with-controls {
    height: calc(100vh - 180px);
}

/* Multiple editors support */
.instance-container {
    margin: 20px 0;
}

.instance-label {
    padding: 10px;
    background: #333;
    color: white;
    font-weight: bold;
    border-radius: 8px 8px 0 0;
}

/* Remove any default borders from SquibView internals */
.squibview-container {
    border: none;
}

/* Fix double borders in split view */
.squibview-editor[data-view="split"] .squibview-input,
.squibview-editor[data-view="split"] .squibview-source-panel .squibview-input {
    border-right: none !important;
}

.squibview-editor[data-view="split"] .squibview-source-panel {
    border-right: none !important;
}

/* Status messages */
.status-message,
.status {
    padding: 0.75rem 1rem;
    background: #e3f2fd;
    color: #495057;
    font-size: 0.875rem;
    border-radius: 4px;
    margin: 10px 0;
}

.status-message.error {
    background: #ffebee;
    color: #721c24;
}

.status-message.success {
    background: #e8f5e9;
    color: #155724;
}

/* Common heading styles */
h1 {
    margin: 0 0 0.5em 0;
    font-size: 1.8em;
    color: #333;
}

h2 {
    margin: 0.5em 0;
    font-size: 1.4em;
    color: #666;
}

/* Intro paragraph */
body > p:first-of-type,
.description {
    margin: 0 0 1em 0;
    color: #666;
}

/* Common code/pre styles */
pre {
    background: #f5f5f5;
    padding: 1em;
    border-radius: 4px;
    overflow-x: auto;
}

code {
    background: #f5f5f5;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

pre code {
    background: transparent;
    padding: 0;
}

/* Dark theme support */
.dark-theme {
    --squibview-background-color: #1a1a1a;
    --squibview-input-background-color: #1a1a1a;
    --squibview-output-background-color: #1a1a1a;
    --squibview-primary-color: #363636;
    --squibview-primary-text-color: #4a9eff;
    --squibview-secondary-color: #4a9eff;
    --squibview-secondary-text-color: #ffffff;
    --squibview-border-color: #444;
    --squibview-gutter-bg: #1a1a1a;
    --squibview-gutter-fg: #888;
    --squibview-gutter-border: #444;
    --squibview-table-header-bg: #2d2d2d;
    --squibview-code-block-bg: #0d0d0d;
    --squibview-caret-color: #4a9eff;
}

.dark-theme body {
    background-color: #0d0d0d;
    color: #e0e0e0;
}

.dark-theme .squibview-input {
    color: #e0e0e0;
    background-color: #1a1a1a !important;
}

.dark-theme .squibview-output {
    color: #e0e0e0;
    background-color: #1a1a1a !important;
}

.dark-theme .squibview-title {
    background-color: #2d2d2d;
    color: #e0e0e0;
    border-bottom-color: #444;
}

.dark-theme .squibview-controls {
    background-color: #2d2d2d;
    border-bottom-color: #444;
}

.dark-theme .squibview-controls button {
    background-color: #363636;
    color: #e0e0e0;
    border-color: #555;
}

.dark-theme .squibview-controls button:hover {
    background-color: #444;
}

.dark-theme .squibview-controls button.active {
    background-color: #4a9eff;
    color: #ffffff;
    border-color: #4a9eff;
}

.dark-theme .demo-controls button,
.dark-theme .controls button {
    background: #2d2d2d;
    color: #e0e0e0;
    border-color: #555;
}

.dark-theme .demo-controls button:hover,
.dark-theme .controls button:hover {
    background: #3d3d3d;
    border-color: #666;
}

.dark-theme h1, .dark-theme h2 {
    color: #e0e0e0;
}

.dark-theme .example-header {
    background: #2d2d2d;
}

.dark-theme pre {
    background: #2d2d2d;
}

.dark-theme .squibview-line-gutter {
    background-color: #1a1a1a !important;
    color: #888;
}

/* Dark theme for rendered output */
.dark-theme .squibview-output h1,
.dark-theme .squibview-output h2,
.dark-theme .squibview-output h3,
.dark-theme .squibview-output h4,
.dark-theme .squibview-output h5,
.dark-theme .squibview-output h6 {
    color: #e0e0e0;
}

.dark-theme .squibview-output code {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

.dark-theme .squibview-output pre code {
    background-color: transparent;
}

.dark-theme .squibview-output blockquote {
    border-left-color: #4a9eff;
    color: #ccc;
}

.dark-theme .squibview-output table {
    color: #e0e0e0;
}

.dark-theme .squibview-output th {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

.dark-theme .squibview-output td {
    border-color: #444;
}

/* High contrast theme adjustments */
.high-contrast-theme .squibview-input,
.high-contrast-theme .squibview-output {
    border-width: 1px;
}

.high-contrast-theme .squibview-editor[data-view="split"] .squibview-input {
    border-right: none;
}

.high-contrast-theme .squibview-editor[data-view="split"] .squibview-source-panel {
    border-right: none;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    body {
        padding: 15px;
    }

    .editor-container {
        margin: 0 10px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1, .example-title {
        font-size: 1.5em;
    }

    h2 {
        font-size: 1.2em;
    }

    .controls,
    .demo-controls {
        gap: 5px;
        padding: 8px;
    }

    .controls button,
    .demo-controls button {
        padding: 6px 12px;
        font-size: 13px;
    }

    .editor-container {
        margin: 0 5px;
    }

    #editor {
        height: calc(100vh - 180px);
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .example-header {
        padding: 10px;
        border-radius: 0;
    }

    .example-title {
        font-size: 1.25rem;
    }

    .example-version {
        font-size: 0.75rem;
    }

    .example-description {
        font-size: 0.875rem;
    }

    .controls,
    .demo-controls {
        padding: 5px;
    }

    .editor-container {
        margin: 0;
        border-radius: 0;
    }

    .controls button,
    .demo-controls button {
        flex: 1;
        margin: 2px;
        padding: 8px;
        font-size: 12px;
    }

    #editor {
        height: calc(100vh - 160px);
    }
}

/* Utility classes */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-muted { color: #6c757d; }
.text-small { font-size: 0.875rem; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-1 { flex: 1; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }