/**
 * WA Elks Directory Styles
 * Light and Dark theme support
 */

/* ============================================
   CSS Variables - Theme Colors
   ============================================ */

:root {
    /* WA State Elks Brand Colors - matches waelks.org */
    --elks-primary: #3e5f82;      /* Site blue (from waelks.org header) */
    --elks-accent: #aa1831;       /* Site red (from waelks.org buttons) */
    --elks-gold: #B8860B;         /* Keep gold for PER badges */

    /* Light Theme (default) */
    --bg-primary: #f8f9fa;        /* Slightly warmer light gray */
    --bg-secondary: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-input: #FFFFFF;
    --text-primary: #2c3e50;      /* Softer dark text */
    --text-secondary: #5a6a7a;
    --text-muted: #8a9aaa;
    --border-color: #dce4ec;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --accent-primary: var(--elks-primary);
    --accent-secondary: var(--elks-accent);
    --link-color: var(--elks-primary);
    --link-hover: var(--elks-accent);
    --button-bg: var(--elks-primary);
    --button-text: #FFFFFF;
    --button-hover: #2d4a66;      /* Darker blue for hover */
    --tag-bg: #e8eef3;
    --tag-text: #3a4a5a;
    --success-color: #28A745;
    --error-color: #DC3545;
}

/* Dark Theme - adjusted to blend with waelks.org blue (#3e5f82) */
[data-theme="dark"] {
    --bg-primary: #1c2d3a;        /* Dark blue-slate */
    --bg-secondary: #243848;      /* Slightly lighter */
    --bg-card: #2c3e4d;           /* Card background */
    --bg-input: #3a4d5e;          /* Input background */
    --text-primary: #e8ecef;
    --text-secondary: #b0bec5;
    --text-muted: #78909c;
    --border-color: #4a6278;      /* Blue-tinted border */
    --shadow-color: rgba(0, 0, 0, 0.3);
    --accent-primary: var(--elks-gold);
    --accent-secondary: var(--elks-primary);
    --link-color: var(--elks-gold);
    --link-hover: #d4a84b;
    --button-bg: var(--elks-gold);
    --button-text: #1c2d3a;
    --button-hover: #d4a84b;
    --tag-bg: #3a4d5e;
    --tag-text: #e0e8ec;
}

/* ============================================
   Base Container
   ============================================ */

.wsea-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-weight: 400 !important;  /* Override Divi bold inheritance */
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 500px;           /* Don't force 100vh */
    padding: 20px;
    padding-bottom: 60px;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
    border-radius: 8px;          /* Rounded corners to fit in */
    margin: 0;                   /* Remove negative margins */
    width: 100%;
    max-width: 1200px;           /* Constrain width */
    margin-left: auto;
    margin-right: auto;
}

.wsea-container * {
    box-sizing: border-box;
}

/* Reset font-weight for all text to prevent Divi bold inheritance */
.wsea-container,
.wsea-container p,
.wsea-container span,
.wsea-container div,
.wsea-container a,
.wsea-container li {
    font-weight: 400 !important;
}

/* Restore intentional bold/semi-bold elements */
.wsea-container .wsea-member-name,
.wsea-container .wsea-header-title,
.wsea-container .wsea-title,
.wsea-container .wsea-filter-btn,
.wsea-container .wsea-member-officer,
.wsea-container .wsea-member-badge,
.wsea-container .wsea-modal-name {
    font-weight: 600 !important;
}

.wsea-container .wsea-position-tag {
    font-weight: 700 !important;
}

/* Prevent text overflow */
.wsea-container a,
.wsea-container span,
.wsea-container div {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* ============================================
   Login Form
   ============================================ */

.wsea-login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 20px;
}

.wsea-login-box {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 40px var(--shadow-color);
    text-align: center;
    transition: all 0.3s ease;
}

.wsea-login-logo {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wsea-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.wsea-login-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text-primary);
}

.wsea-login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 32px;
}

.wsea-password-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wsea-password-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 32, 91, 0.1);
}

[data-theme="dark"] .wsea-password-input:focus {
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.2);
}

.wsea-password-input::placeholder {
    color: var(--text-muted);
}

