/* ============================================
   ATCHISON AREA CHAMBER OF COMMERCE
   Member Directory Page Styles
   ============================================ */

/* ==========================================
   PAGE HEADER
   ========================================== */
.page-header {
    background: linear-gradient(180deg, var(--chamber-slate) 0%, var(--chamber-slate-dark) 100%);
    color: var(--white);
    padding: var(--space-16) 0 var(--space-12);
    text-align: center;
}

.page-header__title {
    font-size: var(--text-4xl);
    color: var(--white);
    margin-bottom: var(--space-4);
}

.page-header__subtitle {
    font-size: var(--text-lg);
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin: 0 auto;
}

/* ==========================================
   FILTERS & SEARCH
   --------------------------------------------
   Sticky bar under the masthead. `top` must mirror the LIVE inner nav height:
   `--sticky-header-offset` expands (80px) until `.site-header--scrolled`, then matches
   the shrunk bar (64px). Using only the shrunk value caused the filters to dock under
   a tall header on first scroll → overlap / jitter with backdrop-filter + logo shrink.
   Z-index stays just below `.site-header` so nothing paints “through” it.
   ========================================== */
.directory-filters {
    background: var(--white);
    padding: var(--space-5) 0;
    border-bottom: 1px solid var(--light-gray);
    position: sticky;
    top: calc(var(--sticky-header-offset) - 1px);
    z-index: calc(var(--z-sticky) - 1);
    transition: top var(--transition-base);
    box-shadow: 0 6px 16px rgba(51, 79, 93, 0.06);
}

.filters-inner {
    display: flex;
    gap: var(--space-3);
    align-items: stretch;
    flex-wrap: wrap;
}

/* Shared sizing for all controls in the bar so the row reads as one
   coherent control strip (matches the Events page filter bar). */
.search-input,
.filter-select {
    height: 48px;
    box-sizing: border-box;
    font-family: var(--font-display, 'Poppins', sans-serif);
}

/* ----- Search ----- */
.search-wrapper {
    flex: 1 1 280px;
    min-width: 240px;
    position: relative;
    display: flex;
    align-items: stretch;
}

.search-wrapper svg {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--medium-gray);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0 var(--space-4) 0 var(--space-12);
    border: 2px solid var(--light-gray);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    color: var(--dark-gray);
    background: var(--white);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    -webkit-appearance: none;
    appearance: none;
}

.search-input::placeholder {
    color: var(--medium-gray);
    opacity: 1;
}

.search-input:focus {
    outline: none;
    border-color: var(--chamber-teal);
    box-shadow: 0 0 0 3px rgba(39, 175, 165, 0.18);
}

/* ----- Filter Selects ----- */
.filter-group {
    display: flex;
    align-items: stretch;
    flex: 0 1 200px;
    min-width: 170px;
}

.filter-select {
    flex: 1 1 auto;
    width: 100%;
    padding: 0 var(--space-10) 0 var(--space-4);
    border: 2px solid var(--light-gray);
    border-radius: var(--radius-lg);
    background-color: var(--white);
    color: var(--dark-gray);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);

    /* Strip native chevron and draw our own teal one */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2327afa5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='5 8 10 13 15 8'/></svg>");
    background-repeat: no-repeat;
    background-position: right var(--space-4) center;
    background-size: 16px 16px;
}

.filter-select::-ms-expand { display: none; }

.filter-select:hover {
    border-color: var(--chamber-teal);
}

.filter-select:focus {
    outline: none;
    border-color: var(--chamber-teal);
    box-shadow: 0 0 0 3px rgba(39, 175, 165, 0.18);
}

.filter-select option {
    font-family: var(--font-display, 'Poppins', sans-serif);
    color: var(--dark-gray);
    background: var(--white);
    padding: var(--space-2);
}

.results-count {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--medium-gray);
    margin-left: auto;
    align-self: center;
    white-space: nowrap;
}

