/* Shared landing toolbar (Open, Save, Edit, Undo, Redo, Crop, Properties, Background,
   Add bubble, Randomize, Info, Favorites) rendered by Views/SeoLanding/_LandingToolbar.cshtml,
   Landing/LandingToolbar.cs and js/seo/landing-toolbar-io.js.
   Single source of truth for every landing app, tool, effect, filter demo and generator:
   do not add per-app toolbar layout or skin rules elsewhere.
   Loaded once for all landing pages from Views/Shared/_LandingLayout.cshtml. */

/* ---- Toolbar bar ---- */

.landing-toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
    align-self: stretch;
    min-height: 44px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

/* Seven icons (e.g. Aboriginal art) must stay on one row on narrow phones. */

.landing-toolbar .filter-landing-preset--icon,
.landing-toolbar .landing-favorites {
    flex: 0 1 44px;
    min-width: 32px;
}

.landing-toolbar .landing-favorites {
    max-width: 44px;
}

/* Toolbar stays a short full-width block at the top of the controls column.
   Do not use flex-basis: 100% here - in a column flex that becomes full HEIGHT
   and pushes the real controls below the viewport. */

.filter-landing-controls > .landing-toolbar,
.filter-landing-controls > .filter-landing-presets.landing-toolbar {
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
    align-self: stretch;
}

/* ---- Icon buttons ---- */

.filter-landing-preset--icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-color: transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--main-100, #1f2937);
    touch-action: manipulation;
}

