/**
 * event-views.css - visual styling for EventViewsWidget's switcher bar
 * (widgets/EventViewsWidget.php::renderToggle()).
 *
 * The three "Switcher style" choices (buttons / tabs / icons) used to share
 * one Bootstrap btn-group/nav-tabs skin with only an .active class telling
 * them apart, so they barely read as different controls. This gives each its
 * own look, keyed off the data-style attribute the widget stamps on the
 * wrapper. Uses the app's own CSS custom properties (web/css/variables.css),
 * which already flip for dark mode - nothing theme-specific lives here.
 */

.event-view-toggle {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

/* ---- buttons: a real segmented control -------------------------------- */
.event-view-toggle[data-style="buttons"] {
    padding: 0.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    gap: 0.125rem;
}

.event-view-toggle[data-style="buttons"] > .btn {
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    padding: 0.4rem 1rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.event-view-toggle[data-style="buttons"] > .btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.event-view-toggle[data-style="buttons"] > .btn.active {
    background: var(--button-primary-bg, var(--color-primary-600));
    color: var(--color-neutral-0, #fff);
    box-shadow: none;
}

/* ---- tabs: underlined, blends with a native filter strip --------------- */
.event-view-toggle[data-style="tabs"] {
    border-bottom: 1px solid var(--border-default);
    gap: 1rem;
}

.event-view-toggle[data-style="tabs"] > .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.5rem 0.25rem;
    color: var(--text-secondary);
    background: transparent;
    margin-bottom: -1px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.event-view-toggle[data-style="tabs"] > .nav-link:hover {
    color: var(--text-primary);
}

.event-view-toggle[data-style="tabs"] > .nav-link.active {
    color: var(--button-primary-bg, var(--color-primary-600));
    border-bottom-color: var(--button-primary-bg, var(--color-primary-600));
    background: transparent;
    font-weight: 600;
}

/* ---- icons: compact square buttons, label only in the tooltip ---------- */
.event-view-toggle[data-style="icons"] {
    padding: 0.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    gap: 0.125rem;
}

.event-view-toggle[data-style="icons"] > .btn {
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    width: 2.5rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.event-view-toggle[data-style="icons"] > .btn i {
    margin: 0;
    font-size: 1rem;
}

.event-view-toggle[data-style="icons"] > .btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.event-view-toggle[data-style="icons"] > .btn.active {
    background: var(--button-primary-bg, var(--color-primary-600));
    color: var(--color-neutral-0, #fff);
}

/* ---- outline: bordered chips, no fill ----------------------------------- */
.event-view-toggle[data-style="outline"] {
    gap: 0.5rem;
}

.event-view-toggle[data-style="outline"] > .btn {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    padding: 0.4rem 1rem;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.event-view-toggle[data-style="outline"] > .btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.event-view-toggle[data-style="outline"] > .btn.active {
    border-color: var(--button-primary-bg, var(--color-primary-600));
    color: var(--button-primary-bg, var(--color-primary-600));
    background: rgba(var(--color-primary-500-rgb), 0.08);
    box-shadow: none;
}

/* ---- minimal: plain text links, underline on active --------------------- */
.event-view-toggle[data-style="minimal"] {
    gap: 1.25rem;
}

.event-view-toggle[data-style="minimal"] > .btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 0.25rem 0;
    text-decoration: none;
    text-underline-offset: 3px;
    transition: color 0.15s ease;
}

/* Text-only, matching the style's name - the icon glyph the widget always
 * composes into the button content is hidden here in CSS, not in PHP, so
 * every other style keeps its icon for free. */
.event-view-toggle[data-style="minimal"] > .btn i {
    display: none;
}

.event-view-toggle[data-style="minimal"] > .btn:hover {
    color: var(--text-primary);
}

.event-view-toggle[data-style="minimal"] > .btn.active {
    color: var(--button-primary-bg, var(--color-primary-600));
    text-decoration: underline;
    font-weight: 600;
}

/* ---- segmented-icon: icon+label pill, bigger touch target ---------------- */
.event-view-toggle[data-style="segmented-icon"] {
    padding: 0.3rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    gap: 0.25rem;
}

.event-view-toggle[data-style="segmented-icon"] > .btn {
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    padding: 0.6rem 1.35rem;
    font-size: 1.05rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.event-view-toggle[data-style="segmented-icon"] > .btn i {
    font-size: 1.1rem;
}

.event-view-toggle[data-style="segmented-icon"] > .btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.event-view-toggle[data-style="segmented-icon"] > .btn.active {
    background: var(--button-primary-bg, var(--color-primary-600));
    color: var(--color-neutral-0, #fff);
    box-shadow: none;
}

/* In-tabs merges real links (Upcoming/Past) with view-switch buttons in one
 * bar - the tabItems anchors reuse whichever style class the loop above
 * already targets (.btn or .nav-link), so no extra selector is needed here. */

/* ---- btn-group override ------------------------------------------------
 * Bootstrap's `.btn-group > .btn:not(:last-child):not(.dropdown-toggle)`
 * (and its :not(:first-child) twin) outranks the per-style rules above, so a
 * middle button lost its rounded corners and picked up a -1px left margin -
 * visible as a square-cornered active pill. Re-assert both with a selector
 * that wins. */
.btn-group.event-view-toggle[data-style="buttons"] > .btn,
.btn-group.event-view-toggle[data-style="segmented-icon"] > .btn,
.btn-group.event-view-toggle[data-style="outline"] > .btn {
    border-radius: var(--radius-full);
    margin-left: 0;
}

.btn-group.event-view-toggle[data-style="icons"] > .btn {
    border-radius: var(--radius-md);
    margin-left: 0;
}

.btn-group.event-view-toggle[data-style="minimal"] > .btn {
    margin-left: 0;
}

/* ---- phones: one full-width row, never a wrapped capsule ---------------
 * On narrow screens the label + icon buttons do not fit side by side, and a
 * wrapped pill reads as broken. Every style becomes a single non-wrapping
 * row: the filled/outlined styles share the width equally and stack icon
 * over label (mobile tab-bar look); the text styles scroll sideways. */
@media (max-width: 575.98px) {
    .event-view-toggle {
        display: flex;
        flex-wrap: nowrap;
        width: 100%;
    }

    .btn-group.event-view-toggle[data-style="buttons"],
    .btn-group.event-view-toggle[data-style="segmented-icon"] {
        border-radius: var(--radius-lg);
        padding: 0.25rem;
    }

    .btn-group.event-view-toggle[data-style="buttons"] > .btn,
    .btn-group.event-view-toggle[data-style="segmented-icon"] > .btn,
    .btn-group.event-view-toggle[data-style="outline"] > .btn,
    .btn-group.event-view-toggle[data-style="icons"] > .btn {
        flex: 1 1 0;
        min-width: 0;
    }

    .btn-group.event-view-toggle[data-style="buttons"] > .btn,
    .btn-group.event-view-toggle[data-style="segmented-icon"] > .btn,
    .btn-group.event-view-toggle[data-style="outline"] > .btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        padding: 0.45rem 0.25rem;
        font-size: 0.8rem;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
    }

    .btn-group.event-view-toggle[data-style="buttons"] > .btn,
    .btn-group.event-view-toggle[data-style="segmented-icon"] > .btn {
        border-radius: var(--radius-md);
    }

    .btn-group.event-view-toggle[data-style="outline"] > .btn {
        border-radius: var(--radius-lg);
    }

    .event-view-toggle[data-style="buttons"] > .btn i,
    .event-view-toggle[data-style="segmented-icon"] > .btn i,
    .event-view-toggle[data-style="outline"] > .btn i {
        margin: 0 !important;
        font-size: 1.05rem;
    }

    .event-view-toggle[data-style="tabs"],
    .event-view-toggle[data-style="minimal"] {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .event-view-toggle[data-style="tabs"]::-webkit-scrollbar,
    .event-view-toggle[data-style="minimal"]::-webkit-scrollbar {
        display: none;
    }

    .event-view-toggle[data-style="tabs"] > .nav-link,
    .event-view-toggle[data-style="minimal"] > .btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* Very narrow phones (320-ish) with four views: shave the label a touch so
 * "Zemljevid"-length words still fit their quarter of the bar. */
@media (max-width: 359.98px) {
    .btn-group.event-view-toggle[data-style="buttons"] > .btn,
    .btn-group.event-view-toggle[data-style="segmented-icon"] > .btn,
    .btn-group.event-view-toggle[data-style="outline"] > .btn {
        font-size: 0.72rem;
        padding-left: 0.1rem;
        padding-right: 0.1rem;
    }

    .btn-group.event-view-toggle[data-style="outline"] {
        gap: 0.25rem;
    }
}
