/* Fullscreen layout + dynamic artboard vars only.
   Visual design uses Tailwind classes in the Twig template. */

html.editor-active,
body.editor-active {
    overflow: hidden !important;
    height: 100vh !important;
    height: 100dvh !important;
}

html.editor-active {
    overscroll-behavior: none;
}

body.editor-active header,
body.editor-active .md\:hidden.sticky,
body.editor-active footer {
    display: none !important;
}

body.editor-active .flex.flex-col.lg\:flex-row {
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
}

body.editor-active .tool-page-container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
}

body.editor-active .tool-page-container > .animate-in {
    height: 100% !important;
}

body.editor-active .lg\:w-72 {
    display: none !important;
}

body.editor-active .animate-in {
    animation: none !important;
}

body.editor-active .bg-\[\#f8fafd\] {
    background: #f8fafc !important;
}

body.editor-active .flex-1.min-w-0 {
    overflow: hidden !important;
    height: 100% !important;
}

/* Stage keeps its own overflow so the scaled artboard isn't clipped unevenly */
body.editor-active #se-stage.flex-1.min-w-0 {
    overflow: hidden !important;
}

/* Live mock preview — values set from JS */
#se-artboard {
    background: var(--se-bg);
    border-radius: var(--se-wrapper-radius);
    transform-origin: top left;
}

#se-inset-frame {
    line-height: 0;
}

#se-shot-stack {
    line-height: 0;
}

#se-preview-img {
    border-radius: var(--se-shot-radius);
    max-width: none;
    max-height: none;
    display: block;
}

#se-annotate-host {
    pointer-events: auto;
    overflow: hidden;
    border-radius: inherit;
}

#se-annotate-host .canvas-container {
    position: absolute !important;
    left: 0;
    top: 0;
}

/* File name in main toolbar (matches PDF #toolbar-file-name) */
#se-file-name {
    font-size: 14px;
    color: #1e293b;
    font-weight: 600;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#ctrl-bg-swatches,
#ctrl-solid-swatches {
    gap: 0.45rem;
}

#ctrl-bg-swatches {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

/* Slightly smaller tiles so 14 presets + [+] fit in two rows */
#ctrl-solid-swatches {
    grid-template-columns: repeat(8, minmax(0, 1fr));
}

#ctrl-bg-swatches .se-swatch,
#ctrl-bg-swatches .se-swatch-add,
#ctrl-solid-swatches .se-swatch,
#ctrl-solid-swatches .se-swatch-add {
    position: relative;
    border-radius: 18px;
    border: none;
    overflow: visible;
    box-shadow: none;
    outline: none;
}

/* 2px black frame on top of the color; interior stays clear */
#ctrl-bg-swatches .se-swatch::after,
#ctrl-solid-swatches .se-swatch::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid rgba(0, 0, 0, 0.1);
    background: transparent;
    pointer-events: none;
    box-sizing: border-box;
}

/* Selected: ring outside the color with a 0.5px gap */
#ctrl-bg-swatches .se-swatch-active,
#ctrl-solid-swatches .se-swatch-active {
    outline: 2px solid #2f76ff;
    outline-offset: 2.5px;
}

#ctrl-bg-swatches .se-swatch-add,
#ctrl-solid-swatches .se-swatch-add {
    border: 2px dashed #cbd5e1;
}

