/* ==================================================
   tools-ux.css  –  overview + single-tool view (js/tools-ux.js)
   Uses the existing tokens of the tools page:
   accent #4da3ff / #9dccff, surfaces rgba(255,255,255,.045)
   ================================================== */

/* ---------- compact hero: the overview starts above the fold ---------- */
.tools-hero {
    min-height: 0;
    padding: 150px 0 56px;
}

.tools-hero h1 {
    margin-bottom: 18px;
}

.tools-hero .lead {
    max-width: 640px;
}

#tools.tools-section {
    padding-top: 48px;
}

/* ---------- search ---------- */
.tool-search-wrap {
    position: relative;
    margin-bottom: 18px;
}

.tool-search-wrap .tool-search-input {
    margin-bottom: 0;
    padding-right: 52px;
    font-size: 16px; /* prevents zoom on iOS */
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
}

.tool-search-key {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    min-width: 24px;
    padding: 2px 7px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.6);
    font-family: inherit;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    box-shadow: none;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.tool-search-input:focus + .tool-search-key {
    opacity: 0;
}

@media (hover: none) {
    .tool-search-key {
        display: none;
    }

    .tool-search-wrap .tool-search-input {
        padding-right: 16px;
    }
}

/* ---------- tag chips with counts ---------- */
.tool-filter-tag {
    min-height: 36px;
}

.tool-filter-count {
    display: inline-block;
    margin-left: 7px;
    opacity: 0.65;
    font-variant-numeric: tabular-nums;
}

.tool-filter-tag.active .tool-filter-count {
    opacity: 0.9;
}

.tool-filter-tag:disabled {
    opacity: 0.35;
    cursor: default;
    background: transparent;
}

.tool-filter-tag:disabled:hover {
    color: #9dccff;
    border-color: rgba(77, 163, 255, 0.35);
}

.tool-filter-tag:focus-visible,
.tool-filter-reset-link:focus-visible {
    outline: 2px solid #4da3ff;
    outline-offset: 2px;
}

/* ---------- result line ---------- */
.tool-result-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 20px;
    margin-top: 18px;
    min-height: 24px;
}

.tool-result-count {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.65);
}

.tool-filter-reset-link {
    display: none;
    padding: 0;
    border: 0;
    background: none;
    color: #4da3ff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.tool-filter-reset-link.is-visible {
    display: inline-block;
}

.tool-filter-reset-link:hover {
    color: #F4F8FC;
    text-decoration: underline;
}

.tool-no-results {
    margin-top: 14px;
}

/* ---------- whole card is clickable ---------- */
.tools-ux .tool-card .tool-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.tools-ux .tool-card:not(.coming-soon) {
    cursor: pointer;
}

.tools-ux .tool-link:focus {
    outline: none;
}

.tools-ux .tool-card:focus-within {
    border-color: rgba(77, 163, 255, 0.85);
    box-shadow: 0 0 0 2px rgba(77, 163, 255, 0.45);
}

/* ---------- "In Arbeit" block ---------- */
.tools-soon {
    margin-top: 30px;
}

.tools-soon.is-hidden {
    display: none;
}

.tools-soon-title {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 18px;
    font-weight: 600;
}

.tool-card.coming-soon {
    opacity: 1;
    background: transparent;
    border-style: dashed;
    cursor: default;
}

.tool-card.coming-soon > * {
    opacity: 0.6;
}

.tool-card.coming-soon:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.09);
    background: transparent;
}

.tool-soon-label {
    margin-top: auto;
    align-self: flex-start;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

/* ---------- single-tool view ---------- */
.tools-ux .tool-panel {
    display: none;
}

.tools-ux .tool-panel.is-open {
    display: block;
    padding-top: 130px;
    min-height: 100vh;
    animation: toolPanelIn 0.22s ease-out;
}

.tools-ux.tool-open .tools-hero,
.tools-ux.tool-open #tools {
    display: none;
}

@keyframes toolPanelIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .tools-ux .tool-panel.is-open {
        animation: none;
    }
}

.tool-panel h2:focus {
    outline: none;
}

