/**
 * Size Charts Frontend Stylesheet
 *
 * @package WC_Enhancement_Kit
 * @subpackage Size_Charts
 */

/* Size Guide Open Link Style */
.wcek-size-chart-btn-wrapper {
    width: 100% !important;
    flex: 0 0 100% !important;
    /* Forces onto its own row in flexbox containers (form.cart) */
    margin-bottom: 15px !important;
}

/* Inline Size Guide Position styles */
.variations th.label {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
}

.variations th.label label {
    order: 1 !important;
    margin-bottom: 0 !important;
}

.variations th.label .woo-selected-variation-item-name {
    order: 2 !important;
    margin-left: 5px !important;
}

.wcek-size-chart-btn-wrapper.wcek-size-guide-inline {
    display: none !important;
}

th.label .wcek-size-chart-btn-wrapper.wcek-size-guide-inline,
.variations th.label .wcek-size-chart-btn-wrapper.wcek-size-guide-inline {
    display: inline-flex !important;
    order: 3 !important;
    width: auto !important;
    flex: 0 0 auto !important;
    margin-bottom: 0 !important;
    margin-left: 12px !important;
}

.wcek-size-chart-btn-wrapper.wcek-size-guide-inline a.wcek-size-chart-open-btn {
    font-size: 14px;
    text-transform: none !important;
}

.wcek-size-chart-open-btn:hover {
    color: #135e96 !important;
}

/* Modal Overlay Styling */
.wcek-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    box-sizing: border-box;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wcek-modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

/* Modal Content Container */
.wcek-modal-container {
    background: #fff;
    border-radius: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (min-width: 834px) {
    .wcek-modal-container {
        width: auto;
        min-width: 544px;
        max-width: calc(100% - 120px);
        max-height: calc(100% - 40px);
        height: auto;
        border-radius: 8px;
    }
}

.wcek-modal-overlay:not(.hidden) .wcek-modal-container {
    transform: scale(1);
}

/* Modal Header */
.wcek-modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 20px;
    /* border-bottom: 1px solid #eaeaea; */
    background: #fcfcfc;
    height: 60px;
    position: relative;
}

.wcek-modal-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
    text-align: center;
}

.wcek-modal-close-btn {
    position: absolute !important;
    right: 20px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    border: none !important;
    background: transparent !important;
    font-size: 24px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    color: #8c8f94 !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: color 0.2s ease-in-out !important;
}

.wcek-modal-close-btn:hover {
    color: #b32d2e !important;
}

/* Modal Body */
.wcek-modal-body {
    padding: 0 20px 15px 25px;
    overflow-y: auto;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.wcek-modal-image-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wcek-modal-image {
    max-width: 100%;
    max-height: calc(100vh - 150px);
    width: auto;
    height: auto;
    object-fit: contain;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

@media (min-width: 834px) {
    .wcek-modal-image {
        max-height: calc(100vh - 160px);
    }
}

.wcek-modal-description {
    text-align: center !important;
}

/* Scrollbar customizations for modal body */
.wcek-modal-body::-webkit-scrollbar {
    width: 6px;
}

.wcek-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.wcek-modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.wcek-modal-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Hidden Utility */
.wcek-modal-overlay.hidden,
.wcek-size-chart-btn-wrapper.hidden,
th.label .wcek-size-chart-btn-wrapper.wcek-size-guide-inline.hidden,
.variations th.label .wcek-size-chart-btn-wrapper.wcek-size-guide-inline.hidden {
    display: none !important;
}

/* Prevent parent body scrolling when open */
body.wcek-modal-open {
    overflow: hidden !important;
    padding-right: 15px;
    /* Adjusting for scrollbar jump */
}