/**
 * Public Directory Engine & Taxonomy Filtering Styling
 *
 * Provides modern responsive CSS Grid layout, 4:5 portrait cards, tier gradient borders,
 * verified trust badges, contact action buttons, and faceted mobile filter drawer.
 *
 * @package Agency_Profile_Core
 */

/* ==========================================================================
   Directory Container & Layout
   ========================================================================== */

.agency-directory-container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #1e293b;
    box-sizing: border-box;
}

.agency-directory-container * {
    box-sizing: border-box;
}

/* ==========================================================================
   Faceted Search & Filter Bar
   ========================================================================== */

.agency-directory-filter-wrapper {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    padding: 16px;
    margin-bottom: 28px;
}

.agency-filter-toggle-btn {
    display: none;
    width: 100%;
    min-height: 44px;
    padding: 12px 16px;
    background: #0f172a;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.agency-filter-bar-primary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.agency-filter-group {
    flex: 1 1 160px;
}

.agency-filter-search {
    flex: 2 1 240px;
}

.agency-filter-group input[type="text"],
.agency-filter-group select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    background: #f8fafc;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.agency-filter-group input[type="text"]:focus,
.agency-filter-group select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: #ffffff;
}

/* Verified Only Toggle Switch */
.agency-filter-verified-toggle {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.agency-switch-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    font-weight: 600;
    color: #1e40af;
    background: #eff6ff;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #bfdbfe;
}

.agency-switch-label input[type="checkbox"] {
    cursor: pointer;
}

/* Secondary Filter Row */
.agency-filter-bar-secondary {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.agency-services-details {
    flex: 1 1 100%;
}

.agency-services-summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    padding: 6px 0;
    user-select: none;
}

.agency-services-active-count {
    color: #2563eb;
    margin-left: 4px;
}

.agency-services-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    padding: 12px 0 6px;
}

.agency-service-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
}

.agency-age-range-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #475569;
    font-weight: 500;
}

.agency-range-input {
    width: 64px !important;
    padding: 6px 8px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    text-align: center;
}

.agency-filter-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.agency-btn-apply {
    background: #0f172a !important;
    color: #ffffff !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    cursor: pointer;
}

.agency-btn-reset {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    cursor: pointer;
}

/* Active Filter Chips */
.agency-active-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.agency-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e0e7ff;
    color: #3730a3;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
}

.agency-chip-remove {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.agency-chip-remove:hover {
    color: #312e81;
}

/* ==========================================================================
   Profiles Grid & Loading States
   ========================================================================== */

.agency-profiles-grid-wrapper {
    position: relative;
    min-height: 200px;
}

.agency-grid-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agency-loader-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: agencySpin 0.7s linear infinite;
}

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

.agency-profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 22px;
}

.agency-no-profiles-found {
    grid-column: 1 / -1;
    padding: 48px 24px;
    text-align: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    color: #64748b;
    font-size: 16px;
}

/* ==========================================================================
   Standardized 4:5 Profile Card Component
   ========================================================================== */

.agency-profile-card {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
}

.agency-profile-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

/* Tier Border Variations */
.agency-card-tier-diamond {
    border: 2px solid transparent;
    background: linear-gradient(#ffffff, #ffffff) padding-box, linear-gradient(135deg, #0ea5e9, #8b5cf6) border-box;
    box-shadow: 0 0 16px rgba(14, 165, 233, 0.22);
}

.agency-card-tier-gold {
    border: 2px solid transparent;
    background: linear-gradient(#ffffff, #ffffff) padding-box, linear-gradient(135deg, #f59e0b, #fbbf24) border-box;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.2);
}

.agency-card-tier-premium {
    border: 2px solid #8b5cf6;
}

.agency-card-tier-standard {
    border: 1px solid #e2e8f0;
}

/* 4:5 Aspect Ratio Media Container */
.agency-card-media-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: #0f172a;
}

.agency-card-image-link {
    display: block;
    width: 100%;
    height: 100%;
}

.agency-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.agency-profile-card:hover .agency-card-img {
    transform: scale(1.04);
}

.agency-card-no-photo {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-size: 36px;
    background: #1e293b;
}

/* Top Badges (Tier & Featured) */
.agency-card-top-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 2;
}

