/* ============================================================
   COLLECTIONS PAGE — collections.css
   ============================================================ */

/* ── Hide WooCommerce notices ──────────────────────────────── */
.woocommerce-notices-wrapper {
    display: none !important;
}

/* ── Top padding on collection pages to clear fixed navbar ── */
body.archive .site-main,
body.archive main,
body.woocommerce-page.archive .site-main,
body.woocommerce-page.archive main {
    padding-top: calc(var(--topbar-h) + var(--header-h) + 24px) !important;
}

/* ── Page Header ───────────────────────────────────────────── */
.ms-collections-header {
    text-align: center;
    padding: 24px 20px 20px;
}

.ms-collections-header h1 {
    font-size: var(--h1);
    font-weight: 400;
    margin: 0;
    text-transform: uppercase;
    font-family: var(--font-family);
    color: var(--text-dark);
}

/* ── Wrapper ───────────────────────────────────────────────── */
.ms-collections-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

/* ── Toolbar (result count + sort by) ─────────────────────── */
.ms-collections-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    font-family: var(--font-family);
}

.ms-collections-toolbar-left {
    font-size: 13px;
    color: #888;
}

.ms-collections-toolbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* WooCommerce result count — hide default, use custom */
.ms-collections-toolbar .woocommerce-result-count {
    display: none;
}

/* WooCommerce ordering */
.ms-collections-toolbar .woocommerce-ordering {
    display: flex;
    align-items: center;
    margin: 0;
}

.ms-collections-toolbar .woocommerce-ordering::before {
    content: "Sort by:";
    font-weight: 600;
    font-size: 13px;
    color: #333;
    margin-right: 10px;
    white-space: nowrap;
}

.ms-collections-toolbar select.orderby {
    display: none !important;
}

/* Custom sort dropdown */
.ms-custom-select-wrapper {
    position: relative;
    user-select: none;
    display: flex;
    align-items: center;
}

.ms-custom-select-trigger {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    gap: 6px;
}

.ms-custom-select-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #eee;
    border-radius: 50%;
    color: #666;
    transition: transform 0.2s;
}

.ms-custom-select-wrapper.open .ms-custom-select-icon {
    transform: rotate(180deg);
}

.ms-custom-select-options {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--white);
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    list-style: none;
    padding: 6px 0;
    width: 200px;
    z-index: 50;
    display: none;
}

.ms-custom-select-wrapper.open .ms-custom-select-options {
    display: block;
}

