/* AmberLife API Filter Styles */

.alaf-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}


/* Search Box - Always visible */

.alaf-search-desktop-mobile {
    margin-bottom: 0;
    width: 30%;
    position: relative;
    margin-right: 15px;
}

.alaf-search-desktop-mobile .alaf-search-desktop-only {
    display: none;
    /* Hide duplicate search */
}

.alaf-label-desktop {
    display: block;
}


/* Desktop: All filters in one row wrapper */

.alaf-filters-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 60px;
}


/* Filter Section */

.alaf-filters {
    display: flex;
    width: 70%;
    gap: 15px;
}

.alaf-filters>.alaf-filter-item {
    flex: 1 1 0;
    margin-left: 0;
    position: relative;
}

.alaf-filter-item>label {
    position: absolute;
    z-index: 1;
    background: #fff;
    left: 10px;
    top: -12px;
    padding: 0 5px;
}

.alaf-filter-item label {
    display: block;
    font-size: 12px;
    color: #000;
    margin: 0;
}


/* Search Box */

.alaf-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

input[type="text"].alaf-search-input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.alaf-search-input:focus {
    border-color: #4a90e2;
}

.alaf-search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 16px;
    pointer-events: none;
}

.alaf-search-loader {
    position: absolute;
    right: 12px;
    color: #4a90e2;
}


/* Dropdown Filter */

.alaf-dropdown-wrapper {
    position: relative;
}

.alaf-dropdown-toggle {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color 0.3s;
    position: relative;
}

.alaf-dropdown-toggle:hover {
    border-color: #2d3940;
}

.alaf-dropdown-toggle.active {
    border-color: #2d3940;
}

.alaf-dropdown-toggle i {
    position: absolute;
    right: 15px;
    font-size: 14px;
    /* No rotation for filter icon */
}

.alaf-dropdown-options .alaf-option-item {
    display: flex;
    width: 100%;
    align-items: center;
}


/* Fontello filter icon - blue color */

.alaf-dropdown-toggle .icon-filter {
    color: #5c5ee5;
}

.alaf-dropdown-toggle.active i {
    /* Filter icon doesn't rotate */
    transform: none;
}

.alaf-dropdown-text {
    color: #000;
}

.alaf-dropdown-menu {
    display: none;
    /* Hidden by default */
    position: absolute;
    top: calc(100% + 8px);
    /* Add spacing below button */
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #4a90e2;
    border-radius: 8px;
    /* Rounded corners all around */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow: hidden;
    flex-direction: column;
}

.alaf-dropdown-menu.show {
    display: flex;
    /* Show when toggle is clicked */
}

.alaf-dropdown-search {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

input[type="text"].alaf-taxonomy-search {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    padding: 7px 12px;
}

.alaf-taxonomy-search:focus {
    border-color: #4a90e2;
}

.alaf-dropdown-options {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.alaf-option-item {
    display: flex;
    align-items: center;
    padding: 4px 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.alaf-option-item:hover {
    background: #f5f5f5;
}

.alaf-option-item.alaf-select-all {
    border-bottom: 1px solid #eee;
    font-weight: 600;
}

.alaf-option-item input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4a90e2;
    flex-shrink: 0;
}

.alaf-option-item input[type="checkbox"]:checked {
    background-color: #4a90e2;
}

.alaf-option-item span {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.alaf-option-item.hidden {
    display: none;
}

.alaf-dropdown-actions {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid #eee;
}

.alaf-btn-clear,
.alaf-btn-apply {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.alaf-btn-clear {
    background: #f5f5f5;
    color: #666;
}

.alaf-btn-clear:hover {
    background: #0c275a;
    color: white;
}

.alaf-btn-apply {
    background: #ff5722;
    color: white;
}

.alaf-btn-apply:hover {
    background: #ff0000;
}


/* Active Filters Tags */

.alaf-active-filters {
    margin-bottom: 20px;
}

.alaf-filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.alaf-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: #e8f1fa;
    border: 1px solid #4a90e2;
    border-radius: 20px;
    font-size: 14px;
    color: #333;
}

.alaf-filter-tag i {
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.alaf-filter-tag i:hover {
    color: #d9534f;
}


/* Results Header */

.alaf-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.alaf-results-count {
    font-size: 16px;
    color: #6e389e;
}

.alaf-count-number {
    font-size: 20px;
    color: #ed2690;
}


/* Letter Filter */

.alaf-letter-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    /* Spacing between letters */
    flex-wrap: wrap;
}

.alaf-jump-label {
    font-size: 18px;
    color: #6e389e;
    margin-right: 0;
    display: block;
    width: 100%;
    line-height: 26px;
    font-weight: 400;
}

.alaf-letter-btn {
    border: none;
    background: none;
    color: #ed2690;
    font-size: 15px;
    font-weight: 400;
    cursor: pointer;
    padding: 0;
    margin: 0;
    transition: none;
}

.alaf-letter-btn:hover {
    /* No hover effect - intentionally empty */
    cursor: pointer;
}

.alaf-letter-btn.active {
    font-weight: 700;
    /* Bold when active */
    color: #333;
}


/* Products Section */

.alaf-products-section {
    background: #fff;
    border-radius: 0;
    padding: 30px 0 0;
    border-top: 1px solid #ccc;
}

.alaf-products-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr;
    gap: 15px;
    padding: 15px 20px;
    background: #f8eaf1;
    border-radius: 0;
    margin-bottom: 0;
}

.alaf-header-col {
    font-size: 20px;
    font-weight: 400;
    color: #ed2690;
    line-height: 24px;
}

.alaf-loading {
    text-align: center;
    padding: 40px;
    font-size: 16px;
    color: #4a90e2;
}

.alaf-loading i {
    font-size: 24px;
    margin-right: 10px;
}


/* Products Table */

.alaf-products-table {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.alaf-product-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr;
    gap: 15px;
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s;
    align-items: center;
}

.alaf-product-row:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.alaf-product-row:last-child {
    border-bottom: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.alaf-product-row:hover {
    background: #f9fbfd;
}

.alaf-product-col {
    line-height: 24px;
    font-size: 18px;
    font-weight: 400;
}

.alaf-col-product {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.alaf-product-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 26px;
    padding: 0;
}

.alaf-product-title a {
    color: #0c275a;
    text-decoration: none;
    transition: color 0.3s;
}

.alaf-product-title a:hover {
    color: #6e389e;
    text-decoration: underline;
}

.alaf-cas-number {
    font-size: 18px;
    color: #0c275a;
    margin: 0;
    line-height: 24px;
    font-weight: 400;
}

.alaf-col-category,
.alaf-col-regulations {
    color: #000;
}


/* No Results */

.alaf-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
}


/* Pagination */

.alaf-pagination {
    margin-top: 30px;
    text-align: center;
}

.alaf-pagination ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-flex;
    gap: 5px;
}

.alaf-pagination li {
    display: inline-block;
}

.alaf-pagination a,
.alaf-pagination span {
    display: block;
    padding: 8px 14px;
    background: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 14px;
}

.alaf-pagination a:hover {
    background: #0c275a;
    color: white;
    border-color: #0c275a;
}

.alaf-pagination .current {
    background: #0c275a;
    color: white;
    border-color: #0c275a;
}


/* Mobile Filter Toggle Button (Hidden on desktop) */

.alaf-mobile-filter-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 20px;
    width: 100%;
    justify-content: center;
}

