/* The timezone field under a team country field (EQU-1189). Spec: equipo-documentation's
 * reference/design-system-components.md § Timezone field. Driven by inc/js/forms/timezone_field.js;
 * the search takes the host form's own field class, everything else comes from here. */

/* `space-2` under the country field, on `leading-normal` whatever the page's own is. The height holds
 * the line before the script draws it, so the fields below do not jump. */
.ts-tz {
    position: relative;
    margin-top: 0.5rem;
    min-height: 1.3125rem;
    line-height: 1.5;
}

.ts-tz-line {
    margin: 0;
    font-size: 0.875rem;
    color: var(--gray-600, #4b5563);
}

.ts-tz-value {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
    border: 0;
    border-radius: 0.375rem;
    background: none;
    font: inherit;
    font-weight: 600;
    color: var(--equipo-600, #7c3aed);
    text-align: left;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
    cursor: pointer;
}

.ts-tz-value[hidden] {
    display: none;
}

.ts-tz-value:hover {
    color: var(--equipo-700, #6d28d9);
    text-decoration-style: solid;
}

.ts-tz-value:focus {
    outline: none;
}

.ts-tz-value:focus-visible {
    outline: 2px solid var(--equipo-500, #8b5cf6);
    outline-offset: 2px;
}

.ts-tz-value svg {
    flex: none;
    width: 12px;
    height: 12px;
    transition: transform 200ms ease;
}

.ts-tz.open .ts-tz-value svg {
    transform: rotate(180deg);
}

/* Over the form, as wide as the field, `space-2` under the line; above it when it fits better there.
 * The country field's panel: `bg-primary`, a `border-light` outline, `radius-xl`, `shadow-soft-lg`.
 * Above the forms' own dropdown fields (the sign-up's club field sits at 100), under the page chrome. */
.ts-tz-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    z-index: 200;
    display: grid;
    gap: 0.5rem;
    box-sizing: border-box;
    padding: 0.5rem;
    background: #fff;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05), 0 8px 24px rgba(0, 0, 0, 0.05);
    animation: ts-tz-in 200ms ease;
}

.ts-tz-panel.above {
    top: auto;
    bottom: calc(100% + 0.5rem);
}

.ts-tz-panel[hidden] {
    display: none;
}

@keyframes ts-tz-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

.ts-tz-search {
    width: 100%;
    box-sizing: border-box;
}

.ts-tz-list {
    position: relative;
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.ts-tz-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 40px;
    box-sizing: border-box;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--gray-100, #f3f4f6);
    cursor: pointer;
}

.ts-tz-option:first-child {
    border-top: 0;
}

.ts-tz-option:hover,
.ts-tz-option.active,
.ts-tz-option[aria-selected="true"] {
    background: var(--equipo-50, #f5f3ff);
}

.ts-tz-text {
    display: grid;
    flex: 1;
    min-width: 0;
}

.ts-tz-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-900, #111827);
}

.ts-tz-option:hover .ts-tz-name,
.ts-tz-option.active .ts-tz-name,
.ts-tz-option[aria-selected="true"] .ts-tz-name {
    color: var(--equipo-700, #6d28d9);
}

.ts-tz-option[aria-selected="true"] .ts-tz-name {
    font-weight: 600;
}

.ts-tz-city {
    font-size: 0.75rem;
    color: var(--gray-600, #4b5563);
}

.ts-tz-offset {
    font-size: 0.75rem;
    color: var(--gray-400, #9ca3af);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* The chosen zone's check; every row keeps its room, so the offsets line up. */
.ts-tz-option::after {
    content: "";
    flex: none;
    width: 12px;
    height: 12px;
}

.ts-tz-option[aria-selected="true"]::after {
    background: var(--equipo-600, #7c3aed);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
}

.ts-tz-empty {
    padding: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-600, #4b5563);
}

@media (prefers-reduced-motion: reduce) {
    .ts-tz-panel {
        animation: none;
    }

    .ts-tz-value svg {
        transition: none;
    }
}
