/* ===================================================
   Recommendations Page - Styles
   Reuses the shared Sanctum theme variables (see roster.css)
=================================================== */

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

* { box-sizing: border-box; }

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

.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,.05),rgba(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:.95rem; padding:6px 16px; border-radius:4px; transition:all .2s; }
.nav-bar a:hover { background:#4f3d2f; color:#dccaa5; }
.nav-bar a.active { color:var(--gold-accent); font-weight:700; }
.nav-bar a.nav-title { color:var(--gold-accent); font-size:1.1rem; font-weight:700; letter-spacing:1px; padding:0; background:none; }
.nav-bar a.nav-title:hover { background:none; color:#dccaa5; }
@media(max-width:768px){ .nav-bar{ padding:10px 15px; } .nav-bar a{ font-size:.8rem; padding:4px 10px; } .nav-bar a.nav-title{ font-size:.9rem; } }

.page-content { max-width: 900px; margin: 0 auto; padding: 32px 20px 60px; width: 100%; }

.rec-header { text-align: center; margin-bottom: 24px; }
.rec-title { font-family: var(--font-title); color: var(--gold-accent); font-size: 1.8rem; letter-spacing: 2px; margin: 0 0 6px; }
.rec-subtitle { color: var(--tab-text); font-size: .9rem; }

.user-picker { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; }
.picker-label { font-family: var(--font-title); color: var(--gold-accent); font-size: .85rem; letter-spacing: 1px; }
.user-picker select {
    background: var(--tab-bg); color: var(--tab-text); border: 1px solid var(--border-color);
    padding: 8px 14px; font-family: var(--font-body); font-size: .9rem; border-radius: 4px;
}

.rec-status { text-align: center; color: var(--ink-muted); font-size: .9rem; min-height: 1.5em; margin-bottom: 16px; }
.rec-status.error { color: #d97a6a; }

.rec-layout { display: block; }
.rec-main { min-width: 0; }

.taste-profile {
    position: relative;
    margin-bottom: 24px;
    padding: 20px;
    color: var(--tab-text);
    background: rgba(27, 22, 18, .92);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--gold-accent);
    box-shadow: 0 18px 42px rgba(0, 0, 0, .28);
}
.taste-profile-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.taste-profile-kicker {
    margin-bottom: 5px; color: var(--gold-accent); font-size: .65rem;
    font-weight: 700; letter-spacing: 1.8px; text-transform: uppercase;
}
.taste-profile h2 {
    margin: 0; color: #dfc98f; font-family: var(--font-title);
    font-size: 1.2rem; font-weight: 700; letter-spacing: 1px;
}
.taste-profile-total {
    display: flex; flex-direction: column; align-items: flex-end; color: var(--gold-accent);
    font-family: var(--font-title); line-height: 1;
}
.taste-profile-total strong { font-size: 2rem; font-weight: 900; }
.taste-profile-total span { margin-top: 4px; color: #8d7967; font-family: var(--font-body); font-size: .58rem; letter-spacing: 1px; text-transform: uppercase; }
.taste-profile-intro { margin: 10px 0 12px; color: #9e8b79; font-size: .76rem; line-height: 1.45; }
.taste-profile-tiers { display: flex; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid rgba(184, 149, 72, .22); }
.taste-profile-tiers span { color: #cab58d; font-family: var(--font-title); font-size: .68rem; letter-spacing: .7px; }
.taste-profile-status { padding: 18px 0; color: #9e8b79; font-size: .76rem; line-height: 1.45; }
.taste-profile-bars { display: flex; flex-direction: column; gap: 13px; margin-top: 16px; }
.taste-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; row-gap: 6px; }
.taste-row-label {
    overflow: hidden; color: #d8c8ac; font-size: .76rem; line-height: 1.1;
    text-overflow: ellipsis; text-transform: capitalize; white-space: nowrap;
}
.taste-row-value { color: var(--gold-accent); font-family: var(--font-title); font-size: .72rem; font-weight: 700; }
.taste-row-track {
    grid-column: 1 / -1; height: 5px; overflow: hidden;
    background: #30251d; border-radius: 1px;
}
.taste-row-bar {
    width: var(--taste-level); height: 100%; background: var(--gold-accent);
    box-shadow: 0 0 8px rgba(184, 149, 72, .24);
    transform-origin: left; animation: taste-bar-in .45s ease-out both;
}
.taste-profile-note { margin-top: 16px; color: #7f6e60; font-size: .64rem; line-height: 1.4; }

@keyframes taste-bar-in {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@media (min-width: 1500px) {
    .taste-profile {
        position: fixed;
        top: 250px;
        right: calc(50% + 500px);
        width: min(360px, calc(50vw - 530px));
        max-height: calc(100vh - 285px);
        margin: 0;
        overflow-y: auto;
        z-index: 20;
    }
}

@media (min-width: 769px) and (max-width: 1499px) {
    .taste-profile-bars {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 28px;
    }
}

.rec-list { display: flex; flex-direction: column; gap: 10px; }
.rec-card {
    display: flex; align-items: center; gap: 16px;
    background: var(--window-bg); color: var(--ink); border: 1px solid var(--border-color);
    border-radius: 6px; padding: 14px 18px;
}
.rec-rank {
    font-family: var(--font-title); font-size: 1.4rem; color: var(--gold-accent);
    min-width: 36px; text-align: center; font-weight: 900;
}
.rec-cover {
    width: 56px; height: 56px; object-fit: cover; border-radius: 4px;
    border: 1px solid var(--border-color); flex-shrink: 0; background: var(--tab-bg);
}
.rec-body { flex: 1; min-width: 0; }
.rec-series-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 10px; margin-bottom: 4px; }
.rec-series-name { font-family: var(--font-title); font-size: 1.05rem; font-weight: 700; }
.rec-book-count { color: var(--ink-muted); font-size: .7rem; letter-spacing: .3px; white-space: nowrap; }
.rec-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.rec-tag-chip {
    background: var(--tab-bg); color: var(--gold-accent); font-size: .72rem;
    padding: 2px 9px; border-radius: 10px; letter-spacing: .5px;
}
.rec-tag-chip.boosted { background: var(--gold-accent); color: var(--ink); font-weight: 700; }
.rec-score { font-size: .75rem; color: var(--ink-muted); white-space: nowrap; }
.rec-playlist-add {
    display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px;
    padding: 0 0 2px; border: 1px solid var(--border-color); border-radius: 4px;
    background: var(--tab-bg); color: var(--gold-accent); cursor: pointer;
    font-family: var(--font-body); font-size: 1.45rem; font-weight: 400; line-height: 1;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.rec-playlist-add:hover,
.rec-playlist-add:focus-visible { background: var(--gold-accent); border-color: var(--gold-accent); color: var(--ink); outline: none; }
.rec-playlist-add:disabled { cursor: wait; opacity: .55; }
.rec-playlist-add.added { background: #536b43; border-color: #536b43; color: #f2ead9; }

.playlist-dialog {
    width: min(420px, calc(100vw - 32px)); padding: 26px;
    border: 1px solid var(--gold-accent); border-radius: 6px;
    background: #211a15; color: var(--tab-text); box-shadow: 0 24px 70px rgba(0, 0, 0, .72);
    font-family: var(--font-body);
}
.playlist-dialog::backdrop { background: rgba(0, 0, 0, .72); }
.playlist-dialog-close {
    position: absolute; top: 8px; right: 11px; border: 0; background: transparent;
    color: var(--tab-text); cursor: pointer; font-size: 1.45rem; line-height: 1;
}
.playlist-dialog-close:hover,
.playlist-dialog-close:focus-visible { color: var(--gold-accent); outline: none; }
.playlist-dialog-kicker {
    margin-bottom: 6px; color: var(--gold-accent); font-size: .65rem;
    font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase;
}
.playlist-dialog h2 {
    margin: 0 28px 8px 0; color: #dfc98f; font-family: var(--font-title);
    font-size: 1.15rem; letter-spacing: .5px;
}
.playlist-dialog-summary { margin: 0 0 18px; color: #ae9b87; font-size: .82rem; line-height: 1.5; }
.playlist-dialog-field { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.playlist-dialog-field[hidden] { display: none; }
.playlist-dialog-field span { color: #d2bea0; font-size: .72rem; font-weight: 700; letter-spacing: .5px; }
.playlist-dialog-field input,
.playlist-dialog-field select {
    width: 100%; padding: 9px 11px; border: 1px solid var(--border-color); border-radius: 4px;
    background: var(--tab-bg); color: var(--tab-text); font: inherit;
}
.playlist-dialog-field input:focus,
.playlist-dialog-field select:focus { border-color: var(--gold-accent); outline: 2px solid rgba(184, 149, 72, .18); }
.playlist-dialog-status { min-height: 1.25em; margin-top: 12px; color: #d97a6a; font-size: .76rem; line-height: 1.4; }
.playlist-dialog-status.ok { color: #91b979; }
.playlist-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.playlist-dialog-actions button {
    padding: 8px 14px; border-radius: 4px; cursor: pointer;
    font-family: var(--font-title); font-size: .74rem; font-weight: 700;
}
.playlist-cancel { border: 1px solid var(--border-color); background: transparent; color: var(--tab-text); }
.playlist-confirm { border: 1px solid var(--gold-accent); background: var(--gold-accent); color: var(--ink); }
.playlist-dialog-actions button:hover { border-color: #d2b76f; }
.playlist-dialog-actions button:focus-visible { outline: 2px solid #d2b76f; outline-offset: 2px; }
.playlist-dialog-actions button:disabled { cursor: wait; opacity: .55; }

@media (max-width: 620px) {
    .rec-card { align-items: flex-start; gap: 10px; padding: 12px; }
    .rec-rank { min-width: 28px; font-size: 1.1rem; }
    .rec-cover { width: 48px; height: 48px; }
    .rec-score { display: none; }
    .rec-playlist-add { flex-basis: 34px; width: 34px; height: 34px; }
}

.tag-sidebar {
    position: fixed;
    right: 0;
    top: 120px;
    width: 240px;
    background: var(--tab-bg);
    border: 1px solid #2a2118;
    border-left: 3px solid var(--gold-accent);
    border-radius: 8px 0 0 8px;
    padding: 15px;
    padding-top: 40px;
    box-sizing: border-box;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    z-index: 100;
    transform: translateX(100%);
    transition: transform .25s ease;
}
.tag-sidebar.open { transform: translateX(0); }
.tag-sidebar-header {
    display: flex; justify-content: space-between; align-items: center;
    font-family: var(--font-title); color: var(--gold-accent); font-size: .95rem;
    margin-bottom: 6px;
}
.tag-clear-btn {
    background: none; border: 1px solid var(--border-color); color: var(--tab-text);
    font-size: .7rem; padding: 2px 8px; border-radius: 4px; cursor: pointer;
}
.tag-clear-btn:hover { color: var(--gold-accent); border-color: var(--gold-accent); }
.tag-sidebar-hint { font-size: .72rem; color: var(--ink-muted); margin-bottom: 12px; line-height: 1.4; }

.fresh-toggle {
    display: flex; align-items: flex-start; gap: 8px; font-size: .78rem;
    color: var(--gold-accent); cursor: pointer; margin-bottom: 14px;
    padding-bottom: 12px; border-bottom: 1px solid rgba(184,149,72,0.3);
    line-height: 1.4;
}
.fresh-toggle input { accent-color: var(--gold-accent); margin-top: 2px; flex-shrink: 0; }

.tag-checklist { display: flex; flex-direction: column; gap: 6px; }
.tag-checklist label {
    display: flex; align-items: center; gap: 8px; font-size: .82rem;
    color: var(--tab-text); cursor: pointer;
}
.tag-checklist label:hover { color: var(--gold-accent); }
.tag-checklist input { accent-color: var(--gold-accent); }

.tag-popover {
    position: fixed;
    z-index: 500;
    max-width: 260px;
    background: var(--tab-bg);
    color: var(--tab-text);
    border: 1px solid #2a2118;
    border-radius: 6px;
    padding: 10px 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.5);
    pointer-events: none;
    font-size: .78rem;
    line-height: 1.45;
}
.tag-popover-title {
    font-family: var(--font-title); color: var(--gold-accent);
    font-size: .85rem; font-weight: 700; margin-bottom: 4px;
}

.rec-cover { cursor: pointer; }

.cover-popover {
    position: fixed;
    z-index: 500;
    display: flex;
    gap: 16px;
    max-width: 420px;
    background: var(--tab-bg);
    color: var(--tab-text);
    border: 1px solid #2a2118;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    pointer-events: none;
}
.cover-popover-img {
    width: 130px; height: 130px; object-fit: cover; border-radius: 6px;
    flex-shrink: 0; background: #1a1a1a;
}
.cover-popover-body { min-width: 0; }
.cover-popover-title {
    font-family: var(--font-title); color: var(--gold-accent);
    font-size: 1rem; font-weight: 700; margin-bottom: 8px;
}
.cover-popover-desc {
    font-size: .82rem; line-height: 1.5; color: var(--tab-text);
    max-height: 180px; overflow-y: auto;
}

@media (max-width: 900px) {
    .tag-sidebar { width: 200px; max-height: 300px; top: 100px; }
}

.tag-sidebar-toggle {
    position: fixed;
    right: 0;
    top: 140px;
    z-index: 150;
    background: var(--gold-accent);
    color: var(--ink);
    border: none;
    border-radius: 8px 0 0 8px;
    padding: 10px 8px;
    font-family: var(--font-title);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .5px;
    writing-mode: vertical-rl;
    cursor: pointer;
    box-shadow: -4px 0 12px rgba(0,0,0,0.4);
}

.tag-sidebar-close {
    display: block;
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: var(--tab-text);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}
.tag-sidebar-close:hover { color: var(--gold-accent); }

.tag-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}
.tag-sidebar-backdrop.show { display: block; }

@media (max-width: 768px) {
    .tag-sidebar {
        top: 0;
        width: 82%;
        max-width: 300px;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        border-left: 3px solid var(--gold-accent);
        z-index: 200;
    }
}

@media (prefers-reduced-motion: reduce) {
    .taste-row-bar { animation: none; }
}

.tag-panel {
    margin-top: 40px; padding: 20px; border: 1px dashed var(--border-color);
    border-radius: 6px; background: rgba(255,255,255,0.02);
}
.tag-panel-title { font-family: var(--font-title); color: var(--gold-accent); font-size: 1.1rem; margin: 0 0 4px; }
.tag-panel-hint { font-size: .8rem; color: var(--ink-muted); margin-bottom: 14px; }
.tag-form { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-form input {
    background: var(--tab-bg); color: var(--tab-text); border: 1px solid var(--border-color);
    padding: 8px 12px; border-radius: 4px; font-family: var(--font-body); flex: 1; min-width: 160px;
}
.tag-form button {
    background: var(--gold-accent); color: var(--ink); border: none; padding: 8px 18px;
    border-radius: 4px; font-family: var(--font-title); font-weight: 700; cursor: pointer;
}
.tag-form button:hover { opacity: .9; }
#tag-form-status { margin-top: 10px; font-size: .85rem; min-height: 1.2em; }
#tag-form-status.error { color: #d97a6a; }
#tag-form-status.ok { color: #7ab86a; }
