/* Woo Size Charts – Frontend Styles */

/* ── Link ── */
.wsc-size-chart-link-wrap {
    margin: 8px 0;
}

.wsc-size-chart-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
    font-size: 0.9em;
    cursor: pointer;
    transition: opacity 0.2s;
}

.wsc-size-chart-link::before {
    content: "";
    display: inline-block;
    width: 15px;
    height: 15px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='3' y1='9' x2='21' y2='9'/%3E%3Cline x1='3' y1='15' x2='21' y2='15'/%3E%3Cline x1='9' y1='3' x2='9' y2='21'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.7;
    flex-shrink: 0;
}

.wsc-size-chart-link:hover {
    opacity: 0.7;
}

/* ── Popup Overlay ──
   IMPORTANT: Never use display:flex here — it would override display:none
   and block all page clicks. Use display:none by default.
   JS adds .wsc-open to show it. ── */
.wsc-popup-overlay {
    display: none;          /* hidden by default — JS controls this */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

/* When JS adds .wsc-open — switch to flex and animate in */
.wsc-popup-overlay.wsc-open {
    display: flex;
    animation: wscFadeIn 0.18s ease forwards;
}

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

/* ── Popup Container ── */
.wsc-popup-container {
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 820px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    animation: wscSlideUp 0.18s ease forwards;
    overflow: hidden;
}

@keyframes wscSlideUp {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── Header ── */
.wsc-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.wsc-popup-title {
    margin: 0;
    font-size: 1.15em;
    font-weight: 600;
    line-height: 1.3;
}

.wsc-popup-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #777;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.wsc-popup-close:hover {
    background: #f0f0f0;
    color: #111;
}

/* ── Body ── */
.wsc-popup-body {
    padding: 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

/* ── Tables inside popup ── */
.wsc-popup-body table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9em;
}

.wsc-popup-body table th,
.wsc-popup-body table td {
    padding: 8px 12px;
    border: 1px solid #ddd;
    text-align: center;
}

.wsc-popup-body table th {
    background: #f5f5f5;
    font-weight: 600;
}

.wsc-popup-body table tr:nth-child(even) td {
    background: #fafafa;
}

/* ── Horizontal scroll helper (matches the CSS from your screenshot) ── */
.wsc-popup-body .horizontal-scroll-except-first-column {
    width: 100%;
    overflow: auto;
}

.wsc-popup-body .horizontal-scroll-except-first-column > table {
    margin-left: 10em;
}

.wsc-popup-body .horizontal-scroll-except-first-column > table > tr > th:first-child,
.wsc-popup-body .horizontal-scroll-except-first-column > table > tr > td:first-child {
    position: absolute;
    width: 10em;
    margin-left: -10em;
    background: #ccc;
}

.wsc-popup-body .table-sc {
    min-width: 400px;
    white-space: nowrap;
    border: none;
    font-size: 11px;
}

.wsc-popup-body .table-sc tr {
    height: 60px;
    vertical-align: middle;
}

.wsc-popup-body .table-sc td {
    width: fit-content;
    white-space: nowrap;
    text-align: center;
}

/* ── Prevent body scroll when popup is open ── */
body.wsc-popup-open {
    overflow: hidden;
}

/* ── Mobile ── */
@media (max-width: 600px) {
    .wsc-popup-container {
        max-width: 100%;
        max-height: 100dvh;
        border-radius: 0;
    }

    .wsc-popup-header {
        padding: 12px 16px;
    }

    .wsc-popup-body {
        padding: 16px;
    }
}

/* ── Import size chart table styles ── */
/* (duplicated inline below for single-file simplicity) */

.horizontal-scroll-except-first-column {
    width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.horizontal-scroll-except-first-column > table {
    margin-left: 10em;
}

.horizontal-scroll-except-first-column > table > * > tr > th:first-child,
.horizontal-scroll-except-first-column > table > * > tr > td:first-child {
    position: absolute;
    width: 10em;
    margin-left: -10em;
    background: #ccc;
    z-index: 1;
}

.table-sc {
    min-width: 400px;
    white-space: nowrap;
    border: none;
    font-size: 11px;
    border-collapse: collapse;
}

.table-sc tr {
    height: 60px;
    vertical-align: middle;
}

.table-sc td {
    width: fit-content;
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
    padding: 4px 8px;
    border: 1px solid #ddd;
}

.table-sc td:nth-of-type(even),
.table-sc thead th:nth-of-type(even) {
    background-color: #f0f0f5;
}

.size-chart-heading {
    background-color: #cccccc !important;
    font-weight: bold;
    white-space: normal !important;
    min-width: 120px;
    height: 60px;
    text-align: left !important;
    padding: 4px 8px !important;
    vertical-align: middle;
}

.wsc-popup-body h3 {
    margin: 0 0 10px;
    font-size: 1em;
    font-weight: 600;
    border-bottom: 2px solid #e5e5e5;
    padding-bottom: 6px;
}

.wsc-popup-body h3:not(:first-child) {
    margin-top: 24px;
}
