/* Boutique 3D Body Measurement Guide — premium UI */
.bmg-root {
    --bmg-bg: #0e1116;
    --bmg-card: #161b22;
    --bmg-border: #2a2f37;
    --bmg-text: #e6e9ef;
    --bmg-muted: #8a93a3;
    --bmg-accent: #ff7a3d;
    --bmg-accent2: #ffb27a;
    --bmg-radius: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-sizing: border-box;
    max-width: 100%;
    margin: 24px auto;
    color: var(--bmg-text);
}
.bmg-root * { box-sizing: border-box; }

.bmg-viewer {
    width: 100%;
    background: radial-gradient(circle at 50% 35%, #1c2230 0%, #0b0e13 75%);
    border-radius: var(--bmg-radius);
    overflow: hidden;
    border: 1px solid var(--bmg-border);
    position: relative;
    box-shadow: 0 30px 60px -20px rgba(0,0,0,0.7);
}

.bmg-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--bmg-muted);
    font-size: 14px;
    letter-spacing: 0.04em;
}
.bmg-spinner {
    width: 38px; height: 38px;
    border: 3px solid rgba(255,255,255,0.12);
    border-top-color: var(--bmg-accent);
    border-radius: 50%;
    animation: bmg-spin 0.8s linear infinite;
}
@keyframes bmg-spin { to { transform: rotate(360deg); } }

/* Toolbar */
.bmg-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 6px;
    flex-wrap: wrap;
}
.bmg-gender-toggle {
    display: inline-flex;
    background: var(--bmg-card);
    border: 1px solid var(--bmg-border);
    border-radius: 999px;
    padding: 4px;
}
.bmg-gender-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--bmg-muted);
    padding: 8px 22px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.04em;
}
.bmg-gender-btn:hover { color: var(--bmg-text); }
.bmg-gender-btn.is-active {
    background: linear-gradient(135deg, var(--bmg-accent), var(--bmg-accent2));
    color: #1a1209;
    box-shadow: 0 6px 20px -6px rgba(255, 122, 61, 0.6);
}

.bmg-hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--bmg-muted);
    font-size: 12px;
    letter-spacing: 0.03em;
}
.bmg-hint-dot {
    width: 8px; height: 8px;
    background: var(--bmg-accent);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(255,122,61,0.2);
    animation: bmg-pulse 1.8s ease-in-out infinite;
}
@keyframes bmg-pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(255,122,61,0.45); }
    50%     { box-shadow: 0 0 0 7px rgba(255,122,61,0); }
}

