/* Embed-Widgets Doku-Seite
 * Sektionen: Einleitung, Schnellstart, Widget-Tabelle, Live-Editor, Params, postMessage, FAQ
 */

/* Sektions-Überschriften: konsistent zur Content-Seite (seo-section h2) */
body.page-embed-widgets .card-header {
    text-align: center;
    margin-bottom: 46px;
}

body.page-embed-widgets .card-header h1 {
    font-size: 2.5em;
    color: var(--c-text);
    margin-bottom: 10px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 700;
    letter-spacing: -0.5px;
}

body.page-embed-widgets .card-header p {
    color: var(--c-muted);
    font-size: 1.1em;
}

body.page-embed-widgets .section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--c-accent);
    font-size: 1.7em;
    margin: 48px 0 20px 0;
    font-weight: 700;
    letter-spacing: -0.3px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.page-embed-widgets .section-title:first-of-type {
    margin-top: 30px;
}

/* FAQ-Überschrift: gleiche Größe wie die anderen Sektionstitel */
body.page-embed-widgets .faq-section h2 {
    font-size: 1.75em;
    letter-spacing: -0.3px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.page-embed-widgets .section-title i {
    color: var(--c-accent);
    font-size: 1.1em;
}

body.page-embed-widgets .main-card > p {
    margin: 0 0 14px 0;
    line-height: 1.7;
}

/* ==== Code-Samples ==== */
.embed-code-sample {
    margin: 14px 0 28px 0;
}

.embed-code-sample pre {
    background: #1e2330;
    color: #d6dce8;
    border: 1px solid #2c3345;
    border-radius: 10px;
    padding: 14px 16px;
    overflow-x: auto;
    font-size: 0.88em;
    line-height: 1.55;
    margin: 0;
}

body.dark-theme.page-embed-widgets .embed-code-sample pre {
    background: #141826;
    border-color: #2a3040;
}

/* ==== Tabellen ==== */
.embed-table-wrap {
    margin: 14px 0 28px 0;
    overflow-x: auto;
}

.embed-widget-table,
.embed-param-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.embed-widget-table th,
.embed-widget-table td,
.embed-param-table th,
.embed-param-table td {
    padding: 10px 12px;
    border: 1px solid rgba(102, 126, 234, 0.18);
    text-align: left;
}

.embed-widget-table th,
.embed-param-table th {
    background: rgba(102, 126, 234, 0.1);
    font-weight: 600;
}

.embed-widget-table td code,
.embed-param-table td code {
    background: rgba(102, 126, 234, 0.08);
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 0.9em;
}

body.dark-theme.page-embed-widgets .embed-widget-table td,
body.dark-theme.page-embed-widgets .embed-param-table td {
    color: #d6dce8;
}

/* ==== Live-Editor: 2 Spalten ==== */
.embed-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    margin: 16px 0 20px 0;
}

@media (max-width: 860px) {
    .embed-editor {
        grid-template-columns: 1fr;
    }
}

.embed-editor-preview {
    border: 1px dashed rgba(102, 126, 234, 0.4);
    border-radius: 12px;
    background: #111827;
    min-height: 300px;
    display: flex;
}

.embed-editor-preview iframe {
    width: 100%;
    border: 0;
    border-radius: 12px;
}

body.dark-theme.page-embed-widgets .embed-editor-preview {
    background: #0f1420;
}

.embed-editor-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    background: rgba(102, 126, 234, 0.06);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
}

body.dark-theme.page-embed-widgets .embed-editor-panel {
    background: rgba(102, 126, 234, 0.08);
    border-color: rgba(102, 126, 234, 0.25);
}

.editor-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-label {
    font-size: 0.85em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #667eea;
}

body.dark-theme.page-embed-widgets .editor-label {
    color: #8b9cf7;
}

