/**
 * Frontend styles for Accredo-Woo Integration plugin.
 *
 * @package AccredoWooIntegration
 */

/* Currency switcher styling */
.accredo-currency-switcher {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    font-size: var(--snav_font_size);
    cursor: pointer;
    height: 37px;
    font-weight: 500;
    transition: border-color 0.3s ease;
}

.accredo-currency-switcher:hover,
.accredo-currency-switcher:focus {
    border-color: #999;
    outline: none;
}

/* Menu item styling for currency switcher */
.menu-item-currency-switcher {
    display: flex;
    align-items: center;
}

.menu-item-currency-switcher .accredo-currency-switcher {
    margin: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .accredo-currency-switcher {
        font-size: 13px;
        padding: 6px 10px;
    }
}

/* Loading state */
.accredo-currency-switcher.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Cart and Checkout Stock Status Labels */
.cart-stock-status,
.checkout-stock-status,
.order-stock-status {
    font-size: 0.9em;
    font-weight: normal;
}

.cart-stock-status {
    margin: 5px 0 0 0;
}

.cart-stock-status.in-stock,
.checkout-stock-status.in-stock,
.order-stock-status.in-stock {
    color: #7ad03a;
}

.cart-stock-status.low-stock,
.checkout-stock-status.low-stock,
.order-stock-status.low-stock {
    color: #ffba00;
}

.cart-stock-status.available-on-backorder,
.checkout-stock-status.available-on-backorder,
.order-stock-status.available-on-backorder {
    color: #999;
}

/* WooCommerce Blocks Stock Badges */
.wc-block-components-product-low-stock-badge.accredo-stock-badge {
    font-size: 0.875em;
}

.wc-block-components-product-low-stock-badge.accredo-stock-badge.in-stock {
    background-color: #d4edda;
    color: #155724;
}

.wc-block-components-product-low-stock-badge.accredo-stock-badge.low-stock {
    background-color: #fff3cd;
    color: #856404;
}

.wc-block-components-product-low-stock-badge.accredo-stock-badge.available-on-backorder {
    background-color: #e2e3e5;
    color: #383d41;
}

/* ======================================
   Archive Search Styles
   ====================================== */

.accredo-archive-search-wrapper {
    width: 100%;
    max-width: 500px;
    margin: 0 0 20px 0;
    position: relative;
}

.accredo-archive-search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.accredo-archive-search-input {
    width: 100%;
    padding: 12px 45px 12px 16px;
    font-size: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.accredo-archive-search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.accredo-archive-search-input::placeholder {
    color: #999;
}

.accredo-archive-search-icon,
.accredo-archive-search-spinner {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.accredo-archive-search-spinner .spin {
    animation: accredo-spin 1s linear infinite;
}

@keyframes accredo-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.accredo-archive-search-clear {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: #ccc;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.accredo-archive-search-clear:hover {
    background: #999;
}

/* Filter Status Bar */
.accredo-archive-filter-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding: 10px 15px;
    background: #e8f4f8;
    border: 1px solid #b8daed;
    border-radius: 4px;
    font-size: 14px;
    color: #1a5276;
}

.accredo-archive-filter-status .filter-count {
    font-weight: 500;
}

.accredo-archive-filter-status .accredo-archive-filter-clear {
    background: none;
    border: none;
    color: #1a5276;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: 13px;
}

.accredo-archive-filter-status .accredo-archive-filter-clear:hover {
    color: #0d3d56;
}

/* Filtered Products Grid */
ul.products.accredo-filtered {
    animation: accredoFadeIn 0.3s ease;
}

@keyframes accredoFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* No Results State */
ul.products.accredo-no-results {
    display: block !important;
    width: 100%;
}

.accredo-filter-no-results,
.accredo-filter-error {
    width: 100%;
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 15px;
    list-style: none;
}

.accredo-filter-no-results p,
.accredo-filter-error p {
    margin: 0;
}

.accredo-filter-error {
    color: #dc3545;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .accredo-archive-search-wrapper {
        max-width: 100%;
    }

    .accredo-archive-search-input {
        padding: 10px 40px 10px 14px;
        font-size: 14px;
    }

    .accredo-search-result-item .result-image {
        width: 40px;
        height: 40px;
    }

    .accredo-archive-search-results {
        max-height: 300px;
    }
}

/* ======================================
   Product Grid Shortcode Styles
   ====================================== */

/* Grid wrapper */
.accredo-product-grid-wrapper {
    width: 100%;
    margin: 0 0 30px 0;
}

/* Product grid uses WooCommerce default styling */
.accredo-product-grid {
    transition: opacity 0.3s ease;
}

.accredo-product-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* No products message */
.accredo-grid-no-products {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 15px;
}

/* Pagination container */
.accredo-grid-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    padding: 20px 0;
}

/* Load More button */
.accredo-grid-load-more {
    display: inline-block;
    padding: 12px 30px;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid #333;
    background: transparent;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.accredo-grid-load-more:hover:not(:disabled) {
    background: #333;
    color: #fff;
}

.accredo-grid-load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.accredo-grid-load-more.no-more {
    border-color: #ccc;
    color: #999;
    cursor: default;
}

/* Page numbers (paginate mode) */
.accredo-grid-page-numbers {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.accredo-grid-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.accredo-grid-page-btn:hover:not(:disabled):not(.active) {
    border-color: #333;
    background: #f5f5f5;
}

.accredo-grid-page-btn.active {
    background: #333;
    border-color: #333;
    color: #fff;
    cursor: default;
}

.accredo-grid-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive grid pagination */
@media (max-width: 768px) {
    .accredo-grid-load-more {
        width: 100%;
        padding: 15px 20px;
    }

    .accredo-grid-page-numbers {
        gap: 5px;
    }

    .accredo-grid-page-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
}
