/**
 * AthleteZone Athlete Search Styles
 *
 * All configurable values are driven by CSS custom properties (--as-*)
 * set as inline styles on the wrapper element by PHP. Each var() includes
 * a fallback so the widget still looks good if no config is present.
 *
 * Override in your theme:
 *   app/design/frontend/<Vendor>/<Theme>/AthleteZone_AthleteSearch/web/css/athlete-search.css
 */

/* ── Container ── */
.athlete-search-wrapper {
    position: relative;
    width: 100%;
    max-width: var(--as-width, 480px);
    margin: var(--as-margin, 0 auto);
    font-family: inherit;
    box-sizing: border-box;
}

/* ── Input Row ── */
.athlete-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.athlete-search-icon {
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    color: var(--as-placeholder-color, #999);
    pointer-events: none;
    z-index: 1;
}

.athlete-search-input {
    width: 100%;
    height: var(--as-input-height, 52px);
    padding: 0 72px 0 44px;
    font-size: var(--as-font-size, 18px);
    line-height: var(--as-input-height, 52px);
    color: var(--as-text-color, #333);
    background: var(--as-bg-color, #fff);
    border: 2px solid var(--as-border-color, #ddd);
    border-radius: var(--as-border-radius, 8px);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.athlete-search-input:focus {
    border-color: var(--as-focus-color, #1a73e8);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--as-focus-color, #1a73e8) 15%, transparent);
}

.athlete-search-input::placeholder {
    color: var(--as-placeholder-color, #aaa);
}

/* ── Spinner ── */
.athlete-search-spinner {
    position: absolute;
    right: 42px;
    width: 18px;
    height: 18px;
    border: 2px solid var(--as-border-color, #ddd);
    border-top-color: var(--as-focus-color, #1a73e8);
    border-radius: 50%;
    animation: athlete-search-spin 0.6s linear infinite;
}

@keyframes athlete-search-spin {
    to { transform: rotate(360deg); }
}

/* ── Clear Button ── */
.athlete-search-clear {
    position: absolute;
    right: 12px;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 20px;
    line-height: 26px;
    text-align: center;
    color: var(--as-placeholder-color, #999);
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.athlete-search-clear:hover {
    color: var(--as-text-color, #333);
    background: #f0f0f0;
}

/* ── Dropdown ── */
.athlete-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: var(--as-dd-max-height, 380px);
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: var(--as-dd-border-radius, 8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
}

/* ── Result Item ── */
.athlete-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: #333;
    cursor: pointer;
    transition: background-color 0.12s ease;
    border-bottom: 1px solid #f5f5f5;
}

.athlete-search-result:last-child {
    border-bottom: none;
}

.athlete-search-result:hover,
.athlete-search-result.active {
    background-color: #f5f8ff;
}

/* ── Thumbnail ── */
.athlete-search-thumb {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #eee;
}

.athlete-search-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
}

.athlete-search-thumb-placeholder svg {
    width: 22px;
    height: 22px;
}

/* ── Result Text ── */
.athlete-search-result-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.athlete-search-result-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.athlete-search-result-name mark {
    background-color: #fef3cd;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.athlete-search-result-breadcrumb {
    font-size: 12px;
    color: #888;
    line-height: 1.3;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── No Results ── */
.athlete-search-no-results {
    padding: 16px 14px;
    font-size: 14px;
    color: #888;
    text-align: center;
}

.athlete-search-no-results strong {
    color: #555;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .athlete-search-wrapper {
        max-width: 100% !important;
    }

    .athlete-search-input {
        font-size: 16px !important; /* Prevents iOS auto-zoom */
    }

    .athlete-search-dropdown {
        max-height: 300px;
    }
}