.wsea-login-button {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    background: var(--button-bg);
    color: var(--button-text);
    cursor: pointer;
    margin-top: 16px;
    transition: all 0.2s ease;
}

.wsea-login-button:hover {
    background: var(--button-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.wsea-login-button:active {
    transform: translateY(0);
}

.wsea-login-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.wsea-login-error {
    color: var(--error-color);
    font-size: 14px;
    margin-top: 16px;
    display: none;
}

.wsea-login-error.visible {
    display: block;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ============================================
   Login Required Message
   ============================================ */

.wsea-login-required {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.wsea-login-required p {
    margin: 0 0 16px;
    color: var(--text-secondary);
}

.wsea-login-required a {
    display: inline-block;
    padding: 12px 24px;
    background: var(--button-bg);
    color: var(--button-text);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
}

.wsea-login-required a:hover {
    background: var(--button-hover);
}

/* ============================================
   Theme Toggle
   ============================================ */

.wsea-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 32px;
    font-size: 14px;
    color: var(--text-muted);
}

.wsea-theme-switch {
    position: relative;
    width: 56px;
    height: 28px;
    background: var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.wsea-theme-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .wsea-theme-switch {
    background: var(--accent-primary);
}

[data-theme="dark"] .wsea-theme-switch::after {
    transform: translateX(28px);
}

/* ============================================
   Directory Header
   ============================================ */

.wsea-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 20px !important;
    background: var(--bg-card) !important;
    background-color: var(--bg-card) !important;
    border-radius: 12px !important;
    margin-bottom: 16px !important;
    box-shadow: 0 2px 8px var(--shadow-color) !important;
}

/* Theme-specific header backgrounds */
[data-theme="dark"] .wsea-header,
.wsea-container[data-theme="dark"] .wsea-header {
    background: #2c3e4d !important;
    background-color: #2c3e4d !important;
}

[data-theme="light"] .wsea-header,
.wsea-container[data-theme="light"] .wsea-header {
    background: #FFFFFF !important;
    background-color: #FFFFFF !important;
}

.wsea-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.wsea-header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-primary);
    margin: 0;
    padding: 0;
    white-space: nowrap;
    line-height: 1;
    display: flex;
    align-items: center;
}

.wsea-header-logo-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.wsea-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Column selector dropdown */
.wsea-column-selector {
    display: none;  /* Hidden by default, shown on wide screens */
}

.wsea-column-select {
    padding: 6px 10px !important;
    font-size: 12px !important;
    font-weight: 400 !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    cursor: pointer !important;
    outline: none !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.wsea-column-select:hover {
    border-color: var(--accent-primary) !important;
}

.wsea-column-select option {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* Show column selector only on wide screens (3+ columns possible) */
@media (min-width: 1050px) {
    .wsea-column-selector {
        display: block;
    }
}

.wsea-logout-btn {
    padding: 6px 12px;
    font-size: 13px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.wsea-logout-btn:hover {
    border-color: var(--error-color);
    color: var(--error-color);
}

.wsea-header-theme-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 18px;
    cursor: pointer;
}

/* ============================================
   Search Section
   ============================================ */

.wsea-search-section {
    background: var(--bg-card) !important;
    background-color: var(--bg-card) !important;
    border-radius: 12px !important;
    padding: 16px !important;
    margin-bottom: 16px !important;
    box-shadow: 0 2px 8px var(--shadow-color) !important;
}

/* Theme-specific search section backgrounds */
[data-theme="dark"] .wsea-search-section,
.wsea-container[data-theme="dark"] .wsea-search-section {
    background: #2c3e4d !important;
    background-color: #2c3e4d !important;
}

[data-theme="light"] .wsea-search-section,
.wsea-container[data-theme="light"] .wsea-search-section {
    background: #FFFFFF !important;
    background-color: #FFFFFF !important;
}

.wsea-search-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.wsea-search-wrapper {
    position: relative;
    flex: 1;
}

.wsea-filters-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.wsea-filters-toggle:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.wsea-filters-toggle.collapsed .wsea-filters-toggle-icon {
    transform: rotate(-90deg);
}

.wsea-filters-toggle-icon {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 12px;
}

.wsea-search-icon {
    position: absolute !important;
    left: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 18px !important;
    color: var(--text-muted) !important;
    pointer-events: none !important;
    z-index: 1;
    line-height: 1 !important;
}

.wsea-search-input {
    width: 100% !important;
    padding: 16px 20px 16px 46px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 12px !important;
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    outline: none !important;
    transition: all 0.2s ease;
}

.wsea-search-input:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px rgba(0, 32, 91, 0.1) !important;
}

/* Dark theme search input - aggressive overrides for Divi compatibility */
[data-theme="dark"] .wsea-search-input,
[data-theme="dark"] .wsea-search-input:focus,
[data-theme="dark"] .wsea-search-input:hover,
[data-theme="dark"] input.wsea-search-input,
[data-theme="dark"] input.wsea-search-input[type="text"],
.wsea-container[data-theme="dark"] .wsea-search-input,
.wsea-container[data-theme="dark"] input.wsea-search-input,
.wsea-container[data-theme="dark"] input[type="text"].wsea-search-input,
.wsea-search-section input.wsea-search-input,
.wsea-search-wrapper input.wsea-search-input,
.wsea-search-wrapper input[type="text"] {
    background: #3a4d5e !important;
    background-color: #3a4d5e !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

[data-theme="dark"] .wsea-search-input:focus {
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.2) !important;
}

/* Light theme search input */
[data-theme="light"] .wsea-search-input,
[data-theme="light"] input.wsea-search-input,
[data-theme="light"] input.wsea-search-input[type="text"],
.wsea-container[data-theme="light"] .wsea-search-input,
.wsea-container[data-theme="light"] input.wsea-search-input {
    background: #FFFFFF !important;
    background-color: #FFFFFF !important;
    color: #000000 !important;
    font-weight: 600 !important;
}

.wsea-search-input::placeholder {
    color: var(--text-muted) !important;
    font-weight: 400 !important;
}

/* Dark mode: muted white placeholder text */
[data-theme="dark"] .wsea-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
    font-weight: 400 !important;
}

/* Light mode: muted black placeholder text */
[data-theme="light"] .wsea-search-input::placeholder {
    color: rgba(0, 0, 0, 0.5) !important;
    font-weight: 400 !important;
}

/* Extra specificity for theme overrides on inputs */
.wsea-container input.wsea-search-input,
.wsea-container .wsea-search-wrapper input,
.wsea-container .wsea-search-section input {
    border: 2px solid var(--border-color) !important;
    border-radius: 12px !important;
    padding: 16px 20px 16px 46px !important;
}

.wsea-search-clear {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--tag-bg);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.wsea-search-clear.visible {
    display: flex;
}

/* ============================================
   Filters
   ============================================ */

.wsea-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
    transition: all 0.2s ease;
}

