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

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

:root {
    /* Elks Brand Colors */
    --elks-navy: #00205B;
    --elks-gold: #B8860B;
    --elks-gold-light: #D4A84B;

    /* Light Theme (default) */
    --bg-primary: #F5F5F5;
    --bg-secondary: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-input: #FFFFFF;
    --text-primary: #1A1A1A;
    --text-secondary: #555555;
    --text-muted: #888888;
    --border-color: #E0E0E0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --accent-primary: var(--elks-navy);
    --accent-secondary: var(--elks-gold);
    --link-color: var(--elks-navy);
    --link-hover: var(--elks-gold);
    --button-bg: var(--elks-navy);
    --button-text: #FFFFFF;
    --button-hover: #003380;
    --tag-bg: #E8E8E8;
    --tag-text: #333333;
    --success-color: #28A745;
    --error-color: #DC3545;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #1A1A2E;
    --bg-secondary: #16213E;
    --bg-card: #1F2A48;
    --bg-input: #2A3550;
    --text-primary: #E8E8E8;
    --text-secondary: #B0B0B0;
    --text-muted: #777777;
    --border-color: #3A4560;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --accent-primary: var(--elks-gold);
    --accent-secondary: var(--elks-navy);
    --link-color: var(--elks-gold);
    --link-hover: var(--elks-gold-light);
    --button-bg: var(--elks-gold);
    --button-text: #1A1A1A;
    --button-hover: var(--elks-gold-light);
    --tag-bg: #2A3550;
    --tag-text: #E0E0E0;
}

/* ============================================
   Full Page Dark Mode Support
   ============================================ */

/* Apply dark background to entire page when directory is in dark mode */
body:has(.waed-container[data-theme="dark"]) {
    background-color: #1A1A2E !important;
}

html:has(.waed-container[data-theme="dark"]) {
    background-color: #1A1A2E !important;
}

/* Fallback for browsers that don't support :has() - use JS to add class */
body.waed-dark-mode {
    background-color: #1A1A2E !important;
}

html.waed-dark-mode {
    background-color: #1A1A2E !important;
}

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

.waed-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    padding-bottom: 60px;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
    margin-left: -20px;
    margin-right: -20px;
    margin-top: 0;
    margin-bottom: 0;
    width: calc(100% + 40px);
    max-width: 100vw;
    overflow-x: hidden;
}

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

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

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

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

.waed-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;
}

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

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

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

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

.waed-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;
}

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

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

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

.waed-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;
}

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

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

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

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

.waed-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); }
}

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

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

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

.waed-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"] .waed-theme-switch {
    background: var(--accent-primary);
}

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

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

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

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

.waed-header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-primary);
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

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

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

.waed-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;
}

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

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

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

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

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

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

.waed-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;
}

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

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

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

.waed-search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

.waed-search-input {
    width: 100%;
    padding: 18px 20px 18px 52px;
    font-size: 18px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
}

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

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

.waed-search-input::placeholder {
    color: var(--text-muted);
}

.waed-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;
}

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

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

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

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

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

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

.waed-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;
}

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

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

.waed-filter-select {
    padding: 8px 32px 8px 12px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

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

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

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

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

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

.waed-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;
}

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

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

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

.waed-member-content {
    flex: 1;
    min-width: 0;
}

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

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

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

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

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

.waed-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);
}

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

.waed-member-badge.pger {
    background: linear-gradient(135deg, #8B0000, #B22222);
    color: white;
    font-weight: 700;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.waed-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;
}

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

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

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

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

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

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

.waed-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;
}

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

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

.waed-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); }
}

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

.waed-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;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.waed-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;
}

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

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

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

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

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

.waed-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;
}

.waed-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); }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    .waed-search-input {
        font-size: 15px;
        padding: 10px 36px 10px 38px;
        border-radius: 8px;
    }

    .waed-search-icon {
        left: 12px;
        font-size: 16px;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.waed-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
   ============================================ */

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

.waed-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;
}

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

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