/**
 * ARLA Members – Front-end Styles (Sidebar Layout)
 *
 * @package ARLA_Members
 */

/* ── Layout: Sidebar + Main ─────────────────────────────── */
.arla-members-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.arla-members-sidebar {
    flex: 0 0 300px;
    position: sticky;
    top: 20px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 5px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.arla-sidebar-section {
    padding: 20px;
}

.arla-sidebar-section + .arla-sidebar-section {
    border-top: 1px solid #f0f0f0;
}

.arla-sidebar-heading {
    margin: 0 0 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #999;
}

/* ── Domain List ─────────────────────────────────────────── */
.arla-domain-list,
.arla-domain-list li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.arla-domain-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 5px;
    text-decoration: none;
    color: #444;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
    line-height: 1.3;
}

.arla-domain-link:hover {
    background: #f5f7fa;
    color: #222;
    text-decoration: none;
}

.arla-domain-link.arla-active {
    background: #082c72;
    color: #fff;
}

.arla-domain-link.arla-active .arla-domain-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.arla-domain-name {
    flex: 1;
    margin-right: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

.arla-domain-count {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    background: #f0f2f5;
    color: #666;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}

/* ── Sort Buttons ────────────────────────────────────────── */
.arla-sort-buttons {
    display: flex;
    gap: 8px;
}

.arla-sort-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
    color: #555;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}

.arla-sort-btn:hover {
    border-color: #bbb;
    background: #fafafa;
}

.arla-sort-btn.arla-active {
    background: #082c72;
    border-color: #082c72;
    color: #fff;
}

.arla-sort-btn svg {
    flex-shrink: 0;
}

/* ── Main Content ────────────────────────────────────────── */
.arla-members-main {
    flex: 1;
    min-width: 0;
}

/* ── Top Bar (results info + view toggle) ────────────────── */
.arla-members-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    min-height: 24px;
}

.arla-results-info {
    font-size: 14px;
    color: #888;
    font-weight: 500;
}

/* ── Search Field (inside sidebar) ───────────────────────── */
.arla-search-wrap {
    position: relative;
}

.arla-search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    z-index: 1;
}

input.arla-search-input,
.arla-search-input {
    width: 100% !important;
    height: 40px !important;
    padding: 0 36px 0 14px !important;
    border: 1px solid #ddd !important;
    border-radius: 5px !important;
    background: #f9f9fb !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    color: #333 !important;
    line-height: 40px !important;
    outline: none !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.arla-search-input::placeholder {
    color: #aaa;
    font-weight: 400;
}

input.arla-search-input:focus,
.arla-search-input:focus {
    border-color: #082c72 !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(8, 44, 114, 0.08) !important;
}

/* Show clear button instead of icon when there is input */
.arla-search-wrap.has-value .arla-search-icon {
    display: none;
}

.arla-search-clear {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: #e8eaed;
    color: #666;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.arla-search-clear:hover {
    background: #dcdee1;
    color: #333;
}

/* ── View Toggle Buttons ─────────────────────────────────── */
.arla-view-toggle {
    display: flex;
    gap: 4px;
}

.arla-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
    color: #999;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.arla-view-btn:hover {
    color: #555;
    border-color: #bbb;
}

.arla-view-btn.arla-active {
    background: #082c72;
    border-color: #082c72;
    color: #fff;
}

.arla-view-btn svg {
    display: block;
}

/* ── Grid ────────────────────────────────────────────────── */
.arla-members-grid {
    display: grid;
    grid-template-columns: repeat(var(--arla-cols, 3), 1fr);
    gap: 24px;
}

/* ── Card ────────────────────────────────────────────────── */
.arla-member-card {
    background: #fff;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
}

.arla-member-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ── List View ───────────────────────────────────────────── */
.arla-members-grid.arla-list-view {
    grid-template-columns: 1fr !important;
    gap: 16px;
}

.arla-list-view .arla-member-card {
    flex-direction: row;
    align-items: stretch;
}

.arla-list-view .arla-member-card:hover {
    transform: none;
}

.arla-list-view .arla-member-photo {
    flex: 0 0 280px;
    width: 280px;
    aspect-ratio: 16 / 9;
    min-height: auto;
}

.arla-list-view .arla-member-placeholder {
    min-height: auto;
}

.arla-list-view .arla-member-placeholder svg {
    width: 48px;
    height: 48px;
}

.arla-list-view .arla-member-info {
    flex: 1;
    padding: 20px 24px;
    justify-content: center;
}

.arla-list-view .arla-member-name {
    font-size: 20px;
    margin-bottom: 4px;
}

.arla-list-view .arla-member-description {
    margin-bottom: 12px;
}

.arla-list-view .arla-member-social {
    border-top: none;
    padding-top: 0;
}