.wsea-filters.collapsed {
    display: none;
}

.wsea-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wsea-filter-dropdowns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.wsea-filter-btn {
    padding: 8px 16px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.wsea-filter-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.wsea-filter-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Native select - hidden, kept for fallback */
.wsea-filter-select {
    display: none !important;
}

/* ============================================
   Custom Dropdown Component
   ============================================ */

.wsea-custom-dropdown {
    position: relative;
    min-width: 160px;
}

.wsea-custom-dropdown[data-filter="lodge"] {
    min-width: 200px;
}

.wsea-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 38px;
}

.wsea-dropdown-trigger:hover {
    border-color: var(--accent-primary);
}

.wsea-custom-dropdown.open .wsea-dropdown-trigger {
    border-color: var(--accent-primary);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.wsea-dropdown-arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.wsea-custom-dropdown.open .wsea-dropdown-arrow {
    transform: rotate(180deg);
}

.wsea-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: var(--bg-card) !important;
    border: 1px solid var(--accent-primary);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    z-index: 1000;
    display: none;
}

.wsea-custom-dropdown.open .wsea-dropdown-menu {
    display: block;
}

.wsea-dropdown-option {
    padding: 6px 12px;
    font-size: 14px;
    color: var(--text-primary) !important;
    background: var(--bg-card) !important;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border: none;
    text-align: left;
    width: 100%;
}