/* Widget-Auswahl-Dropdowns (Kategorie + Widget) */
.editor-widget-selects {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Native Selects werden durch Custom-Dropdowns ersetzt (visuell versteckt,
   bleiben aber im DOM fuer Wert/Events/i18n erhalten). */
.editor-widget-selects select,
.editor-opt-row select {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    height: 1px;
    width: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.editor-widget-selects select:focus + .editor-custom-select,
.editor-opt-row select:focus + .editor-custom-select {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* ===== Custom-Dropdown ===== */
.editor-custom-select {
    position: relative;
    width: 100%;
}

.editor-opt-row .editor-custom-select {
    max-width: 170px;
    min-width: 160px;
}

.editor-custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid rgba(102, 126, 234, 0.35);
    background-color: var(--c-surface);
    color: var(--c-text);
    border-radius: 10px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: left;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.08);
}

.editor-opt-row .editor-custom-select-trigger {
    padding: 6px 10px;
    font-size: 0.9em;
}

.editor-custom-select-trigger:hover {
    border-color: #667eea;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.18);
}

.editor-custom-select-trigger .editor-custom-select-caret {
    color: #667eea;
    font-size: 0.8em;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.editor-custom-select.open .editor-custom-select-trigger .editor-custom-select-caret {
    transform: rotate(180deg);
}

.editor-custom-select-trigger .editor-custom-select-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-custom-select-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 60;
    max-height: 260px;
    overflow-y: auto;
    background: var(--c-surface);
    border: 1px solid rgba(102, 126, 234, 0.35);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15, 20, 50, 0.18);
    padding: 6px;
    display: none;
}

.editor-custom-select.open .editor-custom-select-list {
    display: block;
    animation: edDropdownIn 0.16s ease-out;
}

@keyframes edDropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.editor-custom-select-option {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: transparent;
    color: var(--c-text);
    font-size: 0.9em;
    font-weight: 500;
    font-family: inherit;
    text-align: left;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.editor-opt-row .editor-custom-select-option {
    font-size: 0.9em;
}

.editor-custom-select-option:hover {
    background: rgba(102, 126, 234, 0.12);
    color: #667eea;
}

.editor-custom-select-option.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 600;
}

.editor-custom-select-list::-webkit-scrollbar {
    width: 8px;
}

.editor-custom-select-list::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.35);
    border-radius: 8px;
}

body.dark-theme .editor-custom-select-list {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

body.dark-theme .editor-custom-select-option.selected {
    color: #fff;
}

@media (max-width: 600px) {
    .editor-custom-select-list {
        max-height: 220px;
    }
}

/* Farb-Grid */
.editor-color-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 480px) {
    .editor-color-grid {
        grid-template-columns: 1fr;
    }
}

.editor-color-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8em;
}

.editor-color-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.editor-color-row input[type="color"] {
    width: 34px;
    height: 30px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 6px;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.editor-hex {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 0.85em;
    font-family: monospace;
    text-transform: uppercase;
}

.editor-hex:focus {
    outline: none;
    border-color: #667eea;
}

/* Optionen */
.editor-opts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    cursor: pointer;
}

.editor-toggle input {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
    cursor: pointer;
}

.editor-opt-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.9em;
}

.editor-opt-row input[type="number"] {
    padding: 6px 10px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    background-color: var(--c-surface);
    color: var(--c-text);
    font-size: 0.9em;
    max-width: 170px;
    min-width: 160px;
    transition: all 0.2s;
    font-family: inherit;
}

.editor-opt-row input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* ==== Aufklappbare Sektionen (Parameter-Referenz) ==== */
.embed-details {
    margin: 22px 0 30px 0;
    border: 1px solid rgba(102, 126, 234, 0.22);
    border-radius: 12px;
    background: rgba(102, 126, 234, 0.04);
    padding: 14px 18px;
}

.embed-details summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25em;
    font-weight: 700;
    color: var(--c-accent);
    letter-spacing: -0.3px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    user-select: none;
}

.embed-details summary::-webkit-details-marker {
    display: none;
}

.embed-details summary i {
    color: var(--c-accent);
    font-size: 1em;
}

.embed-details summary::after {
    content: '▾';
    margin-left: auto;
    font-size: 0.8em;
    transition: transform 0.2s;
}

.embed-details[open] summary::after {
    transform: rotate(180deg);
}

.embed-details > p {
    margin: 12px 0 0 0;
}

.embed-details .embed-table-wrap {
    margin: 12px 0 0 0;
}

.editor-opt-row input[type="number"] {
    padding-right: 28px;
}

.editor-refresh {
    width: 100%;
    padding: 9px;
    border: 1px solid rgba(102, 126, 234, 0.4);
    background: transparent;
    color: inherit;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.editor-refresh:hover {
    background: rgba(102, 126, 234, 0.12);
    border-color: #667eea;
}

/* Code-Ausgabe */
.embed-code-box {
    margin: 0 0 28px 0;
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 12px;
    overflow: hidden;
}

.embed-code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(102, 126, 234, 0.1);
    font-weight: 600;
    font-size: 0.9em;
}