@media (max-width: 575px) {
    .arla-list-view .arla-member-card {
        flex-direction: column;
    }

    .arla-list-view .arla-member-photo {
        flex: none;
        width: 100%;
        aspect-ratio: 16 / 9;
        min-height: auto;
    }
}

/* ── Photo ───────────────────────────────────────────────── */
.arla-member-photo {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arla-member-photo img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.arla-member-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #adb5bd;
}

/* ── Info ────────────────────────────────────────────────── */
.arla-member-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.arla-member-name {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    color: #222;
    line-height: 1.3;
}

.arla-member-domain {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #082c72;
    margin-bottom: 12px;
}

/* ── Phone ───────────────────────────────────────────────── */
.arla-member-phone {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #555;
}

.arla-member-phone svg {
    flex-shrink: 0;
    color: #082c72;
}

.arla-member-phone a {
    color: #555;
    text-decoration: none;
    transition: color 0.15s ease;
}

.arla-member-phone a:hover {
    color: #082c72;
}

/* ── Email ───────────────────────────────────────────────── */
.arla-member-email {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #555;
}

.arla-member-email svg {
    flex-shrink: 0;
    color: #082c72;
}

.arla-member-email a {
    color: #555;
    text-decoration: none;
    transition: color 0.15s ease;
    word-break: break-all;
}

.arla-member-email a:hover {
    color: #082c72;
}

/* ── Exclusive Offer Badge ───────────────────────────────── */
.arla-member-exclusive-offer {
    margin-bottom: 12px;
}

.arla-exclusive-offer-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    background-color: #082c72;
    border: 2px solid #082c72;
    border-radius: 4px;
    line-height: 1.4;
}

/* ── Website ─────────────────────────────────────────────── */
.arla-member-website {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    margin-bottom: 8px;
    color: #555;
}

.arla-member-website svg {
    flex-shrink: 0;
    color: #082c72;
}

.arla-member-website a {
    color: #555;
    text-decoration: none;
    transition: color 0.15s ease;
    word-break: break-all;
}

.arla-member-website a:hover {
    color: #082c72;
}

.arla-member-description {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 16px;
    flex: 1;
}

.arla-member-description p {
    margin: 0;
}

/* ── Social Icons ────────────────────────────────────────── */
.arla-member-social {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.arla-social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f0f0f0;
    color: #555;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.arla-social-icon:hover {
    transform: scale(1.1);
}

.arla-social-icon svg {
    display: block;
}

