/* Swirl Maker - workspace left, controls right (Blob / Wave Maker layout) */

/* Landing page: dress the start card with a groovy swirl band along its
   bottom edge (the intro card only - not the related-tools cards, which
   live in .tool-content wrappers) */
.app-intro:not(.tool-content) > .gn-card {
    position: relative;
    overflow: hidden;
}

.app-intro:not(.tool-content) > .gn-card .card-body {
    position: relative;
    z-index: 1;
    padding-bottom: 7rem !important;
}

.app-intro:not(.tool-content) > .gn-card::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100px;
    pointer-events: none;
    background-size: 100% 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 200' preserveAspectRatio='none'%3E%3Crect width='1440' height='200' fill='%23fdf0d5'/%3E%3Cg fill='none' stroke='%23f26a4f' stroke-width='34' stroke-linecap='round'%3E%3Cpath d='M-40 60 C 180 -10 300 130 500 120 C 700 110 780 20 980 40 C 1150 57 1300 130 1480 90'/%3E%3Cpath d='M-40 150 C 200 90 320 210 520 200 C 720 190 800 110 1000 128 C 1170 145 1310 210 1480 175'/%3E%3C/g%3E%3Cg fill='none' stroke='%23f7a072' stroke-width='16' stroke-linecap='round'%3E%3Cpath d='M-40 108 C 190 45 310 175 510 163 C 710 151 790 66 990 85 C 1160 102 1305 172 1480 133'/%3E%3C/g%3E%3C/svg%3E");
}

.sw-app {
    position: relative;
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* Stage (left): the composed pattern fills the whole workspace */
.sw-stage {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    background-color: var(--gn-card-bg);
}

.sw-frame {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.sw-frame-boxed {
    border: 1px solid var(--gn-card-border);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

/* Pixel-size chip shown in exact-size preview */
.sw-frame-size {
    position: absolute;
    left: 50%;
    bottom: 0.5rem;
    transform: translateX(-50%);
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    background-color: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.7rem;
    white-space: nowrap;
    pointer-events: none;
}

.sw-svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Transparent mode: classic checkerboard behind the pattern */
.sw-frame.sw-transparent {
    background-color: #fff;
    background-image: repeating-conic-gradient(#dfdfdf 0% 25%, #ffffff 0% 50%);
    background-size: 20px 20px;
}

/* Controls panel (right); header/body/footer layout comes from the shared
   .app-side-* classes in css/common.css */
.sw-panel {
    flex: 0 0 300px;
    border-left: 1px solid var(--gn-card-border);
}

.sw-label {
    font-size: 0.8rem;
    color: var(--gn-muted);
    margin-bottom: 0;
    margin-top: 0.5rem;
    display: block;
}

/* Tuck the slider closer to its label + value row */
.sw-app .form-range {
    margin-top: -2px;
}

/* Previous/next style buttons share the select's border color */
.sw-style-nav {
    border: 1px solid var(--bs-border-color);
    color: var(--gn-muted);
    background: none;
}

.sw-style-nav:hover {
    border-color: var(--bs-border-color);
    background-color: var(--gn-sidebar-hover-bg);
    color: var(--gn-accent);
}

.sw-val {
    float: right;
    color: var(--gn-accent);
    font-size: 0.75rem;
}

.sw-sep {
    margin: 0.75rem 0;
    border-color: var(--gn-card-border);
    opacity: 1;
}

/* Floating round buttons on the stage */
.sw-fab-wrap {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.sw-fab {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background-color: #fff;
    color: #2b2d42;
    font-size: 1.125rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.1s, border-color 0.15s, color 0.15s;
}

.sw-fab:hover {
    border-color: var(--gn-accent);
    color: var(--gn-accent);
}

.sw-fab:active {
    transform: scale(0.95);
}

/* The aspect fab sits top-right; its menu opens below the button and is
   capped to the stage height so the list scrolls instead of overflowing */
.sw-aspect-wrap {
    bottom: auto;
    top: 1rem;
    max-height: calc(100% - 2rem);
}

.sw-fab-menu {
    display: flex;
    flex-direction: column;
    min-width: 170px;
    min-height: 0;
    padding: 0.25rem;
    background-color: var(--gn-card-bg);
    border: 1px solid var(--gn-card-border);
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.sw-menu-scroll {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

.sw-fab-menu.d-none {
    display: none;
}

.sw-fab-menu button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    background: none;
    border: 0;
    border-radius: 0.375rem;
    color: var(--gn-body-color);
    font-size: 0.875rem;
    text-align: left;
    white-space: nowrap;
}

.sw-fab-menu button:hover {
    background-color: var(--gn-sidebar-hover-bg);
}

/* Check mark only on the selected entry */
.sw-fab-menu button .bi {
    color: var(--gn-accent);
    visibility: hidden;
}

.sw-fab-menu button.active .bi {
    visibility: visible;
}

.sw-fab-menu button:disabled {
    color: var(--gn-muted);
    opacity: 0.55;
}

.sw-menu-sep {
    margin: 0.25rem 0.5rem;
    border-color: var(--gn-card-border);
    opacity: 1;
}

/* Save modal: centered card over a dimmed backdrop, inside the app area
   so it works in fullscreen too */
.sw-modal {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.45);
}

.sw-modal.d-none {
    display: none;
}

.sw-modal-card {
    display: flex;
    flex-direction: column;
    width: min(440px, 100%);
    max-height: 100%;
    background-color: var(--gn-card-bg);
    border: 1px solid var(--gn-card-border);
    border-radius: 0.75rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.sw-modal-header {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--gn-card-border);
}

.sw-modal-title {
    font-weight: 600;
}

/* On short screens the body scrolls; header and footer stay in view */
.sw-modal-body {
    padding: 0.5rem 1rem 0.75rem;
    min-height: 0;
    overflow-y: auto;
}

.sw-modal-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--gn-card-border);
}

/* Rows that do not apply to the current format keep their space (the modal
   never jumps in size); visibility also removes them from the tab order */
.sw-invisible {
    visibility: hidden;
}

/* All note variants are stacked in the same grid cell: the container is
   always as tall as the longest one, so the modal never jumps in size */
.sw-modal-note-stack {
    display: grid;
}

.sw-modal-note-stack > .sw-modal-note {
    grid-area: 1 / 1;
}

.sw-note-sizer {
    visibility: hidden;
}

.sw-modal-note {
    font-size: 0.75rem;
    color: var(--gn-muted);
    margin: 0.625rem 0 0;
}

.sw-size-input {
    max-width: 110px;
}

.sw-size-x {
    color: var(--gn-muted);
}

/* Small screens: stack, with the preview pinned at the top so the pattern
   stays visible while dragging sliders in the controls below */
@media (max-width: 767px) {
    .sw-app {
        flex-direction: column;
        overflow-y: auto;
    }

    .sw-stage {
        position: sticky;
        top: 0;
        z-index: 4;
        flex: 0 0 auto;
        height: 40vh;
    }

    .sw-panel {
        flex: 0 0 auto;
        border-left: 0;
        border-top: 1px solid var(--gn-card-border);
    }

    /* The whole app container scrolls instead of the panel body; the
       style header sticks right below the preview and the action footer
       sticks to the bottom edge */
    .sw-panel .app-side-body {
        overflow-y: visible;
    }

    .sw-panel .app-side-header {
        position: sticky;
        top: 40vh;
        z-index: 3;
        background-color: var(--gn-card-bg);
    }

    .sw-panel .app-side-footer {
        position: sticky;
        bottom: 0;
        z-index: 3;
        background-color: var(--gn-card-bg);
    }
}