/* top navigation inside a tool */
.tool-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 24px;
    margin-bottom: 40px;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.tool-nav-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px 0 14px;
    border: 1px solid rgba(77, 163, 255, 0.4);
    border-radius: 30px;
    background: rgba(77, 163, 255, 0.1);
    color: #9dccff;
    font-weight: 600;
    text-decoration: none;
}

.tool-nav-back:hover,
.tool-nav-back:focus-visible {
    background: rgba(77, 163, 255, 0.26);
    border-color: rgba(77, 163, 255, 0.8);
    color: #F4F8FC;
    text-decoration: none;
}

.tool-nav-back:focus-visible,
.tool-pager a:focus-visible {
    outline: 2px solid #4da3ff;
    outline-offset: 2px;
}

.tool-nav-switch {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-nav-switch-label {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.65);
    white-space: nowrap;
}

.tool-nav-select.converter-input {
    width: auto;
    min-width: 230px;
    min-height: 44px;
    margin: 0;
    padding: 10px 14px;
    cursor: pointer;
}

/* bottom previous / next */
.tool-pager {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    margin-top: 60px;
    padding-top: 26px;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.tool-pager-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.03);
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.tool-pager-link:hover {
    border-color: rgba(77, 163, 255, 0.55);
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
}

.tool-pager-link.is-next {
    text-align: right;
}

.tool-pager-hint {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
}

.tool-pager-title {
    font-size: 17px;
    font-weight: 600;
    color: #F4F8FC;
}

.tool-pager-all {
    color: #4da3ff;
    font-weight: 600;
    padding: 10px 6px;
}

.tool-pager-all:hover {
    color: #F4F8FC;
}

/* ---------- small screens ---------- */
@media (max-width: 767px) {
    .tools-hero {
        padding: 110px 20px 36px;
    }

    #tools.tools-section {
        padding-top: 32px;
    }

    .tools-ux .tool-panel.is-open {
        padding-top: 100px;
    }

    .tool-nav-switch {
        width: 100%;
    }

    .tool-nav-select.converter-input {
        flex: 1;
        min-width: 0;
    }

    .tool-pager {
        grid-template-columns: 1fr 1fr;
    }

    .tool-pager-all {
        grid-column: 1 / -1;
        grid-row: 2;
        text-align: center;
    }

    .tool-pager-title {
        font-size: 15px;
    }
}

/* the theme styles every <nav> as the (absolute/fixed) main menu on small
   screens; keep the tool navigation in the normal flow */
nav.tool-nav,
nav.tool-pager {
    position: static;
    top: auto;
    left: auto;
    width: auto;
    height: auto;
}

/* theme bug on small screens: the hidden main-menu <nav> stays as an
   invisible strip below the top bar and swallows taps on the content
   underneath. Let taps through, but keep the opened menu clickable. */
@media only screen and (max-width: 992px) {
    #top-bar nav {
        pointer-events: none;
    }

    #top-bar nav #mainmenu {
        pointer-events: auto;
    }
}

/* ---------- existing-bug fixes ---------- */

/* style.css loads the hero image relative to css/, where it doesn't exist */
.tools-hero {
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.68), rgba(0, 0, 0, 0.78)),
        url(../images/background/4.webp);
}

/* "Zurücksetzen" looked identical to the main action; make it secondary */
.converter-actions .btn-custom.btn-border {
    background: transparent;
    border: 1px solid rgba(77, 163, 255, 0.55);
    color: #9dccff;
}

.converter-actions .btn-custom.btn-border:hover,
.converter-actions .btn-custom.btn-border:focus-visible {
    background: rgba(77, 163, 255, 0.14);
    border-color: rgba(77, 163, 255, 0.9);
    color: #F4F8FC;
    opacity: 1;
}

/* ---------- phones: one swipeable chip row instead of seven lines ---------- */
@media (max-width: 767px) {
    .tool-filter-box {
        padding: 18px;
        margin-bottom: 28px;
    }

    .tool-filter-tags {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin: 0 -18px;
        padding: 2px 18px 6px;
        scroll-padding: 0 18px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 28px), transparent 100%);
        mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 28px), transparent 100%);
    }

    .tool-filter-tags::-webkit-scrollbar {
        display: none;
    }

    .tool-filter-tag {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .tool-result-bar {
        margin-top: 12px;
    }
}
