/**
 * Product Category Panels - CSS for enhanced UI and interactions
 */

/* Panel Loading States */
.product-category-panel {
    position: relative;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 8px;
}

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Section Row Note Enhancements */
.section-row-note {
    gap: 12px;
}

.section-row-note .block-note {
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid transparent;
}

.section-row-note .block-note:hover {
    background-color: #f8f9fa;
    border-color: #e9ecef;
    transform: translateY(-2px);
}

.section-row-note .block-note.active {
    background-color: #e3f2fd;
    border-color: #1976d2;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.2);
}

.section-row-note .block-note .icon {
    transition: transform 0.3s ease;
}

.section-row-note .block-note:hover .icon {
    transform: scale(1.1);
}

.section-row-note .block-note .label {
    font-weight: 500;
    color: #424242;
    transition: color 0.3s ease;
}

.section-row-note .block-note.active .label {
    color: #1976d2;
    font-weight: 600;
}

/* Sort By Dropdown Enhancements */
.rental-service__sort-by {
    position: relative;
}

/* High specificity to match home.css structure */
.product-category-panel .section-row-note .block-note .rental-service__sort-by .block-sorted-by,
.block-sorted-by {
    position: absolute;
    top: auto;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    z-index: 999999;
    min-width: 250px;
    display: none;
    transition: all 0.3s ease;
    overflow: visible;
}

.block-sorted-by.active {
    display: block;
    background: white;
    border: 2px solid #ff0000;
    z-index: 99999;
}

/* Ensure dropdown is not cut off - force visible on all parents */
.product-category-panel {
    overflow: visible;
}

.section-block-title {
    overflow: visible;
}

.section-row-note {
    overflow: visible;
}

.section-row-note .block-note {
    overflow: visible;
}

.section-row-note .block-note:last-child {
    position: relative;
    overflow: visible;
}

.rental-service__sort-by {
    position: relative;
    overflow: visible;
}

/* High specificity to override home.css */
.product-category-panel .section-row-note .block-note .rental-service__sort-by:hover .block-sorted-by,
.product-category-panel .section-row-note .block-note .rental-service__sort-by .block-sorted-by.filter__more-btn--active:hover,
.product-category-panel .section-row-note .block-note .rental-service__sort-by .block-sorted-by ul.active,
.product-category-panel .section-row-note .block-note .rental-service__sort-by .block-sorted-by.show,
.rental-service__sort-by:hover .block-sorted-by,
.block-sorted-by.filter__more-btn--active:hover,
.block-sorted-by.active,
.block-sorted-by.show {
    display: block;
    /* margin-top: 20px; */
    position: fixed;
}

/* Position hover dropdown with JavaScript calculation */
.rental-service__sort-by:hover .block-sorted-by {
    position: absolute;
    z-index: 999999;
}

.ul-sorted-by {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    padding-top: 0;
    padding-bottom: 0;
}

.btn-sorted-by {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: #424242;
}

.btn-sorted-by:hover {
    background-color: #f5f5f5;
    color: #1976d2;
}

.btn-sorted-by.active {
    background-color: #e3f2fd;
    color: #1976d2;
    font-weight: 600;
}

.btn-sorted-by__display-select {
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
}

.btn-sorted-by.active .btn-sorted-by__display-select {
    border-color: #1976d2;
    background-color: #1976d2;
}

.btn-sorted-by.active .btn-sorted-by__display-select::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}

/* Filter Badge Enhancements */
.filter-badge {
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.filter-badge.active {
    background-color: #1976d2;
    color: white;
    border-color: #1976d2;
}

.filter-badge.not-active {
    background-color: #f5f5f5;
    color: #666;
    border-color: #e0e0e0;
}

.filter-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    transition: all 0.3s ease;
}

.filter-badge.active .dot {
    background-color: white;
    transform: scale(1.2);
}

.filter-badge.active .label {
    color: #1B74E4;
}

/* Product Grid Enhancements */
.product-grid {
    position: relative;
    transition: opacity 0.3s ease;
}

.product-grid.loading {
    opacity: 0.6;
}

