/* ============================================================
   IMTA Product Filter Widgets
   ============================================================ */

/* Widget Container */
.imta-filter-widget {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    margin-bottom: 15px;
    overflow: hidden;
}

/* Header */
.imta-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.imta-filter-header:hover {
    background-color: #fafafa;
}

.imta-filter-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.imta-filter-toggle {
    font-size: 18px;
    font-weight: 300;
    color: #666;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

/* Content */
.imta-filter-content {
    padding: 0 16px 16px;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    max-height: 500px;
    opacity: 1;
    overflow: hidden;
}

.imta-filter-widget.collapsed .imta-filter-content {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.imta-filter-widget.collapsed .imta-filter-toggle {
    transform: rotate(0deg);
}

/* Divider line between header and content */
.imta-filter-content::before {
    content: '';
    display: block;
    height: 1px;
    background: #e8e8e8;
    margin-bottom: 14px;
}

/* ============================================================
   Tag List (Hàng đặt trước)
   ============================================================ */
.imta-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.imta-tag-item {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    font-size: 13px;
    color: #555;
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1.4;
    background: #fff;
}

.imta-tag-item:hover {
    border-color: #007119;
    color: #007119;
    text-decoration: none;
}

.imta-tag-item.active {
    background: #007119;
    border-color: #007119;
    color: #fff;
}

.imta-tag-item.active:hover {
    background: #cf6d1a;
    border-color: #cf6d1a;
    color: #fff;
}

/* ============================================================
   Checkbox List (Thương hiệu, Lọc Giá)
   ============================================================ */
.imta-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.imta-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 4px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-radius: 3px;
    margin: 0 !important;
}

.imta-checkbox-item:hover {
    background-color: #f7f7f7;
}

/* Hide default checkbox */
.imta-checkbox-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Custom checkmark */
.imta-checkmark {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 1px solid #ccc;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.imta-checkbox-item input:checked~.imta-checkmark {
    background: #007119;
    border-color: #007119;
}

.imta-checkbox-item input:checked~.imta-checkmark::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.imta-checkbox-label {
    font-size: 14px;
    color: #444;
    line-height: 1.4;
    font-weight: normal;
}

.imta-checkbox-item input:checked~.imta-checkbox-label {
    color: #333;
    font-weight: 500;
}

/* Scrollable list (for brands with many items) */
.imta-scrollable {
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Custom scrollbar */
.imta-scrollable::-webkit-scrollbar {
    width: 4px;
}

.imta-scrollable::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.imta-scrollable::-webkit-scrollbar-thumb {
    background: #007119;
    border-radius: 4px;
}

.imta-scrollable::-webkit-scrollbar-thumb:hover {
    background: #cf6d1a;
}

/* ============================================================
   Flatsome Integration - Override widget defaults
   ============================================================ */
.widget.widget_imta_preorder_filter,
.widget.widget_imta_brand_filter,
.widget.widget_imta_price_range_filter {
    margin-bottom: 0 !important;
    padding: 0 !important;
}

/* Hide Flatsome's default widget title and divider */
.widget.widget_imta_preorder_filter>.widget-title,
.widget.widget_imta_brand_filter>.widget-title,
.widget.widget_imta_price_range_filter>.widget-title,
.widget.widget_imta_preorder_filter>.is-divider,
.widget.widget_imta_brand_filter>.is-divider,
.widget.widget_imta_price_range_filter>.is-divider {
    display: none !important;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .imta-filter-title {
        font-size: 14px;
    }

    .imta-tag-item {
        font-size: 12px;
        padding: 5px 10px;
    }

    .imta-checkbox-label {
        font-size: 13px;
    }

    .imta-scrollable {
        max-height: 200px;
    }
}

/* ============================================================
   Pre-Order / Order Ribbon Badge on Product Cards
   ============================================================ */
.imta-preorder-ribbon {
    position: absolute;
    top: 0;
    left: 0;
    width: 85px;
    height: 85px;
    overflow: hidden;
    z-index: 10;
    pointer-events: none;
}

.imta-preorder-ribbon span {
    display: block;
    position: absolute;
    top: 20px;
    left: -50px;
    width: 160px;
    padding: 5px 0;
    background: #2ecc40;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-style: italic;
    text-align: center;
    text-transform: capitalize;
    transform: rotate(-45deg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    letter-spacing: 0.5px;
    line-height: 1.3;
}

/* ============================================================
   Shop Header (Title + Sort Bar)
   ============================================================ */
.imta-shop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #e8e8e8;
    gap: 15px;
}

.imta-shop-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
    padding: 0;
    line-height: 1.3;
}

/* ============================================================
   Rank Math Breadcrumb Bar
   ============================================================ */
.imta-breadcrumb-bar {
    padding: 10px 0;
    margin-bottom: 10px;
    font-size: 13px;
}

.imta-breadcrumb-bar a {
    color: #666;
    text-decoration: none;
}

.imta-breadcrumb-bar a:hover {
    color: #333;
}

.imta-breadcrumb-bar .rank-math-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

/* ============================================================
   Custom Sort Bar
   ============================================================ */
.imta-sort-bar {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

.imta-sort-label {
    font-size: 14px;
    color: #666;
    margin-right: 8px;
    white-space: nowrap;
}

.imta-sort-btn {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-right: none;
    font-size: 13px;
    color: #555;
    text-decoration: none;
    background: #fff;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.imta-sort-btn:first-of-type {
    border-radius: 3px 0 0 3px;
}

.imta-sort-btn:last-child {
    border-right: 1px solid #ddd;
    border-radius: 0 3px 3px 0;
}

.imta-sort-btn:hover {
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
}

.imta-sort-btn.active {
    background: #333;
    border-color: #333;
    color: #fff;
}

.imta-sort-btn.active+.imta-sort-btn {
    border-left-color: #333;
}

/* ============================================================
   Active Filter Tags
   ============================================================ */
.imta-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
    align-items: center;
}

.imta-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: #d62828;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    border-radius: 3px;
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.imta-filter-tag:hover {
    background: #d62828;
    color: #fff;
    text-decoration: none;
}

.imta-filter-tag.imta-clear-all {
    background: #95a5a6;
}

.imta-filter-tag.imta-clear-all:hover {
    background: #7f8c8d;
}

.imta-tag-remove {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    opacity: 0.9;
}

/* ============================================================
   Responsive - Sort Bar & Filter Tags
   ============================================================ */
@media (max-width: 768px) {
    .imta-sort-bar {
        flex-wrap: wrap;
        gap: 4px;
    }

    .imta-sort-label {
        font-size: 12px;
        width: 100%;
    }

    .imta-sort-btn {
        font-size: 11px;
        padding: 5px 8px;
    }

    .imta-filter-tag {
        font-size: 12px;
        padding: 4px 10px;
    }
}

/* ============================================================
   Product Card Border
   ============================================================ */
.product-small .col-inner {
    border: 1px solid #ededed;
}

.product-small .box-text-products {
    padding: 10px;
}

/* ============================================================
   Ẩn badge Giảm giá (on-sale) trên Product Card
   ============================================================ */
.callout.badge:has(.on-sale) {
    display: none !important;
}

/* Fallback cho trình duyệt không hỗ trợ :has() */
.badge-inner.on-sale {
    display: none !important;
}

/* Fix badge-container margin để ribbon nằm sát góc */
.badge-container {
    margin: 0 !important;
}
