/* ═══════════════════════════════════════════════════════════════
   guide.css — Shared styles for Scapewatch guide pages.
   Uses the same CSS variable system as the main game.
   ═══════════════════════════════════════════════════════════════ */

:root {
    --game-font: 'Chakra Petch', sans-serif;
    --bg-darkest: #1a1a1a;
    --bg-dark: #1c1c0e;
    --bg-panel: #2b2216;
    --bg-cell: #3a3226;
    --bg-hover: #4a4230;
    --border-primary: #5c4a2a;
    --border-secondary: #7a6a3a;
    --text-bright: #ffff00;
    --text-gold: #FFD700;
    --text-accent: #c8a83e;
    --text-light: #cccccc;
    --text-muted: #888888;
    --text-dim: #aaaaaa;
    --text-dark: #666666;
    --text-disabled: #555555;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    min-height: 100vh;
    background: var(--bg-darkest);
    color: var(--text-light);
    font-family: var(--game-font);
    font-size: 18px;
    line-height: 1.4;
}

img {
    image-rendering: pixelated;
}

a {
    color: var(--text-gold);
    text-decoration: none;
}
a:hover {
    color: var(--text-bright);
    text-decoration: underline;
}

/* ── Layout ──────────────────────────────────────────────── */

.guide-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 30px 60px;
}

.guide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: 24px;
}

.guide-header h1 {
    font-size: 36px;
    color: var(--text-gold);
    font-weight: normal;
    text-shadow: 1px 1px 0 #000;
}

.guide-nav {
    display: flex;
    gap: 16px;
    align-items: center;
}

.guide-nav a {
    font-size: 20px;
    color: var(--text-muted);
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.15s;
}
.guide-nav a:hover {
    color: var(--text-gold);
    border-color: var(--border-secondary);
    text-decoration: none;
}
.guide-nav a.active {
    color: var(--text-gold);
    border-color: var(--border-secondary);
    background: var(--bg-panel);
}

/* ── Panels ──────────────────────────────────────────────── */

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
}

.panel-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.panel h2, .panel h3 {
    color: var(--text-gold);
    font-weight: normal;
}

/* ── Search & Filter ─────────────────────────────────────── */

.search-input {
    background: var(--bg-dark);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    color: var(--text-light);
    font-family: var(--game-font);
    font-size: 20px;
    padding: 8px 14px;
    outline: none;
    transition: border-color 0.15s;
}
.search-input:focus {
    border-color: var(--text-gold);
}
.search-input::placeholder {
    color: var(--text-dark);
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.filter-btn {
    background: var(--bg-cell);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: var(--game-font);
    font-size: 18px;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.15s;
}
.filter-btn:hover {
    border-color: var(--border-secondary);
    color: var(--text-light);
}
.filter-btn.active {
    border-color: var(--border-secondary);
    background: var(--bg-hover);
    color: var(--text-gold);
}

.sort-select {
    background: var(--bg-dark);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    color: var(--text-light);
    font-family: var(--game-font);
    font-size: 18px;
    padding: 6px 10px;
    outline: none;
    cursor: pointer;
}
.sort-select:focus {
    border-color: var(--text-gold);
}

/* ── Item Grid (matches in-game bank .inv-slot) ──────────── */

.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 68px);
    gap: 4px;
}

