/**
 * Create team — aligned with event create (events/css/create.css)
 */

.team-create-page {
    --team-create-visual-min-h: 280px;
}

/* Same width as the card — back link lines up with the form block (no horizontal offset) */
.team-create-layout {
    width: 100%;
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
}

.team-create-heading {
    margin-bottom: 1rem;
}

.team-create-page .team-create-heading .btn-back {
    border-radius: 12px !important;
}

.team-create-page .team-create-layout .team-create-card.event-form-card {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.team-create-form-row.form-row-custom {
    align-items: start;
}

/* Left column: minimal “card” like image placeholder on event create */
.team-create-visual {
    margin: 0;
}

.team-create-visual-inner {
    width: 100%;
    min-height: var(--team-create-visual-min-h);
    aspect-ratio: 1;
    max-height: 340px;
    background: var(--input-bg);
    border-radius: 16px;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.75rem 1.25rem;
    box-sizing: border-box;
}

[data-bs-theme='light'] .team-create-visual-inner {
    background: var(--bg-secondary);
}

.team-create-visual-icon {
    width: 88px;
    height: 88px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary);
    margin-bottom: 1.25rem;
}

.team-create-visual-icon svg {
    flex-shrink: 0;
}

.team-create-visual-event {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.team-create-visual-copy {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
    max-width: 220px;
}

/* Native selects hidden — Choices.js */
.team-create-page #id_type,
.team-create-page #id_max_members,
.team-create-page #eventSelect,
.team-create-page #editMaxScore,
.team-create-page #editWeight {
    display: none !important;
}

.team-create-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Choices.js — same look as home page role / date filters (custom.css) */
.team-create-page .team-create-options.events-index-filters .events-filter-dropdown {
    width: 100%;
    min-width: 0;
}

.team-create-page .team-create-options.events-index-filters .choices {
    margin-bottom: 0 !important;
    width: 100%;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Choices.js default: triangle on .choices (root), not on .choices__inner — hide it */
.team-create-page .team-create-options.events-index-filters .choices[data-type*='select-one']::after {
    content: none !important;
    display: none !important;
    border: none !important;
}

.team-create-page .team-create-options.events-index-filters .choices__inner {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.375rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
    min-height: var(--events-filter-trigger-height, 44px) !important;
    max-height: var(--events-filter-trigger-height, 44px) !important;
    height: var(--events-filter-trigger-height, 44px) !important;
    padding: 0 2.25rem 0 2.5rem !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--events-search-control-radius, 12px) !important;
    background-color: var(--input-bg) !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}

[data-bs-theme='dark'] .team-create-page .team-create-options.events-index-filters .choices__inner {
    border: none !important;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--border-color) 65%, transparent) !important;
}

.team-create-page .team-create-options.events-index-filters .choices__inner:hover {
    border-color: var(--border-color-hover) !important;
}

[data-bs-theme='dark'] .team-create-page .team-create-options.events-index-filters .choices__inner:hover {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--border-color-hover) 75%, transparent) !important;
}

.team-create-page .team-create-options.events-index-filters .choices.is-open .choices__inner,
.team-create-page .team-create-options.events-index-filters .choices__inner.is-focused {
    background-color: var(--input-bg-focus) !important;
    border-color: var(--bs-primary) !important;
    outline: none !important;
}

/* Beat choices-theme.css focus ring on these triggers */
html:not([data-bs-theme='dark']) .team-create-page .team-create-options.events-index-filters .choices.is-open .choices__inner,
html:not([data-bs-theme='dark']) .team-create-page .team-create-options.events-index-filters .choices__inner.is-focused {
    box-shadow: none !important;
}

[data-bs-theme='dark'] .team-create-page .team-create-options.events-index-filters .choices.is-open .choices__inner,
[data-bs-theme='dark'] .team-create-page .team-create-options.events-index-filters .choices__inner.is-focused {
    border: none !important;
    box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.35) !important;
}

.team-create-page .team-create-options.events-index-filters .choices__inner:focus-visible {
    outline: 2px solid var(--bs-btn-active-border-color) !important;
    outline-offset: 2px !important;
}

/* Single chevron on trigger (library triangle stays removed on .choices::after) */
.team-create-page .team-create-options.events-index-filters .choices[data-type*='select-one'] .choices__inner::after {
    content: '' !important;
    display: block !important;
    position: absolute !important;
    right: 0.65rem !important;
    top: 50% !important;
    margin-top: 0 !important;
    transform: translateY(-50%) !important;
    width: 14px !important;
    height: 14px !important;
    border: none !important;
    pointer-events: none !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 14px 14px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    transition: transform 0.2s ease !important;
}

[data-bs-theme='dark'] .team-create-page .team-create-options.events-index-filters .choices[data-type*='select-one'] .choices__inner::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%23adb5bd' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
}

.team-create-page .team-create-options.events-index-filters .choices.is-open .choices__inner::after {
    transform: translateY(-50%) rotate(180deg) !important;
}

/* Lead icons — mask + theme color (matches Bootstrap Icons funnel / people) */
.team-create-page .team-create-filter-dropdown--type .choices__inner::before,
.team-create-page .team-create-filter-dropdown--members .choices__inner::before {
    content: '' !important;
    position: absolute !important;
    left: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
    pointer-events: none !important;
    background-color: var(--text-secondary) !important;
    background-image: none !important;
    -webkit-mask-repeat: no-repeat !important;
    mask-repeat: no-repeat !important;
    -webkit-mask-position: center !important;
    mask-position: center !important;
    -webkit-mask-size: 18px 18px !important;
    mask-size: 18px 18px !important;
}

