/* ── OBM Pricing Manager – Public Styles ────────────────────────────────────── */
:root {
    --obm-primary: #1a4fa0;
    --obm-accent:  #f0a500;
    --obm-border:  #e0e4ef;
    --obm-bg:      #f7f9fc;
    --obm-text:    #1a1e2e;
    --obm-muted:   #6b7280;
    --obm-radius:  10px;
    --obm-shadow:  0 4px 24px rgba(26,79,160,.10);
}

/* ── Wrapper ─────────────────────────────────────────────────────────────────── */
.obm-pm-public-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 24px 0;
    color: var(--obm-text);
}

/* ── Header ──────────────────────────────────────────────────────────────────── */
.obm-pm-public-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}
.obm-pm-public-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--obm-primary);
    margin: 0;
    padding: 0;
}
.obm-pm-public-title::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: var(--obm-accent);
    border-radius: 2px;
    margin-top: 5px;
}

/* ── Export button ───────────────────────────────────────────────────────────── */
.obm-pm-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: var(--obm-primary);
    color: #fff !important;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background .2s;
    white-space: nowrap;
}
.obm-pm-export-btn:hover { background: #123e84; }

/* ── Table wrapper ────────────────────────────────────────────────────────────
   overflow-x: auto  →  all columns scrollable on mobile (no clipping)        */
.obm-pm-table-wrapper {
    background: #fff;
    border: 1px solid var(--obm-border);
    border-radius: var(--obm-radius);
    box-shadow: var(--obm-shadow);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── DataTables chrome ───────────────────────────────────────────────────────── */
.dataTables_wrapper { padding: 14px 16px; font-size: 13px; }
.dataTables_filter  { margin-bottom: 10px; }
.dataTables_filter input {
    border: 1px solid var(--obm-border) !important;
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 13px;
    min-width: 200px;
    outline: none;
    transition: border-color .2s;
}
.dataTables_filter input:focus { border-color: var(--obm-primary) !important; }
.dataTables_length select {
    border: 1px solid var(--obm-border);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 13px;
}
.dataTables_info, .dataTables_length { color: var(--obm-muted); }
.dataTables_paginate .paginate_button {
    border-radius: 5px !important;
    padding: 5px 11px !important;
    font-size: 13px !important;
    cursor: pointer;
}
.dataTables_paginate .paginate_button.current {
    background: var(--obm-primary) !important;
    border-color: var(--obm-primary) !important;
    color: #fff !important;
}
.dataTables_paginate .paginate_button:hover:not(.current) {
    background: var(--obm-bg) !important;
    border-color: var(--obm-border) !important;
    color: var(--obm-primary) !important;
}

/* ── Table ───────────────────────────────────────────────────────────────────── */
.obm-pm-frontend-table {
    width: 100% !important;
    border-collapse: collapse;
    font-size: 14px;
}
.obm-pm-frontend-table thead th {
    background: var(--obm-primary);
    color: #fff !important;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 12px 14px;
    border: none !important;
    white-space: nowrap;
    outline: none;
}
table.dataTable thead .sorting::before,
table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::before,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::before,
table.dataTable thead .sorting_desc::after { opacity: .55; }

.obm-pm-frontend-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--obm-border);
    vertical-align: middle;
    line-height: 1.5;
}
.obm-pm-frontend-table tbody tr:last-child td { border-bottom: none; }
.obm-pm-frontend-table tbody tr:nth-child(even) { background: var(--obm-bg); }
.obm-pm-frontend-table tbody tr:hover { background: #eef2fb; }

/* ── DataTables Responsive — dedicated last-column expand button ─────────────── */

/* Control column header: invisible, right-aligned, sits flush in the blue bar */
.obm-pm-frontend-table thead th.obm-pm-ctrl-th,
th.dtr-control {
    width: 36px !important;
    min-width: 36px;
    padding: 0 !important;
    background: var(--obm-primary);
    border: none !important;
}

/* Control column body cell */
.obm-pm-frontend-table tbody td.obm-pm-ctrl-td,
td.dtr-control {
    width: 36px !important;
    min-width: 36px;
    padding: 0 6px !important;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
}

/* The "+" icon DataTables Responsive injects */
table.dataTable > tbody > tr > td.dtr-control::before {
    background-color: var(--obm-primary) !important;
    border-color: #fff !important;
    box-shadow: 0 0 0 2px var(--obm-primary) !important;
    width: 18px !important;
    height: 18px !important;
    line-height: 16px !important;
    font-size: 13px !important;
    margin: 0 auto;
}
/* Expanded "−" state */
table.dataTable > tbody > tr.parent > td.dtr-control::before {
    background-color: var(--obm-accent) !important;
    box-shadow: 0 0 0 2px var(--obm-accent) !important;
}

/* Child / expanded detail row */
table.dataTable > tbody > tr.child { background: #f0f5ff !important; }
table.dataTable > tbody > tr.child td.child {
    padding: 10px 14px !important;
    border-bottom: none !important;
}
table.dataTable > tbody > tr.child ul.dtr-details {
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}
table.dataTable > tbody > tr.child ul.dtr-details > li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--obm-border);
    font-size: 13px;
    line-height: 1.45;
}
table.dataTable > tbody > tr.child ul.dtr-details > li:last-child { border-bottom: none; }
table.dataTable > tbody > tr.child ul.dtr-details .dtr-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--obm-muted);
    min-width: 120px;
    flex-shrink: 0;
    padding-top: 2px;
}
table.dataTable > tbody > tr.child ul.dtr-details .dtr-data { flex: 1; }