.item-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 68px;
    background: var(--bg-cell);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    padding: 12px 2px 2px;
    overflow: hidden;
}
.item-tile:hover {
    border-color: var(--border-secondary);
    background: var(--bg-hover);
}
.item-tile img {
    width: 32px;
    height: 32px;
    transform: scale(1.5);
    image-rendering: pixelated;
    filter: drop-shadow(1px 1px 0 #000);
}
.item-tile .item-name {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* ── Tooltips (matches in-game BankModal / TooltipManager) ── */

.guide-tooltip {
    position: fixed;
    z-index: 9999;
    background: var(--bg-dark);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: 6px 10px;
    white-space: nowrap;
    pointer-events: none;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0,0,0,0.8);
    display: none;
}

.guide-tooltip .tt-name {
    font-size: 24px;
    color: var(--text-bright);
    text-shadow: 1px 1px 0 #000;
}

.guide-tooltip .tt-line {
    font-size: 22px;
    color: var(--text-light);
    text-shadow: 1px 1px 0 #000;
}

.guide-tooltip .tt-style-val { color: var(--text-accent); }
.guide-tooltip .tt-speed-val { color: #88cc88; }

/* Equipment stat table inside tooltips */
.guide-tooltip .tt-equip-table {
    border-collapse: collapse;
    font-size: 22px;
    text-shadow: 1px 1px 0 #000;
    margin-top: 4px;
}
.guide-tooltip .tt-equip-table th {
    color: var(--text-accent);
    font-weight: normal;
    padding: 1px 6px;
    text-align: center;
    border-bottom: 1px solid var(--bg-cell);
}
.guide-tooltip .tt-equip-table th:first-child {
    text-align: left;
    width: 100px;
}
.guide-tooltip .tt-equip-table td {
    padding: 1px 6px;
    text-align: center;
    color: var(--text-light);
}
.guide-tooltip .tt-equip-table td:first-child {
    text-align: left;
    color: var(--text-accent);
    width: 100px;
}
.guide-tooltip .tt-equip-table .stat-pos { color: #4caf50; }
.guide-tooltip .tt-equip-table .stat-zero { color: var(--border-primary); }
.guide-tooltip .tt-equip-table .stat-neg { color: #ff4444; }
.guide-tooltip .tt-equip-table .str-cell { text-align: center; color: var(--text-light); }
.guide-tooltip .tt-equip-icon-wrap {
    display: inline-block;
    vertical-align: middle;
    width: 20px;
    height: 20px;
    margin-right: 4px;
}
.guide-tooltip .tt-equip-icon-wrap img {
    width: 20px;
    height: 20px;
    image-rendering: pixelated;
    filter: drop-shadow(1px 1px 0 #000);
}

/* ── Mob Cards (matches in-game SlayMasterModal .mob-card) ── */

.mob-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mob-card {
    width: 140px;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-cell);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    padding: 4px 4px 6px;
}
.mob-card:hover {
    background: var(--bg-hover);
    border-color: var(--text-accent);
}
.mob-card.selected {
    border-color: var(--text-gold);
}

.mob-card .mob-card-level {
    font-size: 18px;
    color: var(--text-accent);
    text-shadow: 1px 1px 0 #000;
    margin-bottom: 2px;
}

.mob-card .mob-card-name {
    font-size: 18px;
    color: var(--text-light);
    text-shadow: 1px 1px 0 #000;
    text-align: center;
    line-height: 1.1;
    max-width: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    min-height: 22px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mob-card .mob-card-sprite {
    width: 128px;
    height: 128px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    image-rendering: pixelated;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

.mob-card .mob-card-sprite canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.mob-card .mob-card-style {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 2;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.8));
}

.mob-card .mob-card-style img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    filter: drop-shadow(1px 1px 0 #000);
}

/* ── Two-Panel Layout ────────────────────────────────────── */

.two-panel {
    display: flex;
    gap: 16px;
    height: calc(100vh - 180px);
    min-height: 400px;
}

.panel-left {
    width: 400px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-right {
    flex: 1;
    min-width: 0;
}

.list-scroll {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--bg-dark);
}

.list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-primary);
    transition: background 0.1s;
}
.list-item:hover {
    background: var(--bg-hover);
}
.list-item.selected {
    background: var(--bg-panel);
    border-left: 3px solid var(--text-gold);
}
.list-item .list-name {
    flex: 1;
    color: var(--text-light);
    font-size: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.list-item .list-badge {
    font-size: 14px;
    padding: 2px 8px;
    border-radius: 3px;
    background: var(--bg-cell);
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Detail Panel ────────────────────────────────────────── */

.detail-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-dark);
    font-size: 24px;
}

.detail-title {
    font-size: 32px;
    color: var(--text-gold);
    margin-bottom: 8px;
}

.detail-desc {
    color: var(--text-muted);
    margin-bottom: 16px;
    font-size: 20px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h3 {
    color: var(--text-accent);
    font-size: 22px;
    font-weight: normal;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: 4px;
}

/* ── Skill Icons (matches in-game .skill-cell img) ───────── */

.skill-icon {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    filter: drop-shadow(1px 1px 0 #000);
    vertical-align: middle;
}

.skill-icon-sm {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
    filter: drop-shadow(1px 1px 0 #000);
    vertical-align: middle;
}

/* ── Tables ──────────────────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 18px;
}
.data-table th {
    text-align: left;
    color: var(--text-gold);
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-secondary);
    font-weight: normal;
    white-space: nowrap;
}
.data-table td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-light);
}
.data-table tr:hover td {
    background: var(--bg-hover);
}

/* ── Tier Colors ─────────────────────────────────────────── */

.tier-feeble { color: #4caf50; }
.tier-dire { color: #4fc3f7; }
.tier-savage { color: #ff9800; }
.tier-fell { color: #f44336; }
.tier-ancient { color: #9c27b0; }

/* ── Scrollbar ───────────────────────────────────────────── */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-primary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-secondary); }

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 900px) {
    .guide-page { padding: 12px 16px 40px; }
    .two-panel { flex-direction: column; }
    .panel-left { width: 100%; }
    .guide-header { flex-direction: column; gap: 12px; }
    .guide-nav { flex-wrap: wrap; }
}

/* ── Theme Swatches (landing page) ───────────────────────── */

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.theme-swatch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 2px solid var(--border-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--bg-cell);
}
.theme-swatch:hover {
    border-color: var(--border-secondary);
}
.theme-swatch.active {
    border-color: var(--text-gold);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}
.theme-swatch .swatch-preview {
    width: 28px;
    height: 28px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid transparent;
}
.theme-swatch .swatch-name {
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Guide Cards (landing page) ──────────────────────────── */

.guide-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.guide-card {
    display: block;
    background: var(--bg-panel);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 24px;
    transition: all 0.2s;
}
.guide-card:hover {
    border-color: var(--text-gold);
    background: var(--bg-cell);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.guide-card .card-icon {
    font-size: 40px;
    margin-bottom: 8px;
}
.guide-card .card-title {
    font-size: 26px;
    color: var(--text-gold);
    margin-bottom: 6px;
}
.guide-card .card-desc {
    font-size: 18px;
    color: var(--text-muted);
}

/* ── Loading Spinner ─────────────────────────────────────── */

.loading {
    text-align: center;
    padding: 60px;
    color: var(--text-dark);
    font-size: 24px;
}

/* ── Stat Grid (bestiary detail) ─────────────────────────── */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.stat-cell {
    background: var(--bg-cell);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    padding: 6px 10px;
    text-align: center;
}
.stat-cell .stat-label {
    font-size: 14px;
    color: var(--text-dark);
}
.stat-cell .stat-value {
    font-size: 22px;
    color: var(--text-gold);
}

/* ── Quest Steps ─────────────────────────────────────────── */

.quest-step {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-primary);
}
.quest-step:last-child {
    border-bottom: none;
}
.step-num {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    background: var(--bg-cell);
    border: 1px solid var(--border-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-gold);
}
.step-body .step-text {
    color: var(--text-light);
    font-size: 20px;
}
.step-body .step-dialogue {
    color: var(--text-muted);
    font-size: 17px;
    font-style: italic;
    margin-top: 4px;
}

/* ── Reward Section ──────────────────────────────────────── */

.reward-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 18px;
}
.reward-row img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    filter: drop-shadow(1px 1px 0 #000);
}

/* ── Sidebar + Main Layout (skills page) ─────────────────── */

.sidebar-layout {
    display: flex;
    gap: 16px;
    min-height: 600px;
}

.sidebar {
    width: 220px;
    flex-shrink: 0;
    overflow-y: auto;
    background: var(--bg-panel);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
}

.sidebar-group-label {
    font-size: 14px;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 12px 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    transition: background 0.1s;
    color: var(--text-light);
    font-size: 20px;
}
.sidebar-item:hover {
    background: var(--bg-hover);
}
.sidebar-item.selected {
    background: var(--bg-cell);
    border-left: 3px solid var(--text-gold);
    color: var(--text-gold);
}

.main-content {
    flex: 1;
    min-width: 0;
}

/* ── Footer ──────────────────────────────────────────────── */

.guide-footer {
    text-align: center;
    padding: 24px 0 16px;
    margin-top: 40px;
    border-top: 1px solid var(--border-primary);
    color: var(--text-dark);
    font-size: 16px;
}
