/**
 * DWX Table Builder — Frontend Stylesheet
 * Applied when [dwx_table id="..."] shortcode renders a table on the public site.
 */

:root {
    --dwx-fe-bg:        #0d0d10;
    --dwx-fe-bg2:       #111115;
    --dwx-fe-border:    #1e1e24;
    --dwx-fe-text:      #e8e8f0;
    --dwx-fe-text2:     #9090a8;
    --dwx-fe-text3:     #55556a;
    --dwx-fe-accent:    #5b6cf9;
    --dwx-fe-green:     #3dd68c;
    --dwx-fe-amber:     #f0a05a;
    --dwx-fe-radius:    10px;
    --dwx-fe-font:      'Syne', Helvetica, sans-serif;
    --dwx-fe-mono:      'DM Mono', monospace;
}

.dwx-table-frontend-wrap {
    margin: 24px 0;
    font-family: var(--dwx-fe-font);
}

.dwx-table-scroll {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--dwx-fe-radius);
    border: 1px solid var(--dwx-fe-border);
}

.dwx-frontend-table {
    width: 100%;
    min-width: 480px;
    border-collapse: collapse;
    font-size: 14px;
}

/* Header */
.dwx-frontend-table thead th {
    background: var(--dwx-fe-bg2);
    color: var(--dwx-fe-text2);
    padding: 14px 18px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--dwx-fe-border);
    white-space: nowrap;
}

/* Body rows */
.dwx-frontend-table tbody td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--dwx-fe-border);
    color: var(--dwx-fe-text);
    background: var(--dwx-fe-bg);
    vertical-align: middle;
    line-height: 1.5;
}
.dwx-frontend-table tbody tr:last-child td {
    border-bottom: none;
}
.dwx-frontend-table tbody tr:not(.section-header-row):hover td {
    background: rgba(255,255,255,0.02);
}

/* Section headers */
.dwx-frontend-table tbody tr.section-header-row td {
    background: var(--dwx-fe-bg2);
    color: var(--dwx-fe-accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 8px 18px;
    border-left: 2px solid var(--dwx-fe-accent);
}

/* Summary rows */
.dwx-frontend-table tbody tr.summary-row td {
    background: var(--dwx-fe-bg2);
    font-weight: 700;
    border-top: 2px solid var(--dwx-fe-border);
    color: var(--dwx-fe-text);
}

/* Cell types */
.dwx-frontend-table td.cell-type-tick   { color: var(--dwx-fe-green); font-weight: 700; font-size: 16px; }
.dwx-frontend-table td.cell-type-muted  { color: var(--dwx-fe-text3); }
.dwx-frontend-table td.cell-type-number { font-family: var(--dwx-fe-mono); color: var(--dwx-fe-amber); font-weight: 600; }

/* Responsive */
@media (max-width: 600px) {
    .dwx-frontend-table thead th,
    .dwx-frontend-table tbody td {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* ── EXPAND / COLLAPSE ────────────────────────────────────── */

/* Inner wrapper — height is controlled by JS */
.dwx-table-frontend-wrap.dwx-expandable .dwx-expand-inner {
    position: relative;
    /* transition applied by JS after measurement */
}

/* Gradient fade mask shown when collapsed */
.dwx-expand-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--dwx-fe-bg, #0d0d10) 100%
    );
    pointer-events: none;
    border-radius: 0 0 var(--dwx-fe-radius, 10px) var(--dwx-fe-radius, 10px);
    transition: opacity 0.35s ease;
    z-index: 2;
}

/* Hide fade when expanded */
.dwx-table-frontend-wrap.dwx-is-expanded .dwx-expand-fade {
    opacity: 0;
    pointer-events: none;
}

/* Expand bar — centers the toggle button */
.dwx-expand-bar {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

/* The round pink button */
.dwx-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #FF2B8A;
    border: none;
    cursor: pointer;
    padding: 0;
    outline: none;
    box-shadow:
        0 4px 16px rgba(255, 43, 138, 0.40),
        0 1px  4px rgba(0, 0, 0, 0.30);
    transition:
        transform    0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow   0.22s ease;
    -webkit-tap-highlight-color: transparent;
}

.dwx-expand-btn:hover {
    transform: translateY(-3px) scale(1.06);
    box-shadow:
        0 8px 28px rgba(255, 43, 138, 0.55),
        0 2px  8px rgba(0, 0, 0, 0.30);
}

.dwx-expand-btn:active {
    transform: scale(0.94);
    box-shadow:
        0 2px  8px rgba(255, 43, 138, 0.35),
        0 1px  4px rgba(0, 0, 0, 0.25);
}

/* Chevron icon inside the button */
.dwx-expand-btn svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

/* Rotate chevron when expanded */
.dwx-table-frontend-wrap.dwx-is-expanded .dwx-expand-btn svg {
    transform: rotate(180deg);
}

/* Subtle pulse ring on first load (collapsed state only) */
@keyframes dwxExpandPulse {
    0%   { box-shadow: 0 0 0 0   rgba(255,43,138,0.45), 0 4px 16px rgba(255,43,138,0.40); }
    70%  { box-shadow: 0 0 0 10px rgba(255,43,138,0),   0 4px 16px rgba(255,43,138,0.40); }
    100% { box-shadow: 0 0 0 0   rgba(255,43,138,0),    0 4px 16px rgba(255,43,138,0.40); }
}

.dwx-table-frontend-wrap.dwx-is-collapsed .dwx-expand-btn {
    animation: dwxExpandPulse 2.2s ease-out 1.2s 2;
}