.ms-custom-select-options li {
    padding: 10px 18px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.ms-custom-select-options li:hover {
    background: #f5f5f5;
    color: #111;
}

.ms-custom-select-options li.selected {
    font-weight: 600;
    color: #111;
}

/* ── Product Grid (4 columns) ─────────────────────────────── */
.ms-collections-grid ul.products {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ── Product Card ─────────────────────────────────────────── */
.ms-product-card {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
    position: relative;
    border: 1px solid transparent;
}

.ms-product-card:hover {
    box-shadow: 0 4px 20px rgba(229,57,53,0.12);
    border-color: var(--primary);
}

/* Image wrapper */
.ms-product-card-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

.ms-product-card-image-wrapper .ms-product-card-link {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ms-product-card-img-main,
.ms-product-card-img-hover {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.ms-product-card-img-hover {
    opacity: 0;
}

.ms-has-hover:hover .ms-product-card-img-main {
    opacity: 0;
}

.ms-has-hover:hover .ms-product-card-img-hover {
    opacity: 1;
}

/* Quick view eye button */
.ms-product-card-quickview {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    background: var(--white);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    opacity: 1;
    transition: background 0.2s;
}

.ms-product-card-quickview:hover {
    background: var(--primary);
}

.ms-product-card-quickview:hover svg {
    stroke: var(--white);
}

.ms-product-card-quickview svg {
    width: 17px;
    height: 17px;
    stroke: #333;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Add to cart button (below eye icon, top-right) */
.ms-product-card-addtocart {
    position: absolute;
    top: 54px;
    right: 10px;
    width: 34px;
    height: 34px;
    background: var(--white);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    opacity: 1;
    transition: background 0.2s;
}

.ms-product-card:hover .ms-product-card-addtocart {
    opacity: 1;
}

.ms-product-card-addtocart:hover {
    background: var(--primary);
}

.ms-product-card-addtocart:hover svg {
    stroke: var(--white);
}

.ms-product-card-addtocart svg {
    width: 16px;
    height: 16px;
    stroke: #333;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ms-addtocart-loading {
    opacity: 0.5 !important;
    pointer-events: none !important;
}

.ms-addtocart-added {
    background: #4CAF50 !important;
}

.ms-addtocart-added svg {
    stroke: var(--white) !important;
}

/* Info */
.ms-product-card-info {
    padding: 12px 14px 16px;
}

.ms-product-card-link {
    text-decoration: none;
    color: inherit;
}

.ms-product-card-title {
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    color: #222;
    margin: 0 0 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ms-product-card-price {
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 700;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ms-product-card-price .price,
.ms-product-card-price .woocommerce-Price-amount {
    white-space: nowrap;
}

.ms-product-card-price del {
    font-size: 13px;
    font-weight: 400;
    color: #999;
    margin-left: 6px;
}

.ms-product-card-price ins {
    text-decoration: none;
    color: #111;
}

/* ── Pagination ───────────────────────────────────────────── */
.ms-collections-pagination {
    margin-top: 50px;
}

.ms-pagination {
    display: flex;
    justify-content: center;
}

.ms-pagination-inner {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    border: 1px solid #ddd;
    border-radius: 50px;
    padding: 8px 20px;
    font-size: 13px;
    color: #888;
    font-weight: 500;
}

.ms-pagination-link {
    color: #888;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.ms-pagination-link:hover {
    color: #333;
}

.ms-pagination-link.disabled {
    color: #ccc;
    pointer-events: none;
}

.ms-pagination-current {
    color: #111;
    font-weight: 700;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1100px) {
    .ms-collections-grid ul.products {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .ms-collections-header {
        padding: 16px 16px 16px;
    }

    .ms-collections-wrapper {
        padding: 0 16px 60px;
    }

    .ms-collections-grid ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .ms-collections-toolbar {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .ms-product-card-info {
        padding: 8px 10px 12px;
    }

    .ms-product-card-title {
        font-size: 13px;
    }

    .ms-product-card-price {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .ms-collections-grid ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .ms-product-card-info {
        padding: 6px 8px 10px;
    }

    .ms-product-card-title {
        font-size: 12px;
        margin-bottom: 4px;
    }

    .ms-product-card-price {
        font-size: 12px;
    }

    .ms-product-card-price del {
        font-size: 11px;
    }
}

/* ============================================================
   QUICK VIEW MODAL
   ============================================================ */

/* Overlay */
#ms-quickview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

#ms-quickview-overlay.ms-qv-overlay--visible {
    opacity: 1;
    visibility: visible;
}

/* Modal */
#ms-quickview-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    z-index: 2001;
    width: 900px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
    overflow: hidden;
}

#ms-quickview-modal.ms-qv-modal--visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.ms-quickview-content {
    position: relative;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.ms-quickview-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    background: var(--white);
    border: none;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: background 0.15s;
}

.ms-quickview-close:hover {
    background: #f0f0f0;
}

.ms-quickview-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 400px;
}

.ms-quickview-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    font-family: var(--font-family);
    font-size: 15px;
    color: #888;
}

/* Image column */
.ms-quickview-image-col {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    position: relative;
}

.ms-qv-image-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 200px;
}

.ms-qv-preloader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.ms-qv-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #eee;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: ms-qv-spin 0.7s linear infinite;
}

@keyframes ms-qv-spin {
    to { transform: rotate(360deg); }
}

.ms-quickview-image-col img {
    width: 100%;
    height: auto;
    max-height: 450px;
    object-fit: contain;
}

.ms-quickview-gallery {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
}

.ms-quickview-gallery-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.5;
    transition: border-color 0.15s, opacity 0.15s;
}

.ms-quickview-gallery-thumb:hover,
.ms-quickview-gallery-thumb.ms-qv-thumb--active {
    border-color: var(--primary);
    opacity: 1;
}

.ms-quickview-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Details column */
.ms-quickview-details-col {
    padding: 30px 30px 30px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    font-family: var(--font-family);
}

.ms-quickview-title {
    font-size: 20px;
    font-weight: 600;
    color: #111;
    margin: 0;
    line-height: 1.3;
}

.ms-quickview-title a {
    color: inherit;
    text-decoration: none;
}

.ms-quickview-title a:hover {
    color: var(--primary);
}

.ms-quickview-price {
    font-size: 22px;
    font-weight: 700;
    color: #111;
}

.ms-quickview-price del {
    font-size: 16px;
    font-weight: 400;
    color: #999;
    margin-left: 8px;
}

.ms-quickview-price ins {
    text-decoration: none;
    color: #111;
}

.ms-quickview-sku {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ms-quickview-desc {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin: 0;
}

/* Attributes (variable products) */
.ms-quickview-attributes {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ms-quickview-attr-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ms-quickview-attr-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #555;
    letter-spacing: 0.3px;
}

.ms-quickview-attr-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ms-quickview-attr-pill {
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    background: var(--white);
    transition: all 0.15s;
}

.ms-quickview-attr-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.ms-quickview-attr-pill.ms-qv-pill--selected {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--white);
}

/* Buttons */
.ms-quickview-buttons {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.ms-quickview-add-to-cart {
    flex: 1;
    padding: 12px 24px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 50px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.ms-quickview-add-to-cart:hover {
    opacity: 0.9;
}

.ms-quickview-add-to-cart:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ms-quickview-details-btn {
    padding: 12px 20px;
    background: transparent;
    color: var(--text);
    border: 1px solid #ddd;
    border-radius: 50px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.2s, background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ms-quickview-details-btn:hover {
    border-color: #999;
    background: #f7f7f7;
    color: var(--text);
}

/* Body locked when modal open */
body.ms-qv-locked {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 768px) {
    .ms-quickview-body {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    #ms-quickview-modal {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        border-radius: 12px;
    }

    .ms-quickview-image-col {
        padding: 20px;
    }

    .ms-quickview-image-col img {
        max-height: 300px;
    }

    .ms-quickview-details-col {
        padding: 20px;
    }

    .ms-quickview-title {
        font-size: 18px;
    }

    .ms-quickview-price {
        font-size: 18px;
    }
}
