/**
 * Taxonomy Filter Styles
 * 
 * Provides styling for:
 * - Select dropdown view
 * - Accordion view
 * - Filter buttons
 * - Loading states
 * - Results container
 */

/* ===========================
   Main Filter Container
   =========================== */
.dxp-taxonomy-filter {
    position: relative;
    padding: 2rem;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.dxp-filter-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ===========================
   Filter Sections
   =========================== */
.dxp-filter-section {
    width: 100%;
}

.dxp-filter-field {
    margin-bottom: 1rem;
}

.dxp-filter-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    color: #333;
}

/* ===========================
   Select Dropdown Styles
   =========================== */
.dxp-select-field {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 1rem;
    background-color: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.dxp-select-field:focus {
    outline: none;
    border-color: #e0e0e0; /* Keep original border color */
    box-shadow: none; /* Remove focus shadow */
}

.dxp-select-field[multiple] {
    min-height: 150px;
}

.dxp-select-field option {
    padding: 0.5rem;
}

/* ===========================
   Accordion Styles
   =========================== */
.dxp-accordion-field {
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.dxp-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none; /* Prevent text selection when clicking */
}

.dxp-accordion-header:hover {
    background: #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Subtle hover effect */
}

.dxp-accordion-header.is-open {
    background: #e9ecef;
    border-bottom: 2px solid #e0e0e0;
}

.dxp-accordion-header:active {
    transform: translateY(1px); /* Subtle click feedback */
}

.dxp-accordion-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.dxp-accordion-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.dxp-accordion-toggle:focus {
    outline: none;
}

.dxp-accordion-toggle[aria-expanded="true"] {
    transform: rotate(180deg);
}

.dxp-accordion-icon {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #333;
}

.dxp-accordion-content {
    padding: 1.5rem;
    background: #fff;
}

/* ===========================
   Checkbox List Styles
   =========================== */
.dxp-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dxp-checkbox-item {
    display: flex;
    flex-direction: column;
}

.dxp-checkbox-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    font-weight: normal;
    margin: 0;
}

.dxp-checkbox-item label:hover {
    background: #f8f9fa;
}

.dxp-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.75rem;
    cursor: pointer;
    accent-color: #eb9b6a;
}

.dxp-checkbox-item span {
    font-size: 0.95rem;
    color: #333;
}

/* Hierarchical category styles */
.dxp-checkbox-child {
    margin-left: 1.5rem;
    position: relative;
}

.dxp-checkbox-child::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    width: 0.5rem;
    height: 2px;
    background: #ccc;
}

.dxp-checkbox-level-1 {
    margin-left: 1.5rem;
}

.dxp-checkbox-level-2 {
    margin-left: 3rem;
}

.dxp-checkbox-level-3 {
    margin-left: 4.5rem;
}

.dxp-checkbox-children {
    margin-top: 0.5rem;
}

.dxp-checkbox-parent > label {
    font-weight: 600;
}

/* ===========================
   Filter Actions (Buttons) - HIDDEN for instant filtering
   =========================== */
.dxp-filter-actions {
    display: none; /* Hidden - using instant AJAX filtering */
    gap: 1rem;
    margin-top: 1rem;
}

.dxp-filter-apply-btn,
.dxp-filter-reset-btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dxp-filter-apply-btn {
    background: #eb9b6a;
    color: #fff;
    flex: 1;
}

.dxp-filter-apply-btn:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.dxp-filter-apply-btn:active {
    transform: translateY(0);
}

.dxp-filter-reset-btn {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e0e0e0;
}

.dxp-filter-reset-btn:hover {
    background: #e9ecef;
    border-color: #ccc;
}

/* Optional: Add a reset link if needed */
.dxp-filter-reset-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    color: #666;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.dxp-filter-reset-link:hover {
    color: #eb9b6a;
}

/* ===========================
   Loading State
   =========================== */
.dxp-filter-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.dxp-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #eb9b6a;
    border-radius: 50%;
    animation: dxp-spin 1s linear infinite;
}

@keyframes dxp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.dxp-loading-text {
    font-size: 0.95rem;
    color: #666;
    font-weight: 600;
}

/* ===========================
   Error Messages
   =========================== */
.dxp-filter-error {
    display: none; /* Hidden by default */
    padding: 1rem;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* ===========================
   Query Results Container
   =========================== */
.dxp-filtered-query-loop {
    min-height: 300px;
    transition: opacity 0.3s ease;
}

.dxp-query-results {
    width: 100%;
}

.dxp-no-results {
    text-align: center;
    padding: 3rem 2rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.dxp-no-results p {
    font-size: 1.1rem;
    color: #666;
    margin: 0;
}

/* Results count */
.dxp-results-count {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
}

/* ===========================
   Post Template Styles
   =========================== */
.wp-block-post {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e0e0e0;
}

.wp-block-post:last-child {
    border-bottom: none;
}

.wp-block-post-featured-image {
    margin-bottom: 1rem;
}

.wp-block-post-featured-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.wp-block-post-title {
    margin: 0.5rem 0;
}

.wp-block-post-title a {
    text-decoration: none;
    color: #333;
    transition: color 0.3s ease;
    font-size: 1.5rem;
    font-weight: 600;
}

.wp-block-post-title a:hover {
    color: #eb9b6a;
}

.wp-block-post-date {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: #999;
}

.wp-block-post-date time {
    font-style: italic;
}

.wp-block-post-excerpt {
    margin: 1rem 0;
    color: #666;
    line-height: 1.6;
}

.wp-block-post-categories {
    margin-top: 1rem;
}

.wp-block-post-categories .post-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.wp-block-post-categories a {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 3px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.wp-block-post-categories a:hover {
    background: #eb9b6a;
    color: #fff;
}

/* ===========================
   Pagination Styles
   =========================== */
.wp-block-query-pagination {
    margin-top: 3rem;
    margin-left: auto;
    margin-right: auto;
    padding-top: 2rem;
    border-top: 2px solid #e0e0e0;
    text-align: center;
    display: block;
    width: 100%;
}

/* Force center for nav element specifically */
nav.wp-block-query-pagination {
    text-align: center !important;
}

/* List wrapper */
.wp-block-query-pagination ul.page-numbers,
.wp-block-query-pagination .page-numbers {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 0 auto;
    padding: 0;
    text-align: center;
}

/* Individual pagination items */
.wp-block-query-pagination ul.page-numbers li {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Page number links and current page */
.wp-block-query-pagination .page-numbers a,
.wp-block-query-pagination .page-numbers span,
.wp-block-query-pagination .page-numbers .current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Remove focus outline from all pagination links */
.wp-block-query-pagination .page-numbers a:focus,
.wp-block-query-pagination .page-numbers span:focus,
.wp-block-query-pagination .page-numbers .current:focus {
    outline: none;
}

/* Hover state for links */
.wp-block-query-pagination .page-numbers a:hover {
    background: #eb9b6a;
    border-color: #eb9b6a;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 115, 170, 0.2);
}

/* Current/active page */
.wp-block-query-pagination .page-numbers .current,
.wp-block-query-pagination .page-numbers span.current {
    background: #eb9b6a;
    color: #fff;
    border-color: #eb9b6a;
    font-weight: 600;
    cursor: default;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.3);
}

/* Dots/ellipsis */
.wp-block-query-pagination .page-numbers .dots {
    border: none;
    background: none;
    cursor: default;
    min-width: auto;
    font-weight: 600;
}

.wp-block-query-pagination .page-numbers .dots:hover {
    background: none;
    transform: none;
    box-shadow: none;
}

/* Previous/Next buttons */
.wp-block-query-pagination .page-numbers a.prev,
.wp-block-query-pagination .page-numbers a.next {
    font-weight: 600;
    padding: 0.5rem 1.25rem;
}

.wp-block-query-pagination .page-numbers a.prev:hover,
.wp-block-query-pagination .page-numbers a.next:hover {
    background: #eb9b6a;
    border-color: #eb9b6a;
}

.wp-block-query-pagination .page-numbers a.prev:focus,
.wp-block-query-pagination .page-numbers a.next:focus {
    outline: none;
}

/* Disabled state (if needed) */
.wp-block-query-pagination .page-numbers span.prev,
.wp-block-query-pagination .page-numbers span.next {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f0f0f0;
}

.wp-block-query-pagination .page-numbers span.prev:hover,
.wp-block-query-pagination .page-numbers span.next:hover {
    background: #f0f0f0;
    transform: none;
    box-shadow: none;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 768px) {
    .dxp-taxonomy-filter {
        padding: 1.5rem;
    }

    .dxp-filter-actions {
        flex-direction: column;
    }

    .dxp-filter-apply-btn,
    .dxp-filter-reset-btn {
        width: 100%;
    }

    .dxp-checkbox-child {
        margin-left: 1rem;
    }

    .dxp-checkbox-level-2 {
        margin-left: 2rem;
    }

    .dxp-checkbox-level-3 {
        margin-left: 3rem;
    }

    /* Pagination mobile adjustments */
    .wp-block-query-pagination .page-numbers a,
    .wp-block-query-pagination .page-numbers span {
        min-width: 40px;
        min-height: 40px;
        padding: 0.4rem 0.8rem;
        font-size: 0.95rem;
    }

    .wp-block-query-pagination .page-numbers a.prev,
    .wp-block-query-pagination .page-numbers a.next {
        padding: 0.4rem 1rem;
    }
}

@media (max-width: 480px) {
    .dxp-taxonomy-filter {
        padding: 1rem;
    }

    .dxp-accordion-header {
        padding: 0.75rem 1rem;
    }

    .dxp-accordion-content {
        padding: 1rem;
    }

    .dxp-filter-field label {
        font-size: 0.95rem;
    }

    .dxp-checkbox-item span {
        font-size: 0.9rem;
    }

    /* Pagination small mobile adjustments */
    .wp-block-query-pagination {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }

    .wp-block-query-pagination ul.page-numbers,
    .wp-block-query-pagination .page-numbers {
        gap: 0.35rem;
    }

    .wp-block-query-pagination .page-numbers a,
    .wp-block-query-pagination .page-numbers span {
        min-width: 36px;
        min-height: 36px;
        padding: 0.3rem 0.6rem;
        font-size: 0.9rem;
    }

    .wp-block-query-pagination .page-numbers a.prev,
    .wp-block-query-pagination .page-numbers a.next {
        padding: 0.3rem 0.8rem;
        font-size: 0.85rem;
    }

    /* Hide some page numbers on very small screens */
    .wp-block-query-pagination .page-numbers li:nth-child(n+6):nth-last-child(n+4) {
        display: none;
    }
}

/* ===========================
   Select2 Integration (if available)
   =========================== */
.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--multiple {
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    min-height: 45px;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #eb9b6a;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #eb9b6a;
    border-color: #eb9b6a;
    color: #fff;
    padding: 4px 8px;
    border-radius: 3px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff;
    margin-right: 5px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #f0f0f0;
}

/* ===========================
   Print Styles
   =========================== */
@media print {
    .dxp-taxonomy-filter {
        display: none;
    }
}