/* Custom swatch delete control — top-right on hover */
.se-swatch-custom .se-swatch-remove {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 999px;
    background: #e2e8f0;
    color: #1e293b;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.se-swatch-custom:hover .se-swatch-remove,
.se-swatch-custom:focus-within .se-swatch-remove {
    display: flex;
}

.se-swatch-custom .se-swatch-remove:hover {
    background: #cbd5e1;
    color: #0f172a;
}

/* Native color input → solid swatch (matches #ctrl-solid-swatches) */
.se-color-swatch {
    -webkit-appearance: none;
    appearance: none;
    overflow: hidden;
}

.se-color-swatch::-webkit-color-swatch-wrapper {
    padding: 0;
}

.se-color-swatch::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

.se-color-swatch::-moz-color-swatch {
    border: none;
    border-radius: 8px;
}

/* Range slider look lives in editor-toolbar.css (.se-range) */
.se-range-heading {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin-bottom: 0;
}

.se-range-live {
    display: none;
    color: #2f76ff;
    font-variant-numeric: tabular-nums;
    letter-spacing: normal;
    text-transform: none;
}

.se-range-live.is-visible {
    display: inline;
}

.se-inset-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.se-inset-head .se-range-heading {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.se-inset-color {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
    line-height: 0;
}

.se-inset-color .se-color-swatch {
    width: 14px;
    height: 14px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.se-inset-color .se-color-swatch::-webkit-color-swatch {
    border-radius: 50%;
}

.se-inset-color .se-color-swatch::-moz-color-swatch {
    border-radius: 50%;
}

/* Compact 9-dot position pad — box stays fixed; dots grow on hover */
.se-pos-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 11px;
    width: 78px;
    height: 78px;
    padding: 12px;
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    align-items: center;
    justify-items: center;
}

.se-pos-pad .se-pos {
    width: 10px;
    height: 10px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: #cbd5e1;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: background-color 0.12s ease, transform 0.12s ease;
}

.se-pos-pad .se-pos:hover {
    background: #94a3b8;
    transform: scale(1.35);
}

.se-pos-pad .se-pos.se-pos-active {
    background: #2f76ff;
}

.se-pos-pad .se-pos.se-pos-active:hover {
    transform: scale(1.35);
}

/* .tb-btn { display: inline-flex } overrides Tailwind lg:hidden — hide menu on desktop */
@media (min-width: 1024px) {
    #screenshot-editor-app #btn-toggle-controls {
        display: none !important;
    }
}

/* Aspect ratio dropdown */
.se-aspect-dd {
    position: relative;
    width: 100%;
}

.se-aspect-dd-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.se-aspect-dd-trigger:hover {
    border-color: #cbd5e1;
}

.se-aspect-dd.open .se-aspect-dd-trigger {
    border-color: #2f76ff;
    box-shadow: 0 0 0 3px rgba(47, 118, 255, 0.15);
}

.se-aspect-dd-caret {
    flex-shrink: 0;
    color: #94a3b8;
    transition: transform 0.15s;
}

.se-aspect-dd.open .se-aspect-dd-caret {
    transform: rotate(180deg);
}

.se-aspect-dd-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: min(360px, 50vh);
    overflow-y: auto;
    padding: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.se-aspect-dd-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #0f172a;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}

.se-aspect-dd-item:hover {
    background: #f8fafc;
}

.se-aspect-dd-item.active {
    background: #eff6ff;
    border-color: #2f76ff;
    color: #1e3a8a;
    font-weight: 600;
}

.se-aspect-dd-sep {
    height: 1px;
    margin: 6px 4px;
    background: #e2e8f0;
}

/* SEO sections shown when editor is NOT active */
#editor-seo-content {
    display: block;
}

body.editor-active #editor-seo-content {
    display: none;
}

/* Match main tool nav width (tool-sidebar is w-72 ≈ 288px; use 287px as requested) */
#se-sidebar {
    width: 287px;
}

/* Reset mode: lock frame controls; ratio / backgrounds / export stay usable */
#se-sidebar.se-reset-mode [data-se-beautify] {
    opacity: 0.45;
    pointer-events: none;
    user-select: none;
}

#se-sidebar.se-reset-mode [data-se-beautify] input,
#se-sidebar.se-reset-mode [data-se-beautify] button {
    cursor: not-allowed;
}

/* Match main tool-sidebar scrollbar (includes/tool-sidebar.twig) */
#se-sidebar .custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

#se-sidebar .custom-scrollbar::-webkit-scrollbar-track {
    background: #f9fafb;
}

#se-sidebar .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 10px;
}

#se-sidebar .custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #d1d5db;
}