/* Quick-pick chips */
.bmg-quick-pick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 18px;
}
.bmg-chip {
    appearance: none;
    border: 1px solid var(--bmg-border);
    background: var(--bmg-card);
    color: var(--bmg-text);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.bmg-chip:hover {
    border-color: var(--bmg-accent);
    color: var(--bmg-accent2);
    transform: translateY(-1px);
}
.bmg-chip-emoji { font-size: 14px; }

/* Modal — HIGH Z-INDEX to ensure it appears above everything */
.bmg-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 100001 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    pointer-events: auto !important;
}
.bmg-modal[hidden] { display: none !important; }
.bmg-modal:not([hidden]) { display: flex !important; }
.bmg-modal.is-open .bmg-modal-card { animation: bmg-pop 0.3s cubic-bezier(.2,.9,.3,1.4); }
.bmg-modal.is-open .bmg-modal-backdrop { animation: bmg-fade 0.25s ease; }
@keyframes bmg-pop {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes bmg-fade { from { opacity: 0; } to { opacity: 1; } }

.bmg-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8,10,14,0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.bmg-modal-card {
    position: relative;
    background: linear-gradient(180deg, #1a1f28 0%, #11151c 100%);
    border: 1px solid var(--bmg-border);
    border-radius: 18px;
    max-width: 460px;
    width: 100%;
    max-height: 86vh;
    overflow-y: auto;
    padding: 28px 26px 24px;
    box-shadow: 0 30px 80px -20px rgba(0,0,0,0.8);
}
.bmg-modal-close {
    position: absolute;
    top: 14px; right: 16px;
    appearance: none;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--bmg-border);
    color: var(--bmg-muted);
    width: 32px; height: 32px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}
.bmg-modal-close:hover { color: var(--bmg-text); background: rgba(255,255,255,0.12); }

.bmg-modal-icon {
    font-size: 42px;
    text-align: center;
    margin-bottom: 6px;
}
.bmg-modal-title {
    text-align: center;
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
    color: var(--bmg-text);
    letter-spacing: -0.01em;
}
.bmg-modal-subtitle {
    text-align: center;
    color: var(--bmg-muted);
    margin: 0 0 18px;
    font-size: 13.5px;
}
.bmg-modal-steps h4,
.bmg-modal-tips h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bmg-accent2);
    margin: 16px 0 8px;
    font-weight: 600;
}
.bmg-modal-steps ol {
    margin: 0 0 4px;
    padding-left: 20px;
    color: var(--bmg-text);
    font-size: 14px;
    line-height: 1.7;
}
.bmg-modal-steps li { margin-bottom: 4px; }
.bmg-modal-tips ul {
    margin: 0;
    padding-left: 18px;
    color: var(--bmg-muted);
    font-size: 13px;
    line-height: 1.6;
}
.bmg-modal-cta {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--bmg-border);
    font-size: 12.5px;
    color: var(--bmg-muted);
}
.bmg-modal-garments {
    color: var(--bmg-accent2);
    font-weight: 600;
}

/* Mobile */
@media (max-width: 600px) {
    .bmg-modal-card { padding: 24px 18px 18px; }
    .bmg-toolbar { justify-content: center; }
    .bmg-hint { display: none; }
}

/* ===========================================
   BUTTON + POPUP MODE
   Shortcode: [body_measurement_guide_button]
   =========================================== */

/* Trigger button alignment wrapper */
.bmg-trigger-wrap {
    margin: 24px 0;
}
.bmg-align-left   { text-align: left; }
.bmg-align-center { text-align: center; }
.bmg-align-right  { text-align: right; }