.embed-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85em;
    transition: opacity 0.2s;
}

.embed-copy-btn:hover {
    opacity: 0.9;
}

.embed-copy-btn.copied {
    background: #22c55e;
}

.embed-code-output {
    width: 100%;
    min-height: 90px;
    padding: 12px 14px;
    border: 0;
    background: #1e2330;
    color: #d6dce8;
    font-family: monospace;
    font-size: 0.85em;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
}

body.dark-theme.page-embed-widgets .embed-code-output {
    background: #141826;
}

.embed-code-output:focus {
    outline: none;
}

/* ==== Inspector (Click-to-Edit) ==== */
.editor-inspector-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid rgba(102, 126, 234, 0.4);
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 600;
}

.editor-inspector-bar span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(102, 126, 234, 0.4);
    background: transparent;
    color: inherit;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8em;
}

.editor-icon-btn:hover {
    background: rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.editor-reset-btn {
    padding: 5px 10px;
    border: 1px solid rgba(102, 126, 234, 0.4);
    background: transparent;
    color: inherit;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.editor-reset-btn:hover {
    background: rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.editor-hint {
    font-size: 0.82em;
    line-height: 1.5;
    color: var(--c-muted, #6b7280);
    margin: 0;
    padding: 6px 2px;
}

.editor-details {
    margin-top: 4px;
}

.editor-details summary {
    cursor: pointer;
    font-size: 0.82em;
    font-weight: 700;
    color: #667eea;
    padding: 6px 0;
    user-select: none;
}

body.dark-theme.page-embed-widgets .editor-details summary {
    color: #8b9cf7;
}

.editor-details .editor-color-grid {
    margin-top: 6px;
}

.editor-group-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-group-block[hidden],
.editor-inspector-bar[hidden] {
    display: none;
}

.editor-hex.uses-base {
    opacity: 0.6;
    font-style: italic;
}

.editor-opt-row.editor-highlight {
    border: 1px solid rgba(102, 126, 234, 0.5);
    border-radius: 8px;
    padding: 6px 8px;
}

/* ==== Scrollbars im Editor einheitlich stylen ==== */

/* Helle Flächen: Panel + Tabellen-Wrap */
.embed-editor-panel,
.embed-table-wrap {
    scrollbar-width: thin;
    scrollbar-color: #8b9cf7 var(--c-surface);
}

.embed-editor-panel::-webkit-scrollbar,
.embed-table-wrap::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.embed-editor-panel::-webkit-scrollbar-track,
.embed-table-wrap::-webkit-scrollbar-track {
    background: var(--c-surface);
    border-radius: 4px;
}

.embed-editor-panel::-webkit-scrollbar-thumb,
.embed-table-wrap::-webkit-scrollbar-thumb {
    background: #8b9cf7;
    border-radius: 4px;
}

.embed-editor-panel::-webkit-scrollbar-thumb:hover,
.embed-table-wrap::-webkit-scrollbar-thumb:hover {
    background: #667eea;
}

/* Dunkle Flächen: Code-Ausgabe + Code-Sample (passend zum Block-Hintergrund) */
.embed-code-output,
.embed-code-sample pre {
    scrollbar-width: thin;
    scrollbar-color: #5a6f9e #1e2330;
}

.embed-code-output::-webkit-scrollbar,
.embed-code-sample pre::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.embed-code-output::-webkit-scrollbar-track,
.embed-code-sample pre::-webkit-scrollbar-track {
    background: #1e2330;
    border-radius: 4px;
}

.embed-code-output::-webkit-scrollbar-thumb,
.embed-code-sample pre::-webkit-scrollbar-thumb {
    background: #5a6f9e;
    border-radius: 4px;
}

.embed-code-output::-webkit-scrollbar-thumb:hover,
.embed-code-sample pre::-webkit-scrollbar-thumb:hover {
    background: #8b9cf7;
}

body.dark-theme.page-embed-widgets .embed-code-output,
body.dark-theme.page-embed-widgets .embed-code-sample pre {
    scrollbar-color: #5a6f9e #141826;
}

body.dark-theme.page-embed-widgets .embed-code-output::-webkit-scrollbar-track,
body.dark-theme.page-embed-widgets .embed-code-sample pre::-webkit-scrollbar-track {
    background: #141826;
}
