/* ==========================================================================
   BB-WooAutomate — Size Chart Frontend
   ========================================================================== */

/* ── Trigger row (heading text + link) ─────────────────────────────── */
.bbwa-sc-trigger-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bbwa-sc-heading-text {
    color: #1d2327;
    font-weight: 600;
}

/* ── Trigger link ─────────────────────────────────────────────────── */
.bbwa-sc-trigger {
    color: #2a9d8f;
    text-decoration: underline;
    font-weight: 600;
    cursor: pointer;
    transition: color .2s;
}
.bbwa-sc-trigger:hover {
    color: #21867a;
}

/* ── Overlay (shared by popup + slide) ────────────────────────────── */
.bbwa-sc-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex; /* overridden when hidden */
}

.bbwa-sc-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
}

/* ── Panel (popup mode — centered modal) ──────────────────────────── */
.bbwa-sc-display-popup {
    align-items: center;
    justify-content: center;
}

.bbwa-sc-display-popup .bbwa-sc-panel {
    position: relative;
    width: 90%;
    max-width: 680px;
    max-height: 90vh;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
    overflow-y: auto;
    animation: bbwaSCFadeIn .25s ease;
    z-index: 1;
}

/* ── Panel (slide mode — right drawer) ────────────────────────────── */
.bbwa-sc-display-slide {
    justify-content: flex-end;
}

.bbwa-sc-display-slide .bbwa-sc-panel {
    position: relative;
    width: 420px;
    max-width: 95vw;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, .15);
    overflow-y: auto;
    animation: bbwaSCSlideIn .3s ease;
    z-index: 1;
}

/* ── Animations ───────────────────────────────────────────────────── */
@keyframes bbwaSCFadeIn {
    from { opacity: 0; transform: scale(.95); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes bbwaSCSlideIn {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

/* ── Close button ─────────────────────────────────────────────────── */
.bbwa-sc-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #555;
    cursor: pointer;
    z-index: 2;
    padding: 4px 8px;
    transition: color .2s;
}
.bbwa-sc-close:hover {
    color: #000;
}

/* ── Tabs ─────────────────────────────────────────────────────────── */
.bbwa-sc-tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    padding: 0 20px;
    margin-top: 16px;
}

.bbwa-sc-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: color .2s, border-color .2s;
    white-space: nowrap;
}
.bbwa-sc-tab:hover {
    color: #555;
}
.bbwa-sc-tab.active {
    color: #2a9d8f;
    border-bottom-color: #2a9d8f;
}

/* ── Tab Content ──────────────────────────────────────────────────── */
.bbwa-sc-tab-content {
    padding: 20px;
}

/* ── Unit toggle ──────────────────────────────────────────────────── */
.bbwa-sc-unit-toggle {
    display: flex;
    justify-content: flex-end;
    gap: 0;
    margin-bottom: 12px;
}

.bbwa-sc-unit-btn {
    padding: 6px 18px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .5px;
    border: 1px solid #ddd;
    background: #fff;
    color: #888;
    cursor: pointer;
    transition: all .2s;
}
.bbwa-sc-unit-btn:first-child {
    border-radius: 4px 0 0 4px;
}
.bbwa-sc-unit-btn:last-child {
    border-radius: 0 4px 4px 0;
    border-left: none;
}
.bbwa-sc-unit-btn.active {
    background: #2a9d8f;
    border-color: #2a9d8f;
    color: #fff;
}

/* ── Scroll hint ──────────────────────────────────────────────────── */
.bbwa-sc-scroll-hint {
    color: #2a9d8f;
    font-size: 13px;
    text-align: center;
    margin-bottom: 8px;
}
/* Desktop & Tablet: hide scroll hint inside popup — only show in slide */
.bbwa-sc-display-popup .bbwa-sc-scroll-hint {
    display: none;
}

/* ── Size table ───────────────────────────────────────────────────── */
.bbwa-sc-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.bbwa-sc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.bbwa-sc-table th {
    background: #f8f8f8;
    font-weight: 600;
    color: #555;
    padding: 10px 14px;
    text-align: center;
    white-space: nowrap;
    border-bottom: 2px solid #eee;
}
.bbwa-sc-table td {
    padding: 10px 14px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    color: #444;
}
.bbwa-sc-table tbody tr:hover {
    background: #f5fffe;
}
.bbwa-sc-size-cell {
    font-weight: 600;
    color: #333;
}

/* ── Fit Guide ────────────────────────────────────────────────────── */
.bbwa-sc-fit-image {
    text-align: center;
}
.bbwa-sc-fit-image img {
    max-width: 100%;
    height: auto;
}

/* ── How To Measure ───────────────────────────────────────────────── */
.bbwa-sc-measure-image {
    text-align: center;
    margin-bottom: 20px;
}
.bbwa-sc-measure-image img {
    max-width: 100%;
    height: auto;
}

.bbwa-sc-measure-note {
    background: #f8f8f8;
    padding: 12px 16px;
    border-radius: 4px;
    color: #555;
    font-size: 13px;
    margin-bottom: 16px;
}

.bbwa-sc-instruction {
    padding: 12px 0;
    border-top: 1px solid #eee;
}
.bbwa-sc-instruction strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
    color: #333;
}
.bbwa-sc-instruction p {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* ── Empty tab ────────────────────────────────────────────────────── */
.bbwa-sc-empty-tab {
    text-align: center;
    color: #999;
    padding: 40px 20px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* Tablet */
@media (max-width: 768px) {
    .bbwa-sc-display-popup .bbwa-sc-panel {
        width: 95%;
        max-height: 85vh;
        border-radius: 8px;
    }
    .bbwa-sc-display-slide .bbwa-sc-panel {
        width: 100%;
    }
    .bbwa-sc-tabs {
        padding: 0 12px;
    }
    .bbwa-sc-tab {
        padding: 10px 12px;
        font-size: 13px;
    }
    .bbwa-sc-tab-content {
        padding: 14px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    /* On mobile, show scroll hint in both popup and slide */
    .bbwa-sc-display-popup .bbwa-sc-scroll-hint {
        display: block;
    }
    .bbwa-sc-display-popup .bbwa-sc-panel,
    .bbwa-sc-display-slide .bbwa-sc-panel {
        width: 100%;
        max-width: 100vw;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    .bbwa-sc-tabs {
        padding: 0 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .bbwa-sc-tab {
        padding: 10px 10px;
        font-size: 12px;
    }
    .bbwa-sc-unit-btn {
        padding: 5px 12px;
        font-size: 11px;
    }
    .bbwa-sc-table {
        font-size: 13px;
    }
    .bbwa-sc-table th,
    .bbwa-sc-table td {
        padding: 8px 10px;
    }
}