/* Button styles */
.bmg-trigger-btn {
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    border: none;
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: all 0.25s cubic-bezier(.2,.9,.3,1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.bmg-btn-primary {
    background: linear-gradient(135deg, #ff7a3d, #ffb27a);
    color: #1a1209;
    box-shadow: 0 10px 30px -8px rgba(255, 122, 61, 0.55);
}
.bmg-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 38px -8px rgba(255, 122, 61, 0.7);
}

.bmg-btn-outline {
    background: transparent;
    color: #ff7a3d;
    border: 2px solid #ff7a3d;
}
.bmg-btn-outline:hover {
    background: #ff7a3d;
    color: #1a1209;
    transform: translateY(-2px);
}

.bmg-btn-minimal {
    background: #161b22;
    color: #e6e9ef;
    border: 1px solid #2a2f37;
}
.bmg-btn-minimal:hover {
    border-color: #ff7a3d;
    color: #ffb27a;
    transform: translateY(-1px);
}

/* Fullscreen popup */
.bmg-popup {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.bmg-popup[hidden] { display: none; }

.bmg-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 8, 12, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: bmg-fade 0.3s ease;
}

.bmg-popup-shell {
    position: relative;
    background: linear-gradient(180deg, #131820 0%, #0c0f14 100%);
    border: 1px solid #2a2f37;
    border-radius: 20px;
    width: 100%;
    max-width: 760px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 40px 90px -20px rgba(0,0,0,0.85);
    animation: bmg-pop 0.35s cubic-bezier(.2,.9,.3,1.2);
}

.bmg-popup-close {
    position: absolute;
    top: 16px; right: 18px;
    z-index: 5;
    appearance: none;
    background: rgba(255,255,255,0.08);
    border: 1px solid #2a2f37;
    color: #b6bdca;
    width: 36px; height: 36px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}
.bmg-popup-close:hover {
    color: #fff;
    background: rgba(255, 90, 70, 0.25);
    border-color: rgba(255, 90, 70, 0.5);
}

.bmg-popup-head {
    padding: 26px 28px 16px;
    border-bottom: 1px solid #1f242c;
}
.bmg-popup-head h3 {
    margin: 0 0 4px;
    font-size: 19px;
    color: #e6e9ef;
    letter-spacing: -0.01em;
}
.bmg-popup-head p {
    margin: 0;
    font-size: 13px;
    color: #8a93a3;
}
.bmg-popup-body {
    padding: 18px 24px 26px;
}

/* Make the popup inherit bmg-root styles for the viewer internals */
.bmg-popup .bmg-viewer {
    border-radius: 14px;
}
.bmg-popup .bmg-toolbar,
.bmg-popup .bmg-quick-pick {
    /* same as .bmg-root children — no override needed since CSS targets by class */
}

/* Mobile tweaks for popup */
@media (max-width: 600px) {
    .bmg-popup-shell { border-radius: 14px; }
    .bmg-popup-head { padding: 20px 18px 12px; }
    .bmg-popup-body { padding: 14px 14px 20px; }
    .bmg-popup .bmg-viewer { height: 460px !important; }
}

/* Lock body scroll when popup open */
body.bmg-no-scroll { overflow: hidden; }

/* ===========================================
   LANGUAGE TOGGLE
   =========================================== */
.bmg-lang-toggle {
    display: inline-flex;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--bmg-border);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}
.bmg-lang-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--bmg-muted);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.bmg-lang-btn:hover { color: var(--bmg-text); }
.bmg-lang-btn.is-active {
    background: var(--bmg-card);
    color: var(--bmg-accent2);
    box-shadow: 0 2px 6px -2px rgba(0,0,0,0.4);
}

.bmg-popup-lang { margin-left: auto; }

.bmg-toolbar .bmg-lang-toggle { margin-left: 12px; }

/* ===========================================
   SAVE UI (inside modal)
   =========================================== */
.bmg-modal-save {
    margin-top: 18px;
    padding: 16px;
    background: rgba(255, 122, 61, 0.06);
    border: 1px dashed rgba(255, 122, 61, 0.35);
    border-radius: 12px;
}
.bmg-save-heading {
    margin: 0 0 10px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bmg-accent2);
    font-weight: 600;
}
.bmg-save-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.bmg-save-row label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bmg-card);
    border: 1px solid var(--bmg-border);
    padding: 8px 12px;
    border-radius: 8px;
}
.bmg-save-label {
    font-size: 12px;
    color: var(--bmg-muted);
}
.bmg-save-input {
    width: 80px;
    background: transparent;
    border: none;
    color: var(--bmg-text);
    font-size: 16px;
    font-weight: 700;
    outline: none;
    text-align: center;
}
.bmg-save-input:focus { color: var(--bmg-accent2); }
.bmg-save-unit {
    font-size: 11px;
    color: var(--bmg-muted);
}
.bmg-save-btn {
    appearance: none;
    border: none;
    background: linear-gradient(135deg, var(--bmg-accent), var(--bmg-accent2));
    color: #1a1209;
    padding: 9px 22px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}