.wsea-dropdown-option:hover,
.wsea-dropdown-option.highlighted {
    background: var(--accent-primary) !important;
    color: white !important;
}

.wsea-dropdown-option.selected {
    background: var(--tag-bg) !important;
    color: var(--text-primary) !important;
    font-weight: 500;
}

.wsea-dropdown-option.selected:hover,
.wsea-dropdown-option.selected.highlighted {
    background: var(--accent-primary) !important;
    color: white !important;
}

.wsea-dropdown-option.hidden {
    display: none;
}

/* Dark theme specific overrides for dropdown */
[data-theme="dark"] .wsea-dropdown-trigger {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .wsea-dropdown-menu {
    background: var(--bg-card) !important;
}

[data-theme="dark"] .wsea-dropdown-option {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .wsea-dropdown-option:hover,
[data-theme="dark"] .wsea-dropdown-option.highlighted {
    background: var(--accent-primary) !important;
    color: #1c2d3a !important;
}

[data-theme="dark"] .wsea-dropdown-option.selected {
    background: var(--tag-bg) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .wsea-dropdown-option.selected:hover,
[data-theme="dark"] .wsea-dropdown-option.selected.highlighted {
    background: var(--accent-primary) !important;
    color: #1c2d3a !important;
}

/* ============================================
   Results Section
   ============================================ */

.wsea-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.wsea-results-count {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

.wsea-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Column selector overrides - fill width, with responsive fallbacks */
.wsea-container[data-columns="1"] .wsea-results-grid {
    grid-template-columns: 1fr;
}

.wsea-container[data-columns="2"] .wsea-results-grid {
    grid-template-columns: repeat(2, 1fr);
}

.wsea-container[data-columns="3"] .wsea-results-grid {
    grid-template-columns: repeat(3, 1fr);
}

/* Responsive fallbacks for fixed column settings */
@media (max-width: 1050px) {
    .wsea-container[data-columns="3"] .wsea-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 680px) {
    .wsea-container[data-columns="2"] .wsea-results-grid,
    .wsea-container[data-columns="3"] .wsea-results-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Member Cards
   ============================================ */

.wsea-member-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    padding-bottom: 36px; /* Extra space for the hint */
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
    position: relative;
}

.wsea-member-card.has-photo {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.wsea-member-photo {
    flex-shrink: 0;
    width: 80px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-input);
    border: 2px solid var(--accent-primary);
}

.wsea-member-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wsea-member-content {
    flex: 1;
    min-width: 0;
    text-align: left !important;
}

/* Force left alignment on card text elements to override theme CSS */
.wsea-member-content .wsea-member-title,
.wsea-member-content .wsea-member-officer,
.wsea-member-content .wsea-member-committees,
.wsea-member-content .wsea-matched-positions,
.wsea-member-content .wsea-member-lodge,
.wsea-member-content .wsea-member-contact-info,
.wsea-member-content .wsea-contact-item {
    text-align: left !important;
}

.wsea-member-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow-color);
    border-color: var(--accent-primary);
}

.wsea-member-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.wsea-member-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.wsea-spouse-name {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
}

.wsea-member-title {
    font-size: 14px;
    color: var(--accent-primary);
    font-weight: 500;
    margin-top: 4px;
    text-align: left;
}

.wsea-member-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    background: var(--tag-bg);
    color: var(--tag-text);
}

.wsea-member-badge.per {
    background: var(--elks-gold);
    color: #1A1A1A;
}

.wsea-member-badge.pger {
    background: linear-gradient(135deg, #6b2a2a, #8b3a3a);
    color: white;
    font-weight: 700;
}

.wsea-member-badge.psp {
    background: linear-gradient(135deg, #4B0082, #6B238E);
    color: white;
}

.wsea-member-badge.pddger {
    background: #2E8B57;
    color: white;
}

.wsea-member-badge.dd {
    background: #228B22;
    color: white;
}

.wsea-member-badge.er {
    background: var(--elks-primary);
    color: white;
}

.wsea-member-badge.state {
    background: var(--elks-primary);
    color: white;
}

.wsea-member-badge-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: contain;
    flex-shrink: 0;
}

.wsea-member-lodge {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wsea-member-contact {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.wsea-member-contact-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 15px;
}

.wsea-member-officer {
    font-size: 15px;
    color: var(--accent-primary);
    font-weight: 600;
    margin-bottom: 4px;
    text-align: left;
}

.wsea-member-committees {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-align: left;
}

.wsea-matched-positions {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--tag-bg);
    padding: 6px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    text-align: left;
}

.wsea-card-hint {
    font-size: 11px;
    color: var(--text-muted);
    position: absolute;
    bottom: 12px;
    right: 16px;
    opacity: 0.6;
}

.wsea-contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wsea-contact-item a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.wsea-contact-item a:hover {
    color: var(--accent-primary);
}

.wsea-contact-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.wsea-contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    text-decoration: none;
    border-radius: 6px;
    background: var(--tag-bg);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.wsea-contact-btn:hover {
    background: var(--accent-primary);
    color: white;
}

.wsea-contact-btn.phone {
    background: var(--success-color);
    color: white;
}

.wsea-contact-btn.phone:hover {
    background: #218838;
}

.wsea-contact-btn.email {
    background: var(--accent-primary);
    color: white;
}

.wsea-contact-btn.email:hover {
    background: var(--button-hover);
}

/* ============================================
   Member Detail Modal
   ============================================ */

.wsea-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
    box-sizing: border-box;
}

.wsea-modal-overlay.visible {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.wsea-modal {
    background: var(--bg-card);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    margin: auto;
    box-sizing: border-box;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.wsea-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.wsea-modal-close {
    background: var(--tag-bg);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.wsea-modal-close:hover {
    background: var(--error-color);
    color: white;
}

.wsea-modal-name {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text-primary);
}

.wsea-modal-title {
    font-size: 14px;
    color: var(--accent-primary);
    font-weight: 500;
}

.wsea-modal-body {
    padding: 24px;
}

.wsea-modal-section {
    margin-bottom: 24px;
}

.wsea-modal-section:last-child {
    margin-bottom: 0;
}

.wsea-modal-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.wsea-modal-info-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 15px;
}

.wsea-modal-info-row:last-child {
    margin-bottom: 0;
}

.wsea-modal-info-icon {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
}

.wsea-modal-info-value {
    color: var(--text-primary);
}

.wsea-modal-info-value a {
    color: var(--link-color);
    text-decoration: none;
}

.wsea-modal-info-value a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.wsea-modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wsea-modal-tag {
    padding: 6px 12px;
    font-size: 13px;
    background: var(--tag-bg);
    color: var(--tag-text);
    border-radius: 6px;
}

.wsea-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.wsea-modal-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.wsea-modal-action-btn.call {
    background: var(--success-color);
    color: white;
}

.wsea-modal-action-btn.call:hover {
    background: #218838;
}

.wsea-modal-action-btn.email {
    background: var(--accent-primary);
    color: white;
}

.wsea-modal-action-btn.email:hover {
    background: var(--button-hover);
}

/* ============================================
   Modal Dark Mode
   ============================================ */

/* Dark mode modal - uses :has() to detect theme on container */
body:has(.wsea-container[data-theme="dark"]) .wsea-modal-overlay {
    background: rgba(0, 0, 0, 0.75) !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal {
    background: #2c3e4d !important;
    background-color: #2c3e4d !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-header {
    border-bottom-color: #4a6278 !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-name {
    color: #e8ecef !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-title {
    color: #B8860B !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-close {
    background: #3a4d5e !important;
    background-color: #3a4d5e !important;
    color: #78909c !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-close:hover {
    background: #aa1831 !important;
    background-color: #aa1831 !important;
    color: white !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-section-title {
    color: #78909c !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-info-icon {
    color: #78909c !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-info-value {
    color: #e8ecef !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-info-value a {
    color: #B8860B !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-info-value a:hover {
    color: #d4a84b !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-tag {
    background: #3a4d5e !important;
    background-color: #3a4d5e !important;
    color: #e0e8ec !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-actions {
    border-top-color: #4a6278 !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-action-btn.call {
    background: #3e5f82 !important;
    background-color: #3e5f82 !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-action-btn.call:hover {
    background: #4a7299 !important;
    background-color: #4a7299 !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-action-btn.email {
    background: #B8860B !important;
    background-color: #B8860B !important;
}

body:has(.wsea-container[data-theme="dark"]) .wsea-modal-action-btn.email:hover {
    background: #d4a84b !important;
    background-color: #d4a84b !important;
}

/* ============================================
   Loading & Empty States
   ============================================ */

.wsea-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    grid-column: 1 / -1;
    text-align: center;
}

.wsea-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

.wsea-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

.wsea-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.wsea-empty-text {
    font-size: 16px;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .wsea-container {
        padding: 10px;
        padding-bottom: 50px;
    }

    .wsea-results-grid {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    .wsea-member-card {
        padding: 16px;
    }

    .wsea-modal {
        margin: 10px;
        max-height: 95vh;
    }

    .wsea-modal-actions {
        flex-direction: column;
    }
}

/* Mobile - show filter toggle, compact layout */
@media (max-width: 600px) {
    .wsea-container {
        padding: 10px;
        padding-bottom: 45px;
        margin: 0;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* Header - always single row */
    .wsea-header {
        padding: 10px 12px;
        border-radius: 8px;
        margin-bottom: 10px;
    }

    .wsea-header-left {
        gap: 8px;
    }

    .wsea-header-logo-img {
        width: 34px;
        height: 34px;
    }

    .wsea-header-title {
        font-size: 14px;
    }

    .wsea-header-actions {
        gap: 8px;
    }

    .wsea-header-theme-toggle {
        font-size: 16px;
    }

    .wsea-logout-btn {
        padding: 5px 10px;
        font-size: 12px;
    }

    /* Search section - compact */
    .wsea-search-section {
        padding: 10px;
        border-radius: 8px;
        margin-bottom: 10px;
    }

    .wsea-search-row {
        gap: 8px;
    }

    /* Show filter toggle on mobile */
    .wsea-filters-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
    }

    .wsea-search-input {
        font-size: 15px !important;
        padding: 12px 36px 12px 40px !important;
        border-radius: 8px !important;
    }

    .wsea-search-icon {
        left: 12px !important;
        font-size: 16px !important;
    }

    .wsea-search-clear {
        right: 10px;
        width: 20px;
        height: 20px;
        font-size: 12px;
    }

    /* Filters - collapsible */
    .wsea-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-top: 10px;
    }

    .wsea-filter-buttons {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        width: 100%;
    }

    .wsea-filter-btn {
        padding: 8px 6px;
        font-size: 12px;
        text-align: center;
        white-space: nowrap;
    }

    /* Dropdowns side by side */
    .wsea-filter-dropdowns {
        display: flex;
        gap: 6px;
        width: 100%;
    }

    .wsea-filter-select {
        flex: 1;
        min-width: 0;
        padding: 8px 28px 8px 10px;
        font-size: 13px;
        background-position: right 8px center;
    }

    /* Custom dropdown mobile styles */
    .wsea-custom-dropdown {
        flex: 1;
        min-width: 0;
    }

    .wsea-dropdown-trigger {
        padding: 8px 10px;
        font-size: 13px;
        min-height: 36px;
    }

    .wsea-dropdown-menu {
        max-height: 200px;
    }

    .wsea-dropdown-option {
        padding: 6px 10px;
        font-size: 13px;
    }

    /* Results count */
    .wsea-results-header {
        margin-bottom: 10px;
    }

    .wsea-results-count {
        font-size: 13px;
    }

    /* Member cards */
    .wsea-member-card {
        padding: 12px;
        padding-bottom: 32px; /* Space for absolutely positioned hint */
        border-radius: 10px;
    }

    .wsea-card-hint {
        bottom: 8px;
        right: 12px;
    }

    .wsea-member-card.has-photo {
        gap: 12px;
    }

    .wsea-member-photo {
        width: 60px;
        height: 75px;
    }

    .wsea-member-header {
        flex-direction: row;
        gap: 8px;
        align-items: flex-start;
        justify-content: space-between;
    }

    .wsea-member-name {
        font-size: 20px;
        word-break: break-word;
        flex: 1;
        min-width: 0;
    }

    .wsea-member-badge {
        flex-shrink: 0;
    }

    .wsea-spouse-name {
        font-size: 15px;
        display: block;
    }

    .wsea-member-badge {
        font-size: 12px;
        padding: 4px 10px;
    }

    .wsea-member-badge-img {
        width: 28px;
        height: 28px;
    }

    .wsea-member-title {
        font-size: 16px;
    }

    .wsea-member-lodge {
        font-size: 16px;
        flex-wrap: wrap;
        margin-bottom: 10px;
    }

    .wsea-member-officer,
    .wsea-member-committees,
    .wsea-matched-positions {
        font-size: 15px;
    }

    .wsea-member-contact-info {
        font-size: 16px;
    }

    .wsea-contact-item {
        flex-wrap: wrap;
    }

    .wsea-contact-item a {
        word-break: break-all;
    }

    .wsea-card-hint {
        font-size: 13px;
        margin-top: 8px;
    }

    /* Login form */
    .wsea-login-box {
        padding: 28px 20px;
        border-radius: 12px;
    }

    .wsea-login-logo {
        width: 70px;
        height: 70px;
        margin-bottom: 16px;
    }

    .wsea-login-title {
        font-size: 18px;
    }

    .wsea-login-subtitle {
        font-size: 13px;
        margin-bottom: 24px;
    }

    .wsea-password-input,
    .wsea-login-button {
        padding: 12px 14px;
        font-size: 15px;
    }

    /* Modal */
    .wsea-modal-overlay {
        padding: 10px;
        align-items: center;
        justify-content: center;
    }

    .wsea-modal {
        border-radius: 12px;
        margin: auto;
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        width: 100%;
    }

    .wsea-modal-header {
        padding: 14px 14px 10px;
    }

    .wsea-modal-name {
        font-size: 22px;
        word-break: break-word;
    }

    .wsea-modal-title {
        font-size: 16px;
    }

    .wsea-modal-body {
        padding: 14px;
    }

    .wsea-modal-section-title {
        font-size: 14px;
    }

    .wsea-modal-info-row {
        font-size: 16px;
    }

    .wsea-modal-info-value {
        word-break: break-all;
    }

    .wsea-modal-tag {
        font-size: 13px;
        padding: 5px 10px;
    }

    .wsea-modal-actions {
        flex-direction: column;
        gap: 8px;
        margin-top: 16px;
        padding-top: 16px;
    }

    .wsea-modal-action-btn {
        padding: 14px 18px;
        font-size: 16px;
    }

    /* Footer */
    .wsea-footer {
        font-size: 12px;
        padding: 10px;
    }
}

/* Extra small phones (iPhone SE, etc.) */
@media (max-width: 360px) {
    .wsea-header-title {
        font-size: 12px;
    }

    .wsea-header-logo-img {
        width: 28px;
        height: 28px;
    }

    .wsea-filter-buttons {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }

    .wsea-filter-btn {
        padding: 6px 4px;
        font-size: 12px;
    }

    .wsea-member-name {
        font-size: 18px;
    }

    .wsea-member-title,
    .wsea-member-lodge {
        font-size: 14px;
    }

    .wsea-member-contact-info {
        font-size: 14px;
    }

    .wsea-modal-name {
        font-size: 20px;
    }

    .wsea-modal-info-row {
        font-size: 14px;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .wsea-header-actions,
    .wsea-search-section,
    .wsea-theme-toggle,
    .wsea-modal-overlay,
    .wsea-footer {
        display: none !important;
    }

    .wsea-member-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ============================================
   Footer
   ============================================ */

.wsea-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.5;
}

/* ============================================
   Load More Button
   ============================================ */

.wsea-load-more {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
}

.wsea-load-more-btn {
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 500;
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    background: transparent;
    color: var(--accent-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.wsea-load-more-btn:hover {
    background: var(--accent-primary);
    color: white;
}

.wsea-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