/* ==========================================
   DIRECTORY MAP (Leaflet / OSM)
   ========================================== */
.directory-map-section {
    background: var(--off-white);
    padding: var(--space-10) 0;
    border-top: 1px solid var(--light-gray);
    border-bottom: 1px solid var(--light-gray);
}

.directory-map-section__title {
    font-size: var(--text-2xl);
    color: var(--chamber-slate);
    margin: 0 0 var(--space-3);
    text-align: center;
}

.directory-map-section__hint {
    font-size: var(--text-sm);
    color: var(--medium-gray);
    max-width: 52rem;
    margin: 0 auto var(--space-6);
    text-align: center;
    line-height: var(--leading-relaxed);
}

.directory-map-mount {
    width: 100%;
}

.directory-map-mount--hidden .directory-map-mount__inner {
    display: none;
}

.directory-map-mount__inner {
    width: 100%;
    height: 420px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    z-index: 1;
}

@media (max-width: 767px) {
    .directory-map-mount__inner {
        height: 320px;
    }
}

.directory-map-popup-btn {
    margin-top: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--white);
    background: var(--chamber-teal);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
}

/* ==========================================
   CATEGORY FILTERS (Pills)
   ========================================== */
.category-filters {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    padding: var(--space-4) 0;
}

.category-pill {
    padding: var(--space-2) var(--space-4);
    background: var(--off-white);
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--dark-gray);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.category-pill:hover {
    background: var(--chamber-teal-light);
    color: var(--white);
}

.category-pill--active {
    background: var(--chamber-teal);
    color: var(--white);
    border-color: var(--chamber-teal);
}

.category-pill__icon {
    font-size: var(--text-base);
    /* Emoji aren't in Poppins — prefer system emoji fonts so glyphs don't degrade to placeholders. */
    font-family:
        'Segoe UI Emoji',
        'Segoe UI Symbol',
        'Apple Color Emoji',
        'Noto Color Emoji',
        sans-serif;
    line-height: 1;
}

/* ==========================================
   DIRECTORY GRID
   ========================================== */
.directory-section {
    padding: var(--space-10) 0 var(--space-16);
    background: var(--off-white);
    min-height: 50vh;
}

/* Directory grid is now tier-grouped: a vertical stack of .featured-tier
   sections, each with its own smart-centering flex grid (see
   components/member-card.css). The styles below cover only the legacy
   #directory-grid container shape (loading state + no-results). */
.directory-grid,
.directory-tiered {
    display: flex;
    flex-direction: column;
    gap: var(--space-10);
}

/* While loading we still want a proper card grid so the skeletons line up. */
.loading-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-6);
    width: 100%;
}

@media (max-width: 1199px) {
    .loading-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 959px) {
    .loading-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 639px) {
    .loading-grid { grid-template-columns: 1fr; }
}

/* ==========================================
   MEMBER CARDS
   ========================================== */
.business-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
}

.business-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-4px);
}

.business-card__header {
    position: relative;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: var(--off-white);
}

.business-card__logo {
    max-width: 80%;
    max-height: 80px;
    object-fit: contain;
}

.business-card__tier {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
}

.business-card__body {
    padding: var(--space-5);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.business-card__name {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--dark-gray);
    margin-bottom: var(--space-2);
    line-height: var(--leading-tight);
}