/* No Products Message */
.no-products-message {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.no-products-message .fas {
    color: #dee2e6;
    margin-bottom: 16px;
}

.no-products-message h5 {
    color: #6c757d;
    margin-bottom: 8px;
}

.no-products-message p {
    color: #adb5bd;
    margin-bottom: 0;
}

/* Animation Effects */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-grid .product-item {
    animation: fadeInUp 0.3s ease forwards;
}

.product-grid .product-item:nth-child(1) {
    animation-delay: 0.1s;
}

.product-grid .product-item:nth-child(2) {
    animation-delay: 0.2s;
}

.product-grid .product-item:nth-child(3) {
    animation-delay: 0.3s;
}

.product-grid .product-item:nth-child(4) {
    animation-delay: 0.4s;
}

.product-grid .product-item:nth-child(5) {
    animation-delay: 0.5s;
}

.product-grid .product-item:nth-child(6) {
    animation-delay: 0.6s;
}

/* Error States */
.alert-danger {
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    color: #c62828;
    padding: 16px;
    margin: 20px 0;
}

.alert-danger svg {
    margin-right: 8px;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .product-category-panel {
        margin-bottom: 30px;
        padding: 0 10px;
    }

    .section-block-title {
        padding: 0 15px;
    }

    .section-block-title h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .section-row-note {
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 8px;
    }

    .section-row-note::-webkit-scrollbar {
        display: none;
    }

    .section-row-note .block-note {
        padding: 6px 10px;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .block-sorted-by {
        position: static;
        display: block;
        box-shadow: none;
        border: none;
        margin-top: 8px;
        top: auto;
        right: auto;
        min-width: auto;
    }

    /* Hide desktop tabs on mobile */
    .block-tabs.d-none.d-md-flex {
        display: none !important;
    }

    /* Show mobile tabs */
    .d-block.d-md-none {
        display: block !important;
    }

    .menu-sub-category {
        justify-content: flex-start !important;
        gap: 8px !important;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 8px;
    }

    .menu-sub-category::-webkit-scrollbar {
        display: none;
    }

    .filter-badge {
        padding: 6px 12px;
        font-size: 14px;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 0 10px;
    }

    .btn-load-more {
        padding: 10px 20px;
        font-size: 13px;
    }

    /* Mobile product tabs integration */
    .mobile-product-tabs {
        margin: 15px 0;
    }

    .mobile-product-tabs .mobile-tabs-container {
        margin: 0px;
        border-radius: 0;
    }

    .mobile-product-tabs .mobile-tabs-scroll {
        padding: 12px 20px;
    }

    .mobile-product-tabs .mobile-tab-item {
        min-width: 110px;
    }

    .section-product-content .product-grid .btn-group {
        display: grid;
    }

    .section-product-content .product-grid .btn-group button {
        width: 100%;
    }

    .product-category-panel .section-block-title h2 {
        padding: 5px 8px;
    }
}

@media (max-width: 480px) {
    .product-category-panel {
        padding: 0 5px;
    }

    .product-category-panel .section-block-title {
        padding: 0 10px;
    }

    .section-block-title h2 {
        font-size: 18px;
    }

    .section-row-note .block-note {
        padding: 5px 8px;
        font-size: 12px;
    }

    .menu-sub-category {
        flex-direction: row;
        align-items: center;
    }

    .filter-badge {
        justify-content: center;
        margin-bottom: 4px;
        padding: 6px 10px;
        font-size: 11px;
    }

    .no-products-message {
        padding: 20px 10px;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 0 5px;
    }

    .mobile-product-tabs .mobile-tabs-scroll {
        padding: 10px 15px;
    }

    .mobile-product-tabs .mobile-tab-item {
        min-width: 100px;
        padding: 10px 12px;
    }

    .mobile-product-tabs .tab-name {
        font-size: 12px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .filter-badge {
        border-width: 3px;
    }

    .btn-sorted-by {
        border: 1px solid transparent;
    }

    .btn-sorted-by:hover,
    .btn-sorted-by.active {
        border-color: currentColor;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {

    .section-row-note .block-note,
    .filter-badge,
    .btn-sorted-by,
    .loading-overlay,
    .product-grid {
        transition: none;
    }

    .product-grid .product-item {
        animation: none;
    }

    .section-row-note .block-note:hover {
        transform: none;
    }
}

/* Focus States for Accessibility */
.section-row-note .block-note:focus,
.filter-badge:focus,
.btn-sorted-by:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* Print Styles */
@media print {

    .section-row-note,
    .loading-overlay {
        display: none;
    }
}