/* Platform-specific hover colors */
.arla-social-facebook:hover  { background: #1877f2; color: #fff; }
.arla-social-twitter:hover   { background: #000;    color: #fff; }
.arla-social-instagram:hover { background: #e4405f; color: #fff; }
.arla-social-linkedin:hover  { background: #0a66c2; color: #fff; }
.arla-social-youtube:hover   { background: #ff0000; color: #fff; }
.arla-social-tiktok:hover    { background: #000;    color: #fff; }
.arla-social-github:hover    { background: #333;    color: #fff; }
.arla-social-website:hover   { background: #082c72; color: #fff; }
.arla-social-other:hover     { background: #666;    color: #fff; }

/* ── Loading state ───────────────────────────────────────── */
.arla-members-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 0;
    font-size: 14px;
    color: #999;
}

.arla-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: #082c72;
    border-radius: 50%;
    animation: arla-spin 0.6s linear infinite;
}

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

/* ── No members ──────────────────────────────────────────── */
.arla-no-members {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

/* ── Pagination ──────────────────────────────────────────── */
.arla-members-pagination {
    margin-top: 30px;
    text-align: center;
}

.arla-pagination {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.arla-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
    color: #444;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}

.arla-page-btn:hover:not(:disabled) {
    border-color: #082c72;
    color: #082c72;
    background: #f0f3fa;
}

.arla-page-btn.arla-active {
    background: #082c72;
    border-color: #082c72;
    color: #fff;
    cursor: default;
}

.arla-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.arla-page-btn svg {
    display: block;
}

.arla-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 38px;
    color: #999;
    font-size: 14px;
    user-select: none;
}

/* ── Card cursor (clickable only when modal is enabled) ──── */
.arla-member-card[data-member-id] {
    cursor: pointer;
}

/* ── Body scroll lock when modal or filter panel is open ─── */
body.arla-modal-open {
    position: fixed !important;
    overflow: hidden !important;
    width: 100% !important;
    height: 100% !important;
}

/* ── Modal Overlay ──────────────────────────────────────── */
.arla-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    opacity: 0;
    transition: opacity 0.25s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.arla-modal-overlay.arla-modal-visible {
    opacity: 1;
}

/* ── Modal Box ──────────────────────────────────────────── */
.arla-modal {
    position: relative;
    background: #fff;
    border-radius: 8px;
    max-width: 720px;
    width: 100%;
    max-height: 85vh;
    max-height: 85dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.25s ease;
}

.arla-modal-overlay.arla-modal-visible .arla-modal {
    transform: translateY(0) scale(1);
}

/* ── Modal Close Button ─────────────────────────────────── */
.arla-modal-close {
    position: sticky;
    top: 12px;
    margin-left: auto;
    margin-right: 12px;
    margin-top: 12px;
    margin-bottom: -52px;
    float: right;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #555;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.arla-modal-close:hover {
    background: #fff;
    color: #222;
}

/* ── Modal Loading ──────────────────────────────────────── */
.arla-modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

/* ── Modal Body ─────────────────────────────────────────── */
.arla-modal-body {
    padding: 0;
}

/* ── Modal Member Layout ────────────────────────────────── */
.arla-modal-member {
    display: flex;
    flex-direction: column;
}

.arla-modal-photo {
    width: 100%;
    max-height: 360px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 8px 8px 0 0;
    padding-top: 24px;
}

.arla-modal-photo img {
    max-width: 100%;
    max-height: 360px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.arla-modal-content {
    padding: 28px 32px 32px;
}

.arla-modal-name {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 700;
    color: #222;
    line-height: 1.3;
}

.arla-modal-domain {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #082c72;
    margin-bottom: 16px;
}

.arla-modal-content .arla-member-phone,
.arla-modal-content .arla-member-email,
.arla-modal-content .arla-member-website {
    margin-bottom: 10px;
}

.arla-modal-description {
    font-size: 15px;
    line-height: 1.7;
    color: #444;
    margin-top: 16px;
    margin-bottom: 20px;
}

.arla-modal-description p {
    margin: 0 0 12px;
}

.arla-modal-description p:last-child {
    margin-bottom: 0;
}

.arla-modal-content .arla-member-social {
    margin-top: 20px;
    padding-top: 16px;
}

/* ── Modal Responsive ───────────────────────────────────── */
@media (max-width: 767px) {
    .arla-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .arla-modal {
        max-height: 92vh;
        max-height: 92dvh;
        border-radius: 12px 12px 0 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .arla-modal-content {
        padding: 20px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }

    .arla-modal-name {
        font-size: 22px;
        padding-right: 36px;
    }

    .arla-modal-photo {
        max-height: 240px;
        border-radius: 12px 12px 0 0;
    }

    .arla-modal-photo img {
        max-height: 240px;
    }

    .arla-modal-close {
        top: 8px;
        margin-right: 8px;
        margin-top: 8px;
        margin-bottom: -48px;
    }

    /* Prevent iOS from zooming when the search field is focused. */
    input.arla-search-input,
    .arla-search-input {
        font-size: 16px !important;
    }
}

/* ── Fade transition ─────────────────────────────────────── */
.arla-members-grid.arla-loading {
    opacity: 0.35;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* ── Mobile Filter Toggle (inline in topbar, hidden on desktop) ── */
.arla-mobile-filter-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #082c72;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    line-height: 1;
    white-space: nowrap;
}

.arla-mobile-filter-toggle:hover {
    background: #061f52;
}

.arla-mobile-filter-toggle svg {
    flex-shrink: 0;
}

/* ── Mobile Sidebar Header (hidden on desktop) ──────────── */
.arla-sidebar-mobile-header {
    display: none;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 991px) {
    .arla-members-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .arla-members-sidebar {
        flex: 0 0 260px;
    }
}

@media (max-width: 767px) {
    .arla-members-layout {
        flex-direction: column;
    }

    /* ── Full-screen filter panel ────────────────────────── */
    .arla-members-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        z-index: 100000;
        border-radius: 0;
        border: none;
        box-shadow: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        padding-bottom: 40px;
    }

    .arla-members-sidebar.arla-sidebar-open {
        transform: translateY(0);
    }

    /* ── Mobile header ────────────────────────────────────── */
    .arla-sidebar-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        border-bottom: 1px solid #e8e8e8;
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 2;
    }

    .arla-sidebar-mobile-title {
        font-size: 18px;
        font-weight: 700;
        color: #222;
    }

    .arla-sidebar-mobile-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 50%;
        background: #f0f2f5;
        color: #555;
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease;
        padding: 0;
    }

    .arla-sidebar-mobile-close:hover {
        background: #e0e2e5;
        color: #222;
    }

    .arla-mobile-filter-toggle {
        display: inline-flex !important;
    }

    .arla-members-topbar {
        gap: 10px;
    }

    /* Overlay behind sidebar on mobile */
    .arla-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 99999;
    }

    .arla-sidebar-overlay.arla-visible {
        display: block;
    }

    .arla-members-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575px) {
    .arla-members-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}
