.example-container {
    position: relative;
    margin: 20px 0;
    /* No breakout - just normal width */
    width: 100%;
}

/* Stacked layout: YAML on top, render below (no overlay) */
.example-container.example-stacked .example-render {
    position: relative;
    top: auto;
    right: auto;
    max-width: 100%;
    margin-top: 16px;
}

/* YAML-only layout */
.example-container.example-yaml-only {
    flex-direction: column;
}

.example-container.example-yaml-only .example-code {
    flex: none;
}

/* Render-only layout */
.example-container.example-render-only {
    flex-direction: column;
}

.example-container.example-render-only .example-render {
    border-left: none;
    flex: none;
}

.example-code {
    width: 100%;
    padding: 0;
    margin: 0;
    background-color: #f8f8f8;
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow-x: auto; /* Allow horizontal scroll if needed */
}

/* Nuclear option - hide ALL scrollbars in example code blocks */
.example-code *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.example-code * {
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE/Edge */
}

/* Ensure all children fill the container and have gray background */
.example-code,
.example-code > *,
.example-code *,
.example-code pre,
.example-code code,
.example-code .yaml,
.example-code .yaml *,
.example-code .highlight,
.example-code .highlight * {
    background-color: #f8f8f8 !important;
    box-sizing: border-box;
}

/* Actions container for playground link in YAML-only or stacked layouts */
.example-actions {
    padding: 12px;
    background-color: #f8f8f8;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
}

.playground-link-inline {
    position: static;
    display: inline-flex;
    width: auto;
    height: auto;
    padding: 6px 12px;
    border-radius: 4px;
    background-color: white;
    color: #333;
    border: 1px solid #ddd;
    font-size: 0.875rem;
    gap: 6px;
}