.agency-card-badge-tier {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.agency-badge-diamond {
    background: linear-gradient(135deg, #0284c7, #7c3aed);
}

.agency-badge-gold {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

.agency-badge-premium {
    background: #7c3aed;
}

.agency-card-badge-featured {
    background: #eab308;
    color: #ffffff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    margin-left: auto;
}

/* Verified Badge Overlay */
.agency-card-verified-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(30, 64, 175, 0.88);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #ffffff;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
}

.agency-verified-svg {
    fill: #ffffff;
}

/* Online Indicator Dot */
.agency-card-online-status {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 2;
}

.agency-online-dot {
    width: 11px;
    height: 11px;
    background: #22c55e;
    border: 2px solid #ffffff;
    border-radius: 50%;
    display: block;
    box-shadow: 0 0 8px #22c55e;
    animation: agencyOnlinePulse 2.2s infinite ease-in-out;
}

@keyframes agencyOnlinePulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.agency-no-photo-svg {
    stroke: #64748b;
    opacity: 0.7;
}

/* Card Content Area */
.agency-card-content {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex-grow: 1;
}

.agency-card-header-row {
    margin: 0;
}

.agency-card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.agency-card-title a,
.agency-card-title-link {
    color: #0f172a;
    text-decoration: none;
    transition: color 0.2s ease;
}

.agency-card-title a:hover,
.agency-card-title-link:hover {
    color: #2563eb;
}

.agency-card-age {
    font-weight: 500;
    color: #64748b;
    font-size: 14px;
}

/* Geo Row: Location and Nationality */
.agency-card-geo-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    font-size: 12px;
    color: #64748b;
}

.agency-card-location,
.agency-card-nationality {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.agency-card-geo-icon {
    flex-shrink: 0;
    stroke: #94a3b8;
}

/* Relevant Services Micro-Pills */
.agency-card-services-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.agency-card-service-pill {
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
    line-height: 1.35;
}

.agency-card-service-more {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    padding: 1px 4px;
    border-radius: 3px;
    background: #e2e8f0;
    cursor: default;
}

/* Rate Display Row */
.agency-card-rate-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 4px;
}

.agency-card-starting-rate {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.agency-card-starting-rate .rate-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
}

.agency-card-starting-rate .rate-val {
    font-weight: 800;
    color: #0f172a;
    font-size: 15px;
}

.agency-card-rate-placeholder {
    height: 18px;
}

/* Contact Action Shortcuts */
.agency-card-action-shortcuts {
    display: flex;
    gap: 5px;
    margin-top: 6px;
}

.agency-action-btn {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    line-height: 1.2;
}

.agency-action-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.agency-action-svg {
    flex-shrink: 0;
}

.agency-btn-whatsapp {
    background: #22c55e;
    color: #ffffff;
}

.agency-btn-call {
    background: #0284c7;
    color: #ffffff;
}

.agency-btn-telegram {
    background: #0088cc;
    color: #ffffff;
}

.agency-btn-profile {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.agency-btn-profile:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Card Focus and Accessibility States */
.agency-action-btn:focus-visible,
.agency-card-title-link:focus-visible,
.agency-card-image-link:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
}

/* ==========================================================================
   Featured Spotlight Showcase / Horizontal Carousel
   ========================================================================== */

.agency-spotlight-wrapper {
    margin-bottom: 32px;
    padding: 16px;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    border-radius: 16px;
    color: #ffffff;
}

.agency-spotlight-header {
    margin-bottom: 16px;
}

.agency-spotlight-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #f8fafc;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.agency-spotlight-star {
    color: #f59e0b;
}

.agency-spotlight-carousel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 12px;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
}

.agency-card-spotlight {
    flex: 0 0 220px;
    scroll-snap-align: start;
}

/* ==========================================================================
   Pagination Component
   ========================================================================== */

.agency-directory-pagination {
    margin-top: 32px;
    display: flex;
    justify-content: center;
}

.agency-pagination-nav {
    display: inline-block;
}

.agency-pagination-list {
    display: flex;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.agency-page-link {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #1e293b;
    padding: 7px 13px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transition: background 0.2s, border-color 0.2s;
}

.agency-page-link:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.agency-page-item.active .agency-page-link {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
}

.agency-page-dots {
    padding: 0 6px;
    color: #94a3b8;
}

/* ==========================================================================
   Directory Status Bar & Results Counter
   ========================================================================== */
.agency-directory-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 4px;
}