.alaf-mobile-filter-toggle i {
    font-size: 18px;
}


/* Mobile Filter Header (Hidden on desktop) */

.alaf-mobile-filter-header {
    display: none;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.alaf-mobile-back-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: #4a90e2;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 15px;
}

.alaf-mobile-filter-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}


/* Mobile Search Button (Hidden on desktop) */

.alaf-mobile-search-btn-wrapper {
    display: none;
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    position: sticky;
    bottom: 0;
}

.alaf-mobile-search-btn {
    width: 100%;
    padding: 15px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.alaf-mobile-search-btn:hover {
    background: #357abd;
}


/* Mobile Overlay */

.alaf-mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.alaf-mobile-overlay.show {
    display: block;
}


/* Responsive Design */

@media (max-width: 1024px) {
    .alaf-products-header {
        display: none;
    }

    .alaf-product-row {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0 0 15px;
    }

    .alaf-product-col:before {
        content: attr(data-label);
        font-weight: 600;
        display: block;
        margin-bottom: 5px;
        color: #333;
    }
}

@media (max-width: 767px) {
    .alaf-container {
        padding: 0;
    }

    /* Hide desktop label, keep mobile clean */
    .alaf-label-desktop {
        display: none;
    }

    /* Mobile: Break the grid layout */
    .alaf-filters-wrapper {
        display: block;
        margin-bottom: 0;
    }

    /* Search box stays outside, not in hamburger */
    .alaf-search-desktop-mobile {
        display: block;
        margin-bottom: 15px;
        width: 100%;
    }

    .alaf-search-desktop-only {
        display: none !important;
        /* Hide duplicate search in hamburger */
    }

    /* Show mobile filter toggle button */
    .alaf-mobile-filter-toggle {
        display: flex;
    }

    /* Hide desktop filters, convert to mobile drawer */
    .alaf-filters {
        display: flex;
        /* Override contents */
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        background: white;
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        flex-direction: column;
        padding: 0;
        margin: 0;
    }

    .alaf-filters.show {
        transform: translateX(0);
        padding-top: 85px;
    }

    /* Show mobile header and search button */
    .alaf-mobile-filter-header {
        display: block;
    }

    .alaf-mobile-search-btn-wrapper {
        display: block;
    }

    /* Adjust filter items for mobile */
    .alaf-filters>.alaf-filter-item {
        padding: 15px 20px;
        border-bottom: 1px solid #e0e0e0;
        width: 100%;
        margin: 0;
    }

    .alaf-filter-item>label {
        display: none;
        /* Hide only direct child "Location" labels on mobile */
    }

    /* Ensure dropdown option labels ARE visible */
    .alaf-option-item {
        display: flex !important;
    }

    .alaf-option-item span {
        display: inline !important;
    }

    .alaf-dropdown-wrapper {
        position: relative;
    }

    .alaf-dropdown-toggle {
        width: 100%;
        background: white;
        text-align: left;
    }

    /* Mobile dropdown - make it work properly */
    .alaf-dropdown-menu {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        border: 1px solid #ddd;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        margin-top: 10px;
        border-radius: 8px;
        background: #f9f9f9;
        z-index: 1;
        max-height: 300px;
    }

    /* Ensure dropdown is visible when shown on mobile */
    .alaf-filters .alaf-dropdown-menu.show {
        display: flex !important;
    }

    /* Mobile dropdown toggle - ensure it's clickable */
    .alaf-filters .alaf-dropdown-toggle {
        position: relative;
        z-index: 2;
        pointer-events: auto;
    }

    .alaf-results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .alaf-results-count {
        width: 100%;
    }

    .alaf-letter-filter {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .alaf-letter-btn {
        font-size: 14px;
        flex-shrink: 0;
        padding: 5px;
    }

    /* Hide active filters tags on mobile or adjust */
    .alaf-active-filters {
        margin-top: 10px;
    }

    .alaf-filter-tags {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}


/* Click outside to close dropdown */

.alaf-dropdown-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    display: none;
}

.alaf-dropdown-backdrop.show {
    display: block;
}