.filter-landing-preset--icon:hover,
.filter-landing-preset--icon:focus-visible {
    border-color: transparent;
    background: rgba(15, 23, 42, 0.08);
    color: var(--main-100, #1f2937);
}

.filter-landing-preset--icon.is-active {
    border-color: transparent;
    background: rgba(15, 23, 42, 0.12);
    color: var(--main-100, #1f2937);
    box-shadow: none;
}

.filter-landing-preset--icon svg {
    display: block;
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Primary actions (Open, Save, Edit) */

.filter-landing-preset--primary,
.filter-landing-preset--icon.filter-landing-preset--primary {
    background: transparent;
    color: var(--main-100, #1f2937);
}

.filter-landing-preset--primary:disabled,
.filter-landing-preset--icon.filter-landing-preset--primary:disabled {
    opacity: 0.38;
    cursor: default;
    pointer-events: none;
    box-shadow: none;
}

/* Secondary actions (Undo, Redo, Crop, Properties, Background, Add bubble, Randomize, Info) */

.filter-landing-preset--randomize,
.filter-landing-preset--crop,
.filter-landing-preset--props,
.filter-landing-preset--background,
.filter-landing-preset--add-bubble {
    border-color: transparent;
    background: transparent;
    color: var(--main-100, #1f2937);
}

.filter-landing-preset--props,
.filter-landing-preset--background,
.filter-landing-preset--add-bubble {
    border-radius: 50%;
}

/* ---- Favorites dropdown and Save menu (built by landing-toolbar-io.js) ---- */

.landing-favorites {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.landing-favorites-select {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.filter-landing-preset--primary:hover,
.filter-landing-preset--primary:focus-visible,
.filter-landing-preset--icon.filter-landing-preset--primary:hover,
.filter-landing-preset--icon.filter-landing-preset--primary:focus-visible,
.landing-favorites:hover .landing-favorites-icon,
.landing-favorites:focus-within .landing-favorites-icon,
.landing-favorites.is-open .landing-favorites-icon {
    background: rgba(15, 23, 42, 0.08);
    color: var(--main-100, #1f2937);
}

.dark .landing-favorites:hover .landing-favorites-icon,
.dark .landing-favorites:focus-within .landing-favorites-icon,
.dark .landing-favorites.is-open .landing-favorites-icon {
    background: rgba(255, 255, 255, 0.12);
    color: var(--main-200, #e5e7eb);
}

.landing-favorites-menu {
    position: fixed;
    z-index: 80;
    min-width: 12rem;
    max-width: min(22rem, calc(100vw - 16px));
    max-height: min(70vh, 22rem);
    margin: 0;
    padding: 4px;
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    list-style: none;
    border: 1px solid rgba(20, 24, 32, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
}

.landing-favorites-menu [role="option"] {
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--main-100);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.dark .landing-favorites-menu {
    border-color: rgba(255, 255, 255, 0.12);
    background: #1e2430;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.landing-save-menu [role="menuitem"] {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--main-100);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.landing-favorites-menu [role="option"]:hover,
.landing-favorites-menu [role="option"].is-active,
.landing-save-menu [role="menuitem"]:hover {
    background: rgba(22, 163, 74, 0.16);
}

.dark .landing-favorites-menu [role="option"]:hover,
.dark .landing-favorites-menu [role="option"].is-active,
.dark .landing-save-menu [role="menuitem"]:hover {
    background: rgba(34, 197, 94, 0.22);
}

.landing-save-menu .premium-crown,
.landing-save-menu .menu-premium-crown {
    display: inline-flex;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    line-height: 0;
}

.landing-toolbar::-webkit-scrollbar,
.landing-save-menu .premium-crown[hidden],
.landing-save-menu.is-premium-unlocked .premium-crown,
.landing-save-menu [role="menuitem"].is-premium-unlocked .premium-crown {
    display: none;
}

/* ---- Dark theme ---- */

.dark .filter-landing-preset--icon,
.dark .filter-landing-preset--randomize,
.dark .filter-landing-preset--crop,
.dark .filter-landing-preset--props,
.dark .filter-landing-preset--background,
.dark .filter-landing-preset--add-bubble {
    border-color: transparent;
    background: transparent;
    color: var(--main-200, #e5e7eb);
    border-radius: 50%;
}

.dark .filter-landing-preset--icon:hover,
.dark .filter-landing-preset--icon:focus-visible,
.dark .filter-landing-preset--icon.is-active,
.dark .filter-landing-preset--randomize:hover,
.dark .filter-landing-preset--randomize:focus-visible,
.dark .filter-landing-preset--crop:hover,
.dark .filter-landing-preset--crop:focus-visible,
.dark .filter-landing-preset--props:hover,
.dark .filter-landing-preset--props:focus-visible,
.dark .filter-landing-preset--background:hover,
.dark .filter-landing-preset--background:focus-visible,
.dark .filter-landing-preset--add-bubble:hover,
.dark .filter-landing-preset--add-bubble:focus-visible {
    border-color: transparent;
    background: rgba(255, 255, 255, 0.12);
    color: var(--main-200, #e5e7eb);
}

/* Open/Save/Edit - must beat .dark .filter-landing-preset--icon */

.dark .filter-landing-preset--primary,
.dark .filter-landing-preset--primary:hover,
.dark .filter-landing-preset--primary:focus-visible,
.dark .filter-landing-preset--icon.filter-landing-preset--primary,
.dark .filter-landing-preset--icon.filter-landing-preset--primary:hover,
.dark .filter-landing-preset--icon.filter-landing-preset--primary:focus-visible {
    background: transparent;
    color: var(--main-200, #e5e7eb);
}

.dark .filter-landing-preset--primary:hover,
.dark .filter-landing-preset--primary:focus-visible,
.dark .filter-landing-preset--icon.filter-landing-preset--primary:hover,
.dark .filter-landing-preset--icon.filter-landing-preset--primary:focus-visible {
    background: rgba(255, 255, 255, 0.12);
}

/* ---- Phones ---- */

@media (max-width: 600px) {
    .landing-toolbar {
        gap: 0;
        margin: 0;
        flex-wrap: nowrap;
    }

    .landing-toolbar .filter-landing-preset--icon {
        width: 40px;
        height: 40px;
        max-width: 40px;
    }

    .filter-landing-preset--icon svg {
        width: 30px;
        height: 30px;
    }
}

/* ---- Full-screen app mode (body.filter-app-mode) ---- */

@media (max-width: 960px) {
    body.filter-app-mode .filter-landing-preset--icon,
    body.filter-app-mode .filter-landing-preset--add-bubble {
        width: 44px;
        height: 44px;
    }

    body.filter-app-mode .landing-toolbar .filter-landing-preset--icon {
        width: 40px;
        height: 40px;
        max-width: 40px;
        flex: 0 1 40px;
    }
}

@media (max-width: 600px) {
    /* Shared sticky chrome for all filter-app landing toolbars */

    body.filter-app-mode .landing-toolbar {
        position: sticky;
        top: 0;
        z-index: 4;
        flex: 0 0 auto;
        min-height: 44px;
        background: var(--landing-surface, #fff);
        padding-block: 4px;
        margin: 0;
    }

    body.filter-app-mode .filter-landing-preset--icon,
    body.filter-app-mode .filter-landing-preset--add-bubble {
        width: 44px;
        height: 44px;
    }

    body.filter-app-mode .landing-toolbar .filter-landing-preset--icon {
        width: 40px;
        height: 40px;
        max-width: 40px;
        flex: 0 1 40px;
    }
}