.bmg-save-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -6px rgba(255,122,61,0.6); }
.bmg-save-btn.is-saved { background: #2ecc71; color: #0a3622; }
.bmg-save-hint {
    margin: 10px 0 0;
    font-size: 11.5px;
    color: var(--bmg-muted);
}

/* ===========================================
   FLOATING BUTTON (FAB)
   =========================================== */
.bmg-floating-wrap {
    position: fixed;
    bottom: 180px;
    right: 22px;
    z-index: 99997;
}
.bmg-fab {
    appearance: none;
    border: none;
    cursor: pointer;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff7a3d, #ffb27a);
    color: #1a1209;
    font-size: 28px;
    line-height: 1;
    box-shadow: 0 12px 30px -8px rgba(255, 122, 61, 0.7), 0 0 0 0 rgba(255, 122, 61, 0.4);
    transition: all 0.25s cubic-bezier(.2,.9,.3,1);
    animation: bmg-fab-pulse 2.4s ease-in-out infinite;
}
.bmg-fab:hover {
    transform: scale(1.08) rotate(-5deg);
    box-shadow: 0 18px 40px -8px rgba(255, 122, 61, 0.85);
}
@keyframes bmg-fab-pulse {
    0%, 100% { box-shadow: 0 12px 30px -8px rgba(255, 122, 61, 0.7), 0 0 0 0 rgba(255, 122, 61, 0.45); }
    50%      { box-shadow: 0 12px 30px -8px rgba(255, 122, 61, 0.7), 0 0 0 16px rgba(255, 122, 61, 0); }
}

@media (max-width: 600px) {
    .bmg-floating-wrap { bottom: 200px !important; right: 16px !important; }
    .bmg-fab { width: 52px; height: 52px; font-size: 24px; }
}

.bmg-root.bmg-rtl,
.bmg-popup.bmg-rtl {
    direction: rtl;
    text-align: right;
}
.bmg-popup.bmg-rtl .bmg-popup-close {
    left: 16px;
    right: auto;
}

.bmg-modal.bmg-rtl {
    direction: rtl;
    text-align: right;
}
.bmg-modal.bmg-rtl .bmg-modal-close { left: 16px; right: auto; }
.bmg-modal.bmg-rtl .bmg-modal-steps ol,
.bmg-modal.bmg-rtl .bmg-modal-tips ul {
    padding-left: 0;
    padding-right: 20px;
}
.bmg-modal.bmg-rtl .bmg-modal-steps h4,
.bmg-modal.bmg-rtl .bmg-modal-tips h4 {
    text-align: right;
}
.bmg-modal.bmg-rtl .bmg-save-row { flex-direction: row-reverse; }

/* ===========================================
   My Measurements dashboard
   =========================================== */
.bmg-my-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 760px;
    margin: 24px auto;
    color: #2a2f37;
}
.bmg-my-notice {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-left: 4px solid #ffb300;
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    color: #5d4a1a;
}
.bmg-my-notice strong { display: block; margin-bottom: 4px; color: #3d2f00; }
.bmg-my-notice a { color: #c75b00; font-weight: 600; }

.bmg-my-header h3 {
    margin: 0 0 4px;
    font-size: 20px;
    color: #1a1f28;
}
.bmg-my-header p {
    margin: 0 0 16px;
    color: #6b7280;
    font-size: 14px;
}
.bmg-my-list { display: flex; flex-direction: column; gap: 10px; }
.bmg-my-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.2s ease;
}
.bmg-my-row:hover { box-shadow: 0 6px 18px -8px rgba(0,0,0,0.18); border-color: #d1d5db; }
.bmg-my-row-icon { font-size: 26px; width: 40px; text-align: center; }
.bmg-my-row-info { flex: 1; min-width: 0; }
.bmg-my-row-label { font-weight: 700; color: #1a1f28; font-size: 14.5px; }
.bmg-my-row-garments { font-size: 12px; color: #6b7280; margin-top: 2px; }
.bmg-my-row-value {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    background: #f3f4f6;
    padding: 8px 14px;
    border-radius: 8px;
    min-width: 90px;
    justify-content: center;
}
.bmg-my-row-num { font-size: 18px; font-weight: 700; color: #ff7a3d; }
.bmg-my-row-unit { font-size: 11px; color: #6b7280; }
.bmg-my-row-actions { display: flex; gap: 6px; }
.bmg-my-edit, .bmg-my-delete, .bmg-my-save, .bmg-my-cancel {
    appearance: none;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 12.5px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.bmg-my-edit:hover { border-color: #ff7a3d; color: #ff7a3d; }
.bmg-my-delete:hover { border-color: #ef4444; color: #ef4444; background: #fef2f2; }
.bmg-my-save { background: #ff7a3d; color: #fff; border-color: #ff7a3d; }
.bmg-my-save:hover { background: #e96a2d; }
.bmg-my-cancel:hover { background: #f9fafb; }
.bmg-my-edit-input {
    width: 70px;
    padding: 6px 8px;
    border: 2px solid #ff7a3d;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    color: #1a1f28;
    text-align: center;
    outline: none;
}

/* WooCommerce product page wrap */
.bmg-wc-wrap {
    margin: 18px 0;
    text-align: center;
}
.bmg-wc-btn {
    box-shadow: 0 10px 24px -8px rgba(255, 122, 61, 0.55);
}

/* ===========================================
   THEME INTEGRATION — Daroodi style
   (For custom theme buttons that match dark gold boutique aesthetic)
   =========================================== */
.bmg-theme-trigger.bmg-daroodi-style {
    background: linear-gradient(135deg, #c9a96e 0%, #b8945a 50%, #8b6f3f 100%);
    color: #1a1209;
    border: 1px solid #d4af37;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
    box-shadow: 0 6px 18px -6px rgba(201, 169, 110, 0.6);
    width: 100%;
    justify-content: center;
}
.bmg-theme-trigger.bmg-daroodi-style:hover {
    background: linear-gradient(135deg, #d4af37 0%, #c9a96e 50%, #a88656 100%);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px -6px rgba(212, 175, 55, 0.75);
}
.bmg-theme-trigger.bmg-daroodi-style:active {
    transform: translateY(0);
}

/* Standalone theme button — works without .bmg-trigger-btn classes */
.daroodi-measure-btn {
    background: linear-gradient(135deg, #c9a96e 0%, #b8945a 50%, #8b6f3f 100%);
    color: #1a1209;
    border: 1px solid #d4af37;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
    box-shadow: 0 6px 18px -6px rgba(201, 169, 110, 0.6);
    font-family: inherit;
    width: 100%;
    justify-content: center;
}
.daroodi-measure-btn:hover {
    background: linear-gradient(135deg, #d4af37 0%, #c9a96e 50%, #a88656 100%);
    transform: translateY(-1px);
}
.daroodi-measure-btn svg {
    width: 16px; height: 16px; flex-shrink: 0;
}

/* Custom Desktop Floating Style for Modal */
@media (min-width: 768px) {
    .bmg-modal {
        pointer-events: none !important;
        background: transparent !important;
    }
    .bmg-modal-backdrop {
        display: none !important;
    }
    .bmg-modal-card {
        pointer-events: auto !important;
        margin: 0 !important;
        box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5) !important;
        border: 1px solid var(--bmg-accent, #ff7a3d) !important;
    }
}

/* ===========================================
   LIGHTWEIGHT 2D VECTOR SVG MANNEQUIN SCHEMATIC
   =========================================== */
.bmg-body-svg {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
}
.bmg-body-silhouette,
.bmg-body-head {
    transition: all 0.4s ease;
}
.bmg-tape-line {
    transition: all 0.3s ease;
}
.bmg-hotspot {
    fill: #cfa353;
    stroke: #ffffff;
    stroke-width: 2px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.bmg-hotspot:hover {
    fill: #ff7a3d;
    r: 13px;
    filter: drop-shadow(0 0 8px rgba(255, 122, 61, 0.8));
}
.bmg-hotspot.bmg-highlighted {
    fill: #ff7a3d !important;
    r: 14px !important;
    stroke-width: 3px;
    filter: drop-shadow(0 0 12px rgba(255, 122, 61, 0.95));
}
.bmg-tape-line.bmg-highlighted {
    stroke: #ff7a3d !important;
    stroke-width: 3px !important;
    filter: drop-shadow(0 0 6px rgba(255, 122, 61, 0.8));
}
