/* ===============================
   DIRECTORY CARD BASE STYLES
   =============================== */
.directory-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.directory-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ===============================
   IMAGE SECTION
   =============================== */
.directory-card-image {
    flex: 0 0 240px; /* fixed width for image column */
    max-width: 240px;
    overflow: hidden;
    position: relative;
}

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

.directory-card:hover .directory-card-image img {
    transform: scale(1.05);
}

/* ===============================
   CONTENT SECTION
   =============================== */
.directory-card-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Taxonomy badges */
.directory-card-badges {
    margin-bottom: 12px;
}

.taxonomy-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #fff;
    margin-right: 6px;
    margin-bottom: 6px;
}

/* Title */

.directory-card-title a {
    text-decoration: none;
    color: #222;
}

.directory-card-title a:hover {
    color: #0073e6;
}

/* Description */
.directory-card-description {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 15px;
}

/* Meta list */
.directory-card-meta {
    list-style: none;
    padding: 0;
    margin: 0 0 15px;
    font-size: 13px;
    color: #666;
}

.directory-card-meta li {
    margin-bottom: 5px;
}

/* Actions */
.directory-card-actions {
    margin-top: auto; /* push to bottom */
}

.directory-card-actions .btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
    font-weight: 600;
    margin-right: 8px;
    transition: background 0.2s ease;
}

.btn-primary-detail {
    background: #0073e6;
    color: #fff;
}

.btn-primary-detail:hover {
    background: #005bb5;
}

.btn-secondary-detail {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary-detail:hover {
    background: #ccc;
}

#directory-items-grid .no-results{
    text-align: center;
}

a#clear-filters{
    margin-left: 35px;
}

/* ===============================
   DIRECTORY HEADER WITH FILTERS AND VIEW TOGGLE
   =============================== */
.directory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 25px;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border: 1px solid #e8e8e8;
    min-height: 70px;
}

.active-filters-container {
    flex: 1;
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: none;
    padding: 0;
    margin: 0;
    border: none;
    box-shadow: none;
    min-height: auto;
}

.active-filters:empty {
    display: block;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    background: #f5f5f5;
    color: #666;
    padding: 8px 16px 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    gap: 8px;
    margin: 0;
    position: relative;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.filter-tag:hover {
    background: #eeeeee;
    border-color: #d0d0d0;
}

.remove-filter {
    color: #999;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    margin-left: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.remove-filter:hover {
    color: #666;
    background: rgba(0,0,0,0.1);
}

/* Legacy filter tag remove button support */
.filter-tag-remove {
    color: #999;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.filter-tag-remove:hover {
    opacity: 1;
    color: #666;
    background: rgba(0,0,0,0.1);
}

/* View Toggle Button */
.view-toggle {
    background: transparent;
    border-radius: 6px;
    padding: 0;
    border: none;
    display: flex;
    gap: 4px;
}

.view-btn {
    background: #ffffff;
    border: 1px solid #d0d0d0;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover {
    background: #f8f9fa;
    color: #333;
    border-color: #bbb;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.view-btn.active {
    background: #8b2635;
    color: #ffffff;
    border-color: #8b2635;
    box-shadow: 0 2px 6px rgba(139, 38, 53, 0.25);
}

.view-btn.active:hover {
    background: #7a2030;
    border-color: #7a2030;
    color: #ffffff;
}

.view-btn svg {
    width: 18px;
    height: 18px;
}

/* Grid view button (if you add one later) */
.view-btn[data-view="grid"] svg {
    width: 16px;
    height: 16px;
}

/* Responsive for directory header */
@media (max-width: 768px) {
    .directory-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
        padding: 20px;
    }
    
    .view-toggle {
        align-self: flex-end;
    }
    
    .active-filters {
        width: 100%;
    }
}

/* Responsive for directory header */
@media (max-width: 768px) {
    .directory-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .view-toggle {
        align-self: flex-end;
    }
}

/* Loading Spinner */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #6a6a6a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading state improvements - no background */
#directory-loading {
    background: none;
    border: none;
    box-shadow: none;
}

#directory-loading p {
    color: #6a6a6a;
    font-size: 14px;
    margin: 0;
}

/* Hide no results when loading */
#directory-items-grid.loading .no-results,
#directory-items-grid.loading .error {
    display: none !important;
}

/* ===============================
   DIRECTORY PAGINATION STYLING (SCOPED)
   =============================== */

#directory-items-grid .pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0 20px;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e8e8e8;
    flex-wrap: wrap;
    gap: 8px;
}

/* Base styling for all page numbers (both <a> and <span>) */
#directory-items-grid .pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    min-width: 44px;
    height: 44px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    transition: all 0.2s ease;
    margin: 0 2px;
    box-sizing: border-box;
}

/* Hover state (only for links, not spans) */

#directory-items-grid .pagination a.page-numbers:hover {
    background: #f8f9fa;
    border-color: #bbb;
    color: #333;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-decoration: none;
}

/* Current page styling (applies to <span> elements) */

#directory-items-grid .pagination .page-numbers.current {
    background: #8b2635 !important;
    color: #ffffff !important;
    border-color: #8b2635 !important;
    box-shadow: 0 2px 6px rgba(139, 38, 53, 0.25) !important;
    font-weight: 600 !important;
    cursor: default;
}

/* Current page hover (shouldn't change much since it's not clickable) */

#directory-items-grid .pagination .page-numbers.current:hover {
    background: #8b2635 !important;
    border-color: #8b2635 !important;
    color: #ffffff !important;
}


#directory-items-grid .pagination .page-numbers.next {
    padding: 10px 18px;
    font-weight: 600;
}

#directory-items-grid .pagination .page-numbers.prev:before {
    content: "← ";
    margin-right: 4px;
}

#directory-items-grid .pagination .page-numbers.next:after {
    content: " →";
    margin-left: 4px;
}


#directory-items-grid .pagination .page-numbers.dots {
    background: transparent;
    border: none;
    color: #999;
    cursor: default;
    box-shadow: none;
}

#directory-items-grid .pagination .page-numbers.dots:hover {
    background: transparent;
    border: none;
    color: #999;
    box-shadow: none;
}

/* Responsive pagination - scoped */
@media (max-width: 768px) {
    
    #directory-items-grid .pagination {
        padding: 15px 10px;
        gap: 4px;
    }
    
    #directory-items-grid .pagination .page-numbers {
        padding: 8px 12px;
        min-width: 36px;
        height: 36px;
        font-size: 13px;
        margin: 0 1px;
    }
    #directory-items-grid .pagination .page-numbers.prev,
    #directory-items-grid .pagination .page-numbers.next {
        padding: 8px 14px;
    }
}

@media (max-width: 480px) {
    #directory-items-grid .pagination .page-numbers {
        padding: 6px 10px;
        min-width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    /* Hide some page numbers on very small screens */
    #directory-items-grid .pagination .page-numbers:not(.current):not(.prev):not(.next):not(.dots) {
        display: none;
    }
    #directory-items-grid .pagination .page-numbers.next {
        display: inline-flex;
    }
}

/* ===============================
   RESPONSIVE LAYOUT
   =============================== */
@media (max-width: 768px) {
    .directory-card {
        flex-direction: column;
    }
    .directory-card-image {
        flex: 0 0 auto;
        max-width: 100%;
        height: 200px;
    }
}