/**
 * Category Listing Styles
 * Similar to ProductionHub directory page
 */

.ph-category-search-wrapper,
.ph-category-search-wrapper *,
.ph-category-listing-wrapper,
.ph-category-listing-wrapper * {
    font-family: 'Gilroy', sans-serif !important;
    box-sizing: border-box;
}

/* ========================================
   Search Input
   ======================================== */

.ph-category-search-wrapper {
    max-width: 600px;
    margin: 0 auto 2rem;
}

.ph-category-search-input-container {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.ph-search-icon {
    position: absolute;
    left: 16px;
    color: #999;
    pointer-events: none;
    flex-shrink: 0;
}

.ph-category-search-input {
    width: 100%;
    padding: 16px 16px 16px 50px;
    font-size: 16px;
    border: none;
    outline: none;
    background: transparent;
    color: #333;
}

.ph-category-search-input::placeholder {
    color: #999;
}

.ph-category-search-input:focus {
    outline: none;
    box-shadow: none;
}

/* ========================================
   Results Counter & Labels
   ======================================== */

.ph-category-results-counter,
.ph-category-all-label {
    text-align: center;
    font-size: 18px;
    color: #666;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.ph-results-count,
.ph-total-count {
    font-weight: 700;
    color: #e65100;
}

/* ========================================
   Category Grid
   ======================================== */

.ph-category-listing-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.ph-category-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 3), 1fr);
    gap: 2rem 3rem;
}

@media (max-width: 1024px) {
    .ph-category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .ph-category-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Category Group
   ======================================== */

.ph-category-group {
    break-inside: avoid;
}

.ph-category-group.ph-hidden {
    display: none;
}

.ph-category-group-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #333;
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid #e65100;
}

/* ========================================
   Category List
   ======================================== */

.ph-category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ph-category-item {
    margin-bottom: 0.5rem;
}

.ph-category-item.ph-hidden {
    display: none;
}

.ph-category-link {
    color: #e65100;
    text-decoration: none;
    font-size: 15px;
    line-height: 1.5;
    transition: color 0.2s ease;
    display: inline-block;
}

.ph-category-link:hover {
    color: #bf4400;
    text-decoration: underline;
}

/* ========================================
   Highlight
   ======================================== */

.ph-highlight {
    background-color: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
}

/* ========================================
   No Results
   ======================================== */

.ph-category-no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.ph-category-no-results p {
    font-size: 18px;
    margin: 0;
}

/* ========================================
   Animations
   ======================================== */

.ph-category-group {
    transition: opacity 0.2s ease;
}

.ph-category-listing-wrapper.is-searching .ph-category-group {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Flat Structure (no hierarchy)
   ======================================== */

.ph-category-group-flat {
    grid-column: 1 / -1;
}

.ph-category-group-flat .ph-category-list {
    display: grid;
    grid-template-columns: repeat(var(--columns, 3), 1fr);
    gap: 0.5rem 2rem;
}

@media (max-width: 1024px) {
    .ph-category-group-flat .ph-category-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .ph-category-group-flat .ph-category-list {
        grid-template-columns: 1fr;
    }
}

/* Parent category as link */
.ph-category-title-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.ph-category-title-link:hover {
    color: #e65100;
}

/* ========================================
   Elementor Compatibility
   ======================================== */

/* When used inside Elementor sections */
.elementor-section .ph-category-search-wrapper {
    max-width: 100%;
}

.elementor-section .ph-category-listing-wrapper {
    max-width: 100%;
    padding: 0;
}

/* Dark background support for hero sections */
.elementor-section[data-settings*="background"] .ph-category-search-input-container,
.ph-category-search-wrapper.dark-bg .ph-category-search-input-container {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Full width container option */
.ph-category-listing-wrapper.full-width {
    max-width: none;
}

.ph-category-listing-wrapper.full-width .ph-category-grid {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   Top Categories [ph_top_categories]
   ======================================== */

.ph-top-categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.ph-top-category-tag {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 28px;
    background: #FFD230;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 4px 12px rgba(255, 210, 48, 0.35);
    transition: all 0.2s ease;
}

.ph-top-category-tag:hover {
    background: #f0c000;
    box-shadow: 0 6px 18px rgba(255, 210, 48, 0.5);
    transform: translateY(-2px);
    color: #ffffff;
}

@media (max-width: 1024px) {
    .ph-top-categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .ph-top-categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .ph-top-category-tag {
        font-size: 13px;
    }
}

/* Elementor Compatibility */
.ph-top-categories-grid a.ph-top-category-tag {
    background: #FFD230;
    color: #ffffff;
    text-decoration: none;
    border: none;
}
.ph-top-categories-grid a.ph-top-category-tag:hover {
    background: #f0c000;
    color: #ffffff;
    text-decoration: none;
}
.ph-category-listing-wrapper a.ph-category-link {
    color: #e65100;
    text-decoration: none;
}
.ph-category-listing-wrapper a.ph-category-link:hover {
    color: #bf4400;
}
.ph-category-listing-wrapper a.ph-category-title-link {
    color: inherit;
    text-decoration: none;
}
.ph-category-listing-wrapper a.ph-category-title-link:hover {
    color: #e65100;
}
.ph-category-search-input-container input[type="text"].ph-category-search-input {
    border: none;
    background: transparent;
    color: #333;
    box-shadow: none;
    outline: none;
    padding: 16px 16px 16px 50px;
    font-size: 16px;
    width: 100%;
    height: auto;
    line-height: normal;
    margin: 0;
}
.ph-category-search-input-container input[type="text"].ph-category-search-input:focus {
    border: none;
    box-shadow: none;
    outline: none;
}