.team-create-page .team-create-filter-dropdown--type .choices__inner::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5v-2zm1 .5v1.308l4.372 4.858A.5.5 0 0 1 6 7.5v5.306l2-.666V7.5a.5.5 0 0 1 .128-.334L13.5 3.308V2h-11z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5v-2zm1 .5v1.308l4.372 4.858A.5.5 0 0 1 6 7.5v5.306l2-.666V7.5a.5.5 0 0 1 .128-.334L13.5 3.308V2h-11z'/%3E%3C/svg%3E");
}

/* Single-path icon (reliable mask); person-fill = headcount / members */
.team-create-page .team-create-filter-dropdown--members .choices__inner::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6'/%3E%3C/svg%3E");
}

.team-create-page .team-create-options.events-index-filters .choices__list--single {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

.team-create-page .team-create-options.events-index-filters .choices__list--single .choices__item {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    padding: 0 !important;
    font-size: 0.8125rem !important;
}

@media (min-width: 768px) {
    .team-create-page .team-create-options.events-index-filters .choices__list--single .choices__item {
        font-size: 0.875rem !important;
    }
}

/* Dropdown panel — matches .events-filter-dropdown-menu */
.team-create-page .team-create-options.events-index-filters .choices__list--dropdown,
.team-create-page .team-create-options.events-index-filters .choices__list[aria-expanded] {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    min-width: 100% !important;
    max-width: min(100vw - 2rem, 300px) !important;
    margin-top: 0.625rem !important;
    padding: 0.4375rem !important;
    border-radius: 1.5rem !important;
    overflow: hidden !important;
    z-index: 11000 !important;
    border: 1px solid var(--border-color) !important;
    background: var(--card-bg) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

[data-bs-theme='dark'] .team-create-page .team-create-options.events-index-filters .choices__list--dropdown,
[data-bs-theme='dark'] .team-create-page .team-create-options.events-index-filters .choices__list[aria-expanded] {
    background: #252525 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.45) !important;
}

/* Options — matches .filter-dropdown-option rows */
.team-create-page .team-create-options.events-index-filters .choices__list--dropdown .choices__item--choice {
    border-radius: 1.125rem !important;
    padding: 0.625rem !important;
    margin: 0 !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    border: 1px solid transparent !important;
    background: transparent !important;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease !important;
}

.team-create-page .team-create-options.events-index-filters .choices__list--dropdown .choices__item--choice.is-highlighted {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

.team-create-page .team-create-options.events-index-filters .choices__list--dropdown .choices__item--choice.is-selected {
    background-color: rgba(var(--bs-primary-rgb), 0.1) !important;
    border-color: transparent !important;
    color: var(--bs-primary) !important;
}

/* Choices default “Press to select” (attr data-select-text on items) — disabled via itemSelectText + CSS backup */
.team-create-page .choices__list--dropdown .choices__item--selectable::after,
.team-create-page .choices__list[aria-expanded] .choices__item--selectable::after {
    content: none !important;
    display: none !important;
    opacity: 0 !important;
}

@media (min-width: 640px) {
    .team-create-page .choices__list--dropdown .choices__item--selectable,
    .team-create-page .choices__list[aria-expanded] .choices__item--selectable {
        padding-right: 0.625rem !important;
    }
}

.team-create-hint {
    margin-top: 0.5rem;
    padding: 1rem 1.125rem;
    border-radius: 12px;
    background: color-mix(in srgb, var(--bs-primary) 6%, var(--input-bg));
    border: 1px solid color-mix(in srgb, var(--bs-primary) 18%, var(--border-color));
}

[data-bs-theme='dark'] .team-create-hint {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(var(--bs-primary-rgb), 0.08);
}

.team-create-hint__title {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.team-create-hint__list {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.55;
}

.team-create-hint__list li {
    margin-bottom: 0.2rem;
}

.team-create-actions.form-buttons-group {
    margin-top: 0.25rem;
}

/* Event form card: title input inherits from create.css; keep comfortable top spacing */
.team-create-card .form-title-input {
    margin-bottom: 0.15rem;
}

/* Matching teams modal */
.matching-teams-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.25rem;
}

.matching-team-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.matching-team-card:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.12);
    transform: translateY(-1px);
}

[data-bs-theme='dark'] .matching-team-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.matching-team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.75rem;
}

.matching-team-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.matching-team-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 1rem;
}

.matching-team-members {
    margin-bottom: 1rem;
}

.members-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.5rem;
}

.matching-team-members .members-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.matching-team-members .member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.member-name {
    font-size: 0.875rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.member-name.is-leader {
    font-weight: 600;
}

.matching-team-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .team-create-visual-inner {
        min-height: auto;
        aspect-ratio: auto;
        max-height: none;
        padding: 1.5rem 1rem;
    }

    .team-create-options {
        grid-template-columns: 1fr;
    }

    /* Match events index filter triggers on small viewports */
    .team-create-page .team-create-options.events-index-filters .choices__inner {
        max-height: 40px !important;
        min-height: 40px !important;
        height: 40px !important;
        padding: 0 2rem 0 2.35rem !important;
        font-size: 0.8125rem !important;
    }

    .team-create-page .team-create-filter-dropdown--type .choices__inner::before,
    .team-create-page .team-create-filter-dropdown--members .choices__inner::before {
        left: 0.65rem !important;
        width: 16px !important;
        height: 16px !important;
        -webkit-mask-size: 16px 16px !important;
        mask-size: 16px 16px !important;
    }

    .team-create-page .team-create-options.events-index-filters .choices[data-type*='select-one'] .choices__inner::after {
        right: 0.55rem !important;
        width: 12px !important;
        height: 12px !important;
        background-size: 12px 12px !important;
    }

    .matching-teams-list {
        max-height: 300px;
    }
}