.playground-link-inline:hover {
    background-color: #f5f5f5;
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.playground-link-inline .playground-icon {
    font-size: 0.875rem;
}

/* Override mkdocs code block margins inside our container */
.example-code pre {
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    height: auto;
    width: 100%;
    overflow: hidden !important; /* Kill all scrollbars */
    box-sizing: border-box;
    background-color: #f8f8f8 !important;
}

.example-code .yaml {
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
}

.example-code .yaml pre {
    margin: 0 !important;
    padding: 1rem !important;
    border-radius: 0 !important;
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    background-color: #f8f8f8 !important;
    min-height: auto;
    overflow: hidden !important; /* Kill scrollbars */
}

.example-code .yaml pre code {
    display: block;
    width: 100%;
    background-color: #f8f8f8 !important;
    padding: 0 !important;
    margin: 0 !important;
    white-space: pre;
}

/* Kill any whitespace or padding from code elements */
.example-code code {
    background-color: #f8f8f8 !important;
    padding: 0 !important;
}

.example-code .highlight {
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Override Material theme's copy button positioning inside example containers */
.example-code .md-clipboard {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
}

/* Remove any padding Material adds for copy button */
.example-code pre:has(.md-clipboard) {
    padding-right: 0.5rem !important;
}

/* Ensure code blocks in examples don't have scroll */
.example-code pre,
.example-code code,
.example-code .yaml,
.example-code .yaml pre,
.example-code .yaml code {
    overflow: hidden !important;
    overflow-y: hidden !important;
    overflow-x: hidden !important;
}

/* ============================================
   Light Theme Syntax Highlighting for Examples
   Override dark Pygments colors for light background
   ============================================ */
.example-code,
.example-code .yaml,
.example-code pre,
.example-code code {
    color: #333 !important; /* Default text color */
}

/* YAML Keys - Red/Pink (Name.Tag) */
.example-code .nt {
    color: #DC2626 !important; /* Dataface red */
}

/* Strings - Green */
.example-code .s,
.example-code .s1,
.example-code .s2,
.example-code .sb,
.example-code .sc,
.example-code .sh,
.example-code .sx {
    color: #059669 !important;
}

/* Numbers - Orange */
.example-code .m,
.example-code .mi,
.example-code .mf,
.example-code .mh,
.example-code .mo,
.example-code .mb,
.example-code .il {
    color: #D97706 !important;
}

/* Keywords/Constants (true, false, null) - Purple */
.example-code .k,
.example-code .kc {
    color: #7C3AED !important;
}

/* Comments - Gray italic */
.example-code .c,
.example-code .c1,
.example-code .cm,
.example-code .cs,
.example-code .ch,
.example-code .cp,
.example-code .cpf {
    color: #6B7280 !important;
    font-style: italic;
}

/* Punctuation (colons, brackets, pipes) - Gray */
.example-code .p {
    color: #6B7280 !important;
}

/* Jinja expressions - Cyan/Teal */
.example-code .si {
    color: #0891B2 !important;
}

/* Variables/Anchors - Blue */
.example-code .nv {
    color: #2563EB !important;
}

.example-render {
    position: absolute;
    top: 8px;
    right: 8px;
    max-width: 50%; /* Don't cover more than half the code */
    z-index: 10;
    cursor: pointer;
}

.example-render:hover .rendered-dashboard {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
    transform: scale(1.02);
}

.render-placeholder {
    width: 100%;
    height: 100%;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f4f8;
    border: 2px dashed #cbd5e0;
    border-radius: 4px;
    color: #718096;
    font-family: monospace;
}

.rendered-dashboard {
    width: 100%;
    padding: 0;
    background-color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.rendered-dashboard svg {
    display: block;
    width: 100%;
    height: auto;
}

.dashboard-title {
    margin: 0 0 16px 0;
    padding: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 8px;
}

.rendered-chart {
    margin-bottom: 20px;
}

.rendered-chart:last-child {
    margin-bottom: 0;
}

.rendered-chart svg {
    max-width: 100%;
    height: auto;
    display: block;
}

.chart-error {
    padding: 10px;
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    color: #991b1b;
    font-size: 0.875rem;
}

.render-placeholder small {
    display: block;
    margin-top: 8px;
    font-size: 0.75rem;
    opacity: 0.7;
}

.playground-link {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    text-decoration: none;
    border-radius: 50%;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    z-index: 10;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.playground-link:hover {
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    text-decoration: none;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.playground-link:visited {
    color: white;
}

.playground-icon {
    font-size: 0.75rem;
    line-height: 1;
}

/* Modal styles */
.example-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.example-modal-content {
    position: relative;
    background-color: white;
    border-radius: 8px;
    max-width: 95%;
    max-height: 95%;
    width: 100%;
    height: 100%;
    overflow: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.example-modal-close {
    color: #666;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    line-height: 1;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.example-modal-close:hover {
    color: #000;
    background-color: rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

/* Modal header for buttons */
.example-modal-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background-color: #fafafa;
}

.example-modal-dashboard {
    flex: 1;
    padding: 40px;
    overflow: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.example-modal-dashboard .rendered-dashboard {
    width: 100%;
    max-width: 1200px;
}

/* Larger playground button in modal */
.playground-link-modal {
    position: static;
    width: auto;
    height: auto;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
    gap: 8px;
    background-color: var(--md-primary-fg-color, #DC2626);
    color: white;
    border: 1px solid var(--md-primary-fg-color, #DC2626);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.playground-link-modal:hover {
    background-color: var(--md-primary-fg-color--dark, #B91C1C);
    color: white;
    border-color: var(--md-primary-fg-color--dark, #B91C1C);
    transform: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.playground-link-modal .playground-text {
    display: inline;
    color: white;
}

.playground-link-modal .playground-icon {
    font-size: 0.875rem;
    color: white;
}

/* Responsive - on smaller screens, stack instead of overlay */
@media (max-width: 768px) {
    .example-render {
        position: relative;
        top: auto;
        right: auto;
        max-width: 100%;
        margin-top: 16px;
    }

    .example-modal-content {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .example-modal-dashboard {
        padding: 20px;
    }
}