.agency-results-count {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--agency-text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Clear All Filter Chip */
.agency-chip-clear-all {
    background: transparent;
    border: 1px dashed rgba(244, 63, 94, 0.4);
    color: #f43f5e;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 4px;
}

.agency-chip-clear-all:hover {
    background: rgba(244, 63, 94, 0.1);
    border-color: #f43f5e;
}

/* Mobile Toggle Count Badge */
.agency-toggle-badge {
    background: var(--agency-primary, #38bdf8);
    color: #0b0f19;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 9999px;
    line-height: 1;
    margin-left: 4px;
}

/* Drawer Header (Desktop Hidden) */
.agency-drawer-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.agency-drawer-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
}

.agency-drawer-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.agency-drawer-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* Drawer Backdrop Overlay */
.agency-filter-drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.agency-filter-drawer-backdrop.is-active {
    display: block;
    opacity: 1;
}

/* ==========================================================================
   Luxury Empty State Card
   ========================================================================== */
.agency-no-profiles-card {
    grid-column: 1 / -1;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 60px 24px;
    text-align: center;
    max-width: 540px;
    margin: 40px auto;
}

.agency-empty-icon-box {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.1);
    color: var(--agency-primary, #38bdf8);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.agency-empty-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 10px;
}

.agency-empty-desc {
    font-size: 0.9375rem;
    color: var(--agency-text-muted, #94a3b8);
    line-height: 1.6;
    margin: 0 0 24px;
}

.agency-empty-reset-btn {
    padding: 10px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
}

/* ==========================================================================
   Responsive Breakpoints & Slide-Out Mobile Drawer
   ========================================================================== */

@media (max-width: 768px) {
    .agency-filter-toggle-btn {
        display: inline-flex;
    }

    .agency-filter-form {
        position: fixed;
        top: 0;
        right: 0;
        width: 320px;
        max-width: 88vw;
        height: 100vh;
        height: 100dvh;
        background: #0f172a;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
        z-index: 1002;
        padding: 24px;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        display: block !important;
    }

    .agency-filter-form.agency-drawer-open {
        transform: translateX(0);
    }

    .agency-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 20px;
        padding-bottom: 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .agency-drawer-close-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 8px;
        color: #ffffff;
        font-size: 1.5rem;
        line-height: 1;
        cursor: pointer;
        transition: background 0.2s;
    }

    .agency-drawer-close-btn:hover,
    .agency-drawer-close-btn:focus-visible {
        background: rgba(255, 255, 255, 0.15);
        border-color: #38bdf8;
    }

    .agency-filter-bar-primary {
        flex-direction: column;
        gap: 14px;
    }

    .agency-filter-group {
        width: 100%;
        flex: 1 1 100%;
    }

    .agency-filter-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
    }

    .agency-filter-actions .button {
        width: 100%;
    }

    .agency-profiles-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 14px;
    }

    .agency-card-title {
        font-size: 14px;
    }

    .agency-action-btn {
        font-size: 10px;
        padding: 5px 2px;
    }
}

@media (max-width: 480px) {
    .agency-directory-container {
        padding: 16px 10px;
    }

    .agency-profiles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .agency-profile-card {
        border-radius: 8px;
    }

    .agency-card-content,
    .agency-card-info {
        padding: 8px 8px 10px;
        gap: 4px;
    }

    .agency-card-title {
        font-size: 0.88rem;
        line-height: 1.25;
    }

    .agency-card-geo-row {
        gap: 4px 8px;
        font-size: 11px;
    }

    .agency-card-services-strip {
        display: none;
    }

    .agency-card-starting-rate .rate-val {
        font-size: 13px;
    }

    .agency-card-starting-rate .rate-label {
        font-size: 10px;
    }

    .agency-card-action-shortcuts {
        margin-top: 4px;
        gap: 4px;
    }

    .agency-action-btn {
        font-size: 10px;
        padding: 6px 3px;
        border-radius: 5px;
    }

    .agency-card-top-badges {
        top: 6px;
        left: 6px;
        right: 6px;
    }

    .agency-card-badge-tier {
        padding: 2px 6px;
        font-size: 9px;
    }
}

@media (max-width: 340px) {
    .agency-profiles-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .agency-filter-form {
        width: 100%;
        max-width: 100vw;
    }
}
