/*
 * BG3 Spells Manager — Base CSS v2.2.5
 * Structural rules only. Override colors/fonts in Divi custom CSS.
 *
 * THREE TEXT STYLE TARGETS:
 *   STYLE 1 — Column headers:     .bg3s-th
 *   STYLE 2 — Spell name link:    .bg3s-spell-link
 *   STYLE 3 — All other cells:    .bg3s-td
 *
 * STICKY COLUMN BACKGROUND — must match your row colors:
 *   .bg3s-th--sticky { background: #YOUR_HEADER_BG; }
 *   .bg3s-td--sticky { background: #YOUR_ROW_BG; }
 *   .bg3s-table-row:nth-child(even) .bg3s-td--sticky { background: #YOUR_ALT_ROW_BG; }
 */

/* ── Outer wrapper ───────────────────────────────────────────────────────────*/
.bg3s-wrapper {
    max-width: 1080px;
    width: 100%;
    box-sizing: border-box;
}

/* ── Filter bar ──────────────────────────────────────────────────────────────*/
.bg3s-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 0;
}
.bg3s-filter-search {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Search input — same height/style as dropdowns */
.bg3s-search-input {
    height: 37px;
    padding: 0 12px;
    border-radius: 4px;
    font-size: 13px;
    width: 160px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    line-height: 37px;
}

.bg3s-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.bg3s-filter-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 700;
}
.bg3s-filter-select {
    height: 37px;
    padding: 0 10px;
    border-radius: 4px;
    font-size: 13px;
    min-width: 110px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    cursor: pointer;
}

/* Actions: Reset + toggle buttons — all same height */
.bg3s-filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    margin-left: auto;
}
.bg3s-reset-btn {
    height: 37px;
    padding: 0 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    /* Explicit visible colors — override in Divi if needed */
    border: 2px solid #888;
    background: transparent;
    color: #ccc;
}
.bg3s-reset-btn:hover { border-color: #fff; color: #fff; }

/* Toggle buttons — explicit colors so they're always visible */
.bg3s-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 37px;
    height: 37px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    border: 2px solid #666;
    background: transparent;
    color: #888;
    padding: 0;
    flex-shrink: 0;
    transition: border-color .15s, color .15s, background .15s;
}
.bg3s-view-btn:hover {
    border-color: #aaa;
    color: #ccc;
}
.bg3s-view-btn.active {
    border-color: #fff;
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* ── Spell icon (list view) ──────────────────────────────────────────────────*/
.bg3s-spell-icon-wrap { flex-shrink: 0; }
.bg3s-spell-icon {
    display: block;
    width: 40px;
    height: 40px;
    object-fit: contain;
    background-color: #000;
    border: 2px solid #68001B;
    border-radius: 50%;
    padding: 3px;
    box-sizing: border-box;
}
.bg3s-spell-icon--placeholder {
    width: 40px;
    height: 40px;
    background: #000;
    border: 2px solid #68001B;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Spell icon in table */
.bg3s-table-icon {
    display: block;
    width: 30px;
    height: 30px;
    object-fit: contain;
    background: #000;
    border: 2px solid #68001B;
    border-radius: 50%;
    padding: 2px;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* ── Cell icons ──────────────────────────────────────────────────────────────*/
.bg3s-cell-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 3px;
    flex-shrink: 0;
}
.bg3s-badge-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    vertical-align: middle;
    margin-left: 3px;
}
.bg3s-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 3px;
}

/* ── List view — 3 column grid ───────────────────────────────────────────────*/
.bg3s-level-heading {
    margin: 24px 0 10px;
    font-size: 1.05em;
    font-weight: 700;
}
.bg3s-spell-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.bg3s-spell-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
}
.bg3s-spell-card.bg3s-hidden  { display: none !important; }
.bg3s-level-group.bg3s-hidden { display: none !important; }
.bg3s-table-row.bg3s-hidden   { display: none !important; }

.bg3s-spell-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.bg3s-spell-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    display: block;
}
.bg3s-spell-badges {
    display: flex;
    gap: 3px;
    align-items: center;
}

/* ── Table ───────────────────────────────────────────────────────────────────*/
.bg3s-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* overflow-x: auto must be on a real containing block for sticky to work */
    /* Do NOT set overflow-y here — it breaks sticky columns */
}
.bg3s-table {
    width: 100%;
    border-collapse: collapse;
    /* auto layout — let the browser size columns naturally,
       column widths below act as hints not hard constraints */
    table-layout: auto;
}

/* STYLE 1 — Column headers */
.bg3s-th {
    padding: 10px 10px;
    text-align: left;
    vertical-align: middle;
    font-size: 12px;
    white-space: nowrap;
    /* Divi target: .bg3s-th */
}

/* STYLE 3 — Data cells */
.bg3s-td {
    padding: 10px 10px;
    vertical-align: middle;
    font-size: 12px;
    /* Divi target: .bg3s-td */
}

/* ── Sticky first column ─────────────────────────────────────────────────────
 * KEY RULES:
 * 1. The sticky td must NOT use display:flex — that breaks cell height fill.
 *    Instead the inner .bg3s-td-spell-inner div uses flex.
 * 2. Background must be opaque (not transparent/inherit).
 * 3. Width is set here, not on nth-child, to avoid conflicts.
 */
.bg3s-th--sticky {
    position: sticky;
    left: 0;
    z-index: 3;
    width: 170px;
    min-width: 140px;
    max-width: 170px;
    background: #1c1c2e; /* override in Divi: .bg3s-th--sticky { background: #YOUR_BG; } */
}
.bg3s-td--sticky {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 170px;
    min-width: 140px;
    max-width: 170px;
    background: #0d0d14; /* override in Divi: .bg3s-td--sticky { background: #YOUR_BG; } */
    /* Shadow to show content slides underneath */
    box-shadow: 4px 0 8px -2px rgba(0,0,0,0.6);
}

/* Inner flex container inside sticky td — keeps icon + name side by side
   without breaking the td's full-height background */
.bg3s-td-spell-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

/* STYLE 2 — Spell name link */
.bg3s-spell-link {
    text-decoration: none;
    font-weight: 600;
    display: block;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
    min-width: 0;
    flex: 1;
    /* Divi target: .bg3s-spell-link */
}

.bg3s-td--icon-text { white-space: nowrap; }
.bg3s-td--icon-text span { vertical-align: middle; }
.bg3s-td--center { text-align: center; }

/* ── Misc ────────────────────────────────────────────────────────────────────*/
.bg3s-no-results { padding: 20px 0; font-style: italic; }
.bg3s-no { opacity: .4; }

/* ── Responsive ──────────────────────────────────────────────────────────────*/
@media (max-width: 900px) {
    .bg3s-spell-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .bg3s-filter-bar { flex-direction: column; align-items: stretch; }
    .bg3s-filter-actions { margin-left: 0; justify-content: flex-start; }
    .bg3s-filter-select,
    .bg3s-search-input { min-width: 100%; width: 100%; }
    .bg3s-spell-grid { grid-template-columns: 1fr; }
    /* On small screens sticky column stays but at min-width */
    .bg3s-th--sticky,
    .bg3s-td--sticky { width: 140px; min-width: 120px; }
}
