/**
 * Directory Filters - Styles (Updated with Search Box)
 * Place this file in: wp-content/themes/your-child-theme/css/directory-filters.css
 */

/* ============================================
   HIDE DIVI FILTERGRID SEARCH BOX
   ============================================ */
.df-filtercontrols .df-search-wrapper,
.df-filtercontrols input[type="search"],
.df-search-box,
.df-filtercontrols .df-search {
    display: none !important;
}

/* ============================================
   FILTER CONTAINER
   ============================================ */
.directory-filter-container {
    margin: 30px 0;
    background: #fff;
}

.directory-filters {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
}

.directory-filters h3 {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 24px;
    color: #333;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 10px;
}

/* ============================================
   FILTER FORM
   ============================================ */
#directory-filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    align-items: end;
}

/* Search box spans full width */
.filter-search-group {
    grid-column: 1 / -1;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-field {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #fff;
}

/* Special styling for search input */
.filter-search {
    font-size: 16px;
    padding: 14px 20px;
}

.filter-field:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.filter-field:hover {
    border-color: #999;
}

/* ============================================
   FILTER ACTIONS
   ============================================ */
.filter-actions {
    display: flex;
    gap: 10px;
    grid-column: 1 / -1;
    justify-content: flex-start;
    margin-top: 10px;
}

.filter-actions .button {
    padding: 12px 30px;
    font-size: 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.filter-actions .button-primary {
    background: #2271b1;
    color: #fff;
}

.filter-actions .button-primary:hover {
    background: #135e96;
}

.filter-actions .reset-filters {
    background: #f0f0f0;
    color: #555;
}

.filter-actions .reset-filters:hover {
    background: #e0e0e0;
}

/* ============================================
   LOADING INDICATOR
   ============================================ */
.filter-loading {
    text-align: center;
    padding: 20px;
    font-size: 16px;
    color: #666;
}

.filter-loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #2271b1;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
}

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

/* ============================================
   RESULTS CONTAINER
   ============================================ */
.directory-results-container {
    margin-top: 30px;
}

.directory-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 20px;
}

/* ============================================
   DIRECTORY ITEM CARDS
   ============================================ */
.directory-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.directory-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Logo styling */
.directory-logo {
    text-align: center;
    margin-bottom: 15px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.directory-logo img {
    max-width: 150px;
    max-height: 80px;
    height: auto;
    width: auto;
    object-fit: contain;
}

/* Title */
.directory-item h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 20px;
    color: #2271b1;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

/* Subtitle */
.directory-subtitle {
    font-style: italic;
    color: #666;
    font-size: 14px;
    margin-top: 0 !important;
    margin-bottom: 15px !important;
}

/* Field display */
.directory-item p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.6;
}

.directory-item p strong {
    color: #333;
    display: inline-block;
    min-width: 120px;
}

/* Specific field styling */
.directory-contact,
.directory-categories,
.directory-location,
.directory-membership,
.directory-representation {
    padding: 5px 0;
}

.directory-categories,
.directory-representation {
    border-left: 3px solid #2271b1;
    padding-left: 10px;
    margin-left: 5px;
}

.directory-contact-info {
    margin-top: 15px !important;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    font-size: 13px !important;
}

.directory-item a {
    color: #2271b1;
    text-decoration: none;
    transition: color 0.3s ease;
}

.directory-item a:hover {
    color: #135e96;
    text-decoration: underline;
}

/* View More button */
.directory-view-more {
    display: inline-block;
    margin-top: auto;
    padding: 10px 20px;
    background: #2271b1;
    color: #fff !important;
    border-radius: 4px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.3s ease;
    text-align: center;
}

.directory-view-more:hover {
    background: #135e96;
}

/* ============================================
   RESULTS COUNT
   ============================================ */
.directory-count {
    text-align: center;
    padding: 15px;
    background: #f0f0f0;
    border-radius: 4px;
    font-weight: 600;
    color: #555;
    margin-top: 20px;
}

/* ============================================
   NO RESULTS STATE
   ============================================ */
.directory-no-results {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

.directory-no-results p {
    font-size: 16px;
    color: #666;
    margin: 10px 0;
}

/* ============================================
   FILTER COUNT BADGE
   ============================================ */
.filter-count-badge {
    display: inline-block;
    background: #2271b1;
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
    .directory-results {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    #directory-filter-form {
        grid-template-columns: 1fr;
    }
    
    .directory-filters {
        padding: 20px;
    }
    
    .directory-results {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        flex-direction: column;
    }
    
    .filter-actions .button {
        width: 100%;
    }
    
    .directory-item p strong {
        min-width: auto;
        display: block;
    }
}

@media (max-width: 480px) {
    .directory-filters h3 {
        font-size: 20px;
    }
    
    .directory-item {
        padding: 20px;
    }
    
    .directory-item h3 {
        font-size: 18px;
    }
    
    .directory-logo img {
        max-width: 120px;
        max-height: 60px;
    }
}

/* ============================================
   ERROR STATE
   ============================================ */
.error {
    background: #fef5f5;
    border: 1px solid #dc3232;
    color: #dc3232;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */
.filter-field:focus-visible,
.button:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Skip link for keyboard navigation */
.skip-to-results {
    position: absolute;
    top: -40px;
    left: 0;
    background: #2271b1;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-results:focus {
    top: 0;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .directory-filters,
    .filter-loading,
    .directory-view-more {
        display: none;
    }
    
    .directory-item {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
}