:root {
    --bg-dark: #121212;
    --window-bg: #e8dbc3;
    --sidebar-bg: #dccaa5;
    --border-color: #4a3b2a;
    --gold-accent: #b89548;
    --ink: #2b2018;
    --ink-muted: #665243;
    --tab-bg: #3d2f24;
    --tab-text: #a89582;
    --font-title: "Cinzel", serif;
    --font-body: "Lato", sans-serif;

    /* Rarity Colors */
    --r-common: #a0a0a0;
    --r-uncommon: #3bd26f;
    --r-rare: #0070dd;
    --r-epic: #a335ee;
    --r-legendary: #ff8000;
}

body {
    margin: 0;
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at center, #1f1f1f 0%, #050505 100%);
    color: var(--ink);
    font-family: var(--font-body);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Nav bar */
.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 40px;
    background: var(--tab-bg);
    border-bottom: 3px solid #2a2118;
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.05), rgba(0,0,0,0.2));
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}
.nav-bar a {
    color: var(--tab-text);
    text-decoration: none;
    font-family: var(--font-title);
    font-size: 0.95rem;
    padding: 6px 16px;
    border-radius: 4px;
    transition: all 0.2s;
}
.nav-bar a:hover { background: #4f3d2f; color: #dccaa5; }
.nav-bar a.active { color: var(--gold-accent); font-weight: 700; }
.nav-title {
    color: var(--gold-accent);
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
}
.nav-bar a.nav-title { color: var(--gold-accent); font-size: 1.1rem; font-weight: 700; letter-spacing: 1px; padding: 0; background: none; }

.compendium-header {
    padding: 40px 20px 20px;
    text-align: center;
}

.compendium-title {
    font-family: var(--font-title);
    font-size: 3rem;
    color: var(--gold-accent);
    margin: 0;
    text-shadow: 0 4px 20px rgba(184, 149, 72, 0.3);
}

/* --- CONTROLS --- */
.controls-container {
    max-width: 1200px;
    margin: 20px auto;
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.search-box {
    width: 100%;
    max-width: 600px;
    background: rgba(255,255,255,0.05);
    border: 2px solid var(--border-color);
    border-radius: 30px;
    padding: 12px 25px;
    color: #fff;
    font-size: 1.1rem;
    font-family: var(--font-body);
    outline: none;
    transition: border-color 0.3s;
}

.search-box:focus {
    border-color: var(--gold-accent);
}

.filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-pill {
    background: var(--tab-bg);
    border: 1px solid var(--border-color);
    color: var(--tab-text);
    padding: 6px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-title);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.filter-pill:hover {
    background: #4f3d2f;
    color: #fff;
}

.filter-pill.active {
    background: var(--gold-accent);
    color: #000;
    border-color: #fff;
    font-weight: 700;
}

/* --- ITEM GRID --- */
.loot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 40px;
    max-width: 1400px;
    width: 95%;
    margin: 40px auto;
    padding-bottom: 100px;
}

/* --- WOW TOOLTIP STYLE --- */
.loot-card-wrap {
    position: relative;
    margin-left: 55px; /* Offset for the icon */
    transition: transform 0.2s;
}

.loot-card-wrap:hover {
    transform: scale(1.03);
    z-index: 10;
}

.loot-card {
    background-color: #070710;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), inset 0 0 15px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 180px;
    position: relative;
}

.loot-icon {
    position: absolute;
    left: -55px;
    top: 10px;
    width: 48px;
    height: 48px;
    border-radius: 4px;
    box-shadow: 0 0 10px black;
    border: 2px solid;
    background: #000;
    object-fit: cover;
}

/* Rarity Borders & Glows */
.rarity-common { border-color: #555; box-shadow: 0 4px 15px rgba(0,0,0,0.5); }
.rarity-common .loot-icon { border-color: var(--r-common); }
.rarity-common .item-name { color: var(--r-common); }

.rarity-uncommon { border-color: #1eff0044; box-shadow: 0 4px 15px rgba(30, 255, 0, 0.1); }
.rarity-uncommon .loot-icon { border-color: var(--r-uncommon); }
.rarity-uncommon .item-name { color: var(--r-uncommon); }

.rarity-rare { border-color: #0070dd44; box-shadow: 0 4px 15px rgba(0, 112, 221, 0.15); }
.rarity-rare .loot-icon { border-color: var(--r-rare); }
.rarity-rare .item-name { color: var(--r-rare); }

.rarity-epic { border-color: #a335ee44; box-shadow: 0 4px 20px rgba(163, 53, 238, 0.2); }
.rarity-epic .loot-icon { border-color: var(--r-epic); }
.rarity-epic .item-name { color: var(--r-epic); }

.rarity-legendary { border-color: #ff800066; box-shadow: 0 4px 25px rgba(255, 128, 0, 0.3); }
.rarity-legendary .loot-icon { border-color: var(--r-legendary); }
.rarity-legendary .item-name { color: var(--r-legendary); }

.item-name {
    font-size: 1.3rem;
    font-weight: 900;
    font-family: var(--font-title);
    margin-bottom: 2px;
}

.item-type-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #fff;
    font-weight: bold;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 4px;
    margin-bottom: 4px;
}

.item-stats {
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.4;
}

.item-effect {
    color: #1eff00;
    font-size: 0.95rem;
    line-height: 1.3;
    margin-top: 8px;
}

.item-flavor {
    color: #ffd100;
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 12px;
    line-height: 1.4;
}

.item-source {
    color: #888;
    font-size: 0.75rem;
    margin-top: auto;
    padding-top: 15px;
    text-align: right;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--tab-text);
    font-style: italic;
    padding: 100px;
    font-size: 1.5rem;
}

.loader {
    text-align: center;
    color: var(--gold-accent);
    font-family: var(--font-title);
    padding: 100px;
    font-size: 2rem;
}

/* ===== MOBILE ===== */
@media (max-width: 600px) {
    .loot-grid { grid-template-columns: 1fr; margin-left: 10px; width: 85%; }
    .compendium-title { font-size: 2rem; }
}