/* ── Cell specifics ──────────────────────────────────────────────────────────── */
.obm-pm-price {
    font-weight: 800;
    color: var(--obm-primary);
    font-size: 15px;
    white-space: nowrap;
}
.obm-pm-code {
    background: #eef2fb;
    color: var(--obm-primary);
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}
.obm-pm-no-image { color: var(--obm-muted); }

/* ── Product image thumbnail ─────────────────────────────────────────────────── */
.obm-pm-img-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}
.obm-pm-product-img {
    width: 58px;
    height: 58px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid var(--obm-border);
    background: var(--obm-bg);
    display: block;
    cursor: zoom-in;
    transition: transform .18s, box-shadow .18s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.obm-pm-product-img:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(26,79,160,.22);
}

/* Image inside expanded child row — larger */
.dtr-details .obm-pm-product-img {
    width: 80px;
    height: 80px;
    cursor: zoom-in;
}

/* ── Empty / Error ───────────────────────────────────────────────────────────── */
.obm-pm-empty {
    padding: 40px 24px;
    text-align: center;
    color: var(--obm-muted);
    background: var(--obm-bg);
    border-radius: var(--obm-radius);
    border: 1px solid var(--obm-border);
    font-size: 14px;
}
.obm-pm-error {
    color: #dc3545;
    background: #fff5f5;
    border: 1px solid #f5c6cb;
    border-radius: 7px;
    padding: 10px 16px;
    font-size: 13px;
}

/* ── Mobile tweaks ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .obm-pm-public-title { font-size: 18px; }
    .dataTables_wrapper  { padding: 10px; }
    .dataTables_filter input {
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
        display: block;
        margin-top: 4px;
    }
    .dataTables_filter label { display: block; }
    .obm-pm-frontend-table tbody td { padding: 9px 10px; font-size: 13px; }
    .obm-pm-frontend-table thead th { padding: 10px; font-size: 11px; }
    .obm-pm-price { font-size: 15px; }
    .obm-pm-product-img { width: 50px; height: 50px; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   LIGHTBOX
═══════════════════════════════════════════════════════════════════════════════ */
html.obm-lb-open { overflow: hidden !important; }

.obm-pm-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.obm-pm-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 28, .90);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
}
.obm-pm-lightbox-box {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: min(90vw, 680px);
    animation: obm-lb-in .22s cubic-bezier(.22, 1, .36, 1);
}
@keyframes obm-lb-in {
    from { opacity: 0; transform: scale(.88) translateY(18px); }
    to   { opacity: 1; transform: none; }
}
.obm-pm-lightbox-close {
    position: absolute;
    top: -16px;
    right: -16px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--obm-text);
    box-shadow: 0 4px 20px rgba(0,0,0,.40);
    transition: background .15s, color .15s, transform .15s;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.obm-pm-lightbox-close:hover,
.obm-pm-lightbox-close:focus {
    background: var(--obm-accent);
    color: #fff;
    transform: scale(1.1);
    outline: none;
}
.obm-pm-lightbox-img-wrap {
    background: #fff;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 24px 72px rgba(0,0,0,.50);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    min-height: 140px;
    max-height: 82vh;
}
.obm-pm-lightbox-img {
    display: block;
    max-width: 100%;
    max-height: calc(82vh - 28px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
}
.obm-pm-lightbox-img-wrap.obm-lb-loading { min-height: 180px; }
.obm-pm-lightbox-img-wrap.obm-lb-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid rgba(26,79,160,.25);
    border-top-color: var(--obm-primary);
    border-radius: 50%;
    animation: obm-spin .7s linear infinite;
}
@keyframes obm-spin { to { transform: rotate(360deg); } }
.obm-pm-lightbox-caption {
    color: rgba(255,255,255,.78);
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    text-align: center;
    margin: 0;
    padding: 0 8px;
    line-height: 1.5;
}
@media (max-width: 480px) {
    .obm-pm-lightbox { padding: 12px; }
    .obm-pm-lightbox-close { top: -12px; right: -12px; width: 38px; height: 38px; font-size: 16px; }
}