.business-card__category {
    font-size: var(--text-sm);
    color: var(--chamber-teal);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.business-card__description {
    font-size: var(--text-sm);
    color: var(--medium-gray);
    margin-bottom: var(--space-4);
    line-height: var(--leading-relaxed);
    flex: 1;
    
    /* Clamp to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.business-card__contact {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.business-card__contact a {
    color: var(--dark-gray);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    transition: color var(--transition-base);
}

.business-card__contact a:hover {
    color: var(--chamber-red);
}

.business-card__contact svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--chamber-teal);
}

.business-card__actions {
    display: flex;
    gap: var(--space-2);
    margin-top: auto;
}

.business-card__actions .btn {
    flex: 1;
    justify-content: center;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
}

/* ==========================================
   TIER-SPECIFIC CARD STYLING
   ========================================== */
.business-card--diamond .business-card__header {
    background: linear-gradient(135deg, rgba(64, 224, 208, 0.1) 0%, rgba(64, 224, 208, 0.05) 100%);
    border-bottom: 2px solid var(--tier-diamond);
}

.business-card--platinum .business-card__header {
    background: linear-gradient(135deg, rgba(51, 51, 51, 0.08) 0%, rgba(51, 51, 51, 0.03) 100%);
    border-bottom: 2px solid var(--tier-platinum);
}

.business-card--gold .business-card__header {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(212, 175, 55, 0.05) 100%);
    border-bottom: 2px solid var(--tier-gold);
}

.business-card--silver .business-card__header {
    border-bottom: 2px solid var(--tier-silver);
}

.business-card--bronze .business-card__header {
    border-bottom: 2px solid var(--tier-bronze);
}

/* ==========================================
   NO RESULTS
   ========================================== */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-16) var(--space-6);
    width: 100%;
}

.no-results__icon {
    width: 80px;
    height: 80px;
    color: var(--light-gray);
    margin: 0 auto var(--space-6);
}

.no-results__title {
    font-size: var(--text-2xl);
    color: var(--dark-gray);
    margin-bottom: var(--space-3);
}

.no-results__text {
    color: var(--medium-gray);
    margin-bottom: var(--space-6);
}

/* ==========================================
   LOADING STATE
   ========================================== */
.skeleton-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.skeleton-card__header {
    height: 120px;
    background: var(--light-gray);
}

.skeleton-card__body {
    padding: var(--space-5);
}

.skeleton-card__line {
    height: 16px;
    background: var(--light-gray);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-3);
}

.skeleton-card__line--short {
    width: 60%;
}

.skeleton-card__line--medium {
    width: 80%;
}

/* ==========================================
   MEMBER DETAIL MODAL
   ========================================== */
.member-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.member-modal--open {
    opacity: 1;
    visibility: visible;
}

.member-modal__content {
    background: var(--white);
    border-radius: var(--radius-xl);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.95);
    transition: transform var(--transition-base);
}

.member-modal--open .member-modal__content {
    transform: scale(1);
}

.member-modal__close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--off-white);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    z-index: 1;
}

.member-modal__close:hover {
    background: var(--chamber-red);
    color: var(--white);
}

.member-modal__header {
    padding: var(--space-8);
    background: var(--off-white);
    display: flex;
    gap: var(--space-6);
    align-items: center;
}

.member-modal__logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    background: var(--white);
    border-radius: var(--radius-md);
    padding: var(--space-2);
}

.member-modal__title-group {
    flex: 1;
}

.member-modal__name {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-2);
}

.member-modal__body {
    padding: var(--space-8);
}

.member-modal__section {
    margin-bottom: var(--space-6);
}

.member-modal__section-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--chamber-slate);
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--light-gray);
}

.member-modal__hours {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.member-modal__hours dt {
    font-weight: var(--font-medium);
}

.member-modal__hours dd {
    color: var(--medium-gray);
    margin: 0;
}

/* ==========================================
   RESPONSIVE ADJUSTMENTS
   ========================================== */
@media (max-width: 767px) {
    .page-header {
        padding: var(--space-12) 0 var(--space-8);
    }
    
    .page-header__title {
        font-size: var(--text-3xl);
    }
    
    .search-wrapper,
    .filter-group {
        flex-basis: 100%;
        min-width: 0;
    }
    
    .results-count {
        flex-basis: 100%;
        margin-left: 0;
        text-align: center;
    }
    
    .member-modal__header {
        flex-direction: column;
        text-align: center;
    }
}
