/* WatchQueue — modern dark UI */
:root {
    --bg: #0f0f0f;
    --bg-card: #1a1a2e;
    --bg-input: #16213e;
    --accent: #e94560;
    --accent-hover: #ff6b81;
    --text: #eaeaea;
    --text-muted: #8a8a9a;
    --border: #2a2a3e;
    --success: #2ecc71;
    --warning: #f39c12;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ─── Navbar ─── */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.navbar-inner {
    max-width: 100%;
    margin: 0 auto;
    padding: 0.6rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.navbar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}
.brand-watch { color: var(--accent); }
.brand-queue { color: var(--text); }
.navbar-brand:hover .brand-queue { color: var(--accent-hover); }

.navbar-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}
.nav-link {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}
.nav-link:hover {
    color: var(--text);
    background: rgba(255,255,255,0.05);
}

/* ─── Navbar sync buttons ─── */
.navbar-sync {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
}
.btn-nav-sync {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 0.2rem 0.45rem;
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
    transition: border-color 0.2s, color 0.2s;
}
.btn-nav-sync:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.navbar-user {
    margin-left: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.user-name {
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
}
.nav-logout {
    color: var(--text-muted) !important;
    font-size: 0.8rem;
}

/* ─── Main content ─── */
.main-content {
    max-width: 100%;
    padding: 1.5rem;
}

/* Legacy container fallback */
.container { max-width: 100%; margin: 0 auto; padding: 0 1rem; }

/* ─── Buttons ─── */
.btn {
    display: inline-block; padding: 0.4rem 1rem; border-radius: 6px;
    border: none; cursor: pointer; font-size: 0.85rem;
    color: #fff; background: var(--accent); transition: background 0.2s;
}
.btn:hover { background: var(--accent-hover); color: #fff; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn-outline {
    background: transparent; border: 1px solid var(--border); color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: #c0392b; }
.btn-danger:hover { background: #e74c3c; }
.btn-success { background: var(--success); }

/* ─── Forms ─── */
input[type="text"], input[type="password"], input[type="number"],
textarea, select {
    background: var(--bg-input); border: 1px solid var(--border);
    color: var(--text); padding: 0.5rem 0.75rem; border-radius: 6px;
    font-size: 0.9rem; width: 100%;
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--accent);
}
textarea { resize: vertical; min-height: 60px; }
label { display: block; margin-bottom: 0.25rem; color: var(--text-muted); font-size: 0.85rem; }
.form-group { margin-bottom: 1rem; }
.form-row { display: flex; gap: 1rem; }
.form-row > * { flex: 1; }

/* ─── Cards / Items ─── */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.item-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; overflow: hidden; transition: border-color 0.2s, transform 0.15s;
    display: flex; flex-direction: column;
}
.item-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.item-card a { color: inherit; }
.item-poster-link { position: relative; display: block; }
.item-poster {
    width: 100%; aspect-ratio: 2/3; object-fit: cover; background: var(--bg-input);
}
.item-poster-placeholder {
    width: 100%; aspect-ratio: 2/3; background: var(--bg-input);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 2rem;
}
.item-info { padding: 0.75rem; flex: 1; display: flex; flex-direction: column; }
.item-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.25rem; }
.item-meta { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.5rem; }
.item-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: auto; }

/* Comment badge on card */
.comment-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

/* Note preview on card */
.item-note {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.4rem;
    padding: 0.3rem 0.5rem;
    background: rgba(255,255,255,0.03);
    border-radius: 4px;
    border-left: 2px solid var(--accent);
    line-height: 1.4;
}

/* ─── Badges ─── */
.badge {
    display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px;
    font-size: 0.75rem; font-weight: 500;
}
.bg-success { background: var(--success); color: #fff; }
.bg-secondary { background: var(--border); color: var(--text-muted); }
.bg-warning { background: var(--warning); color: #000; }
.bg-accent { background: var(--accent); color: #fff; }
.bg-info { background: #3498db; color: #fff; }

/* Status badges */
.status-queued { background: var(--border); color: var(--text-muted); }
.status-watching { background: #3498db; color: #fff; }
.status-watched { background: var(--success); color: #fff; }
.status-dropped { background: #c0392b; color: #fff; }
.status-on_hold { background: var(--warning); color: #000; }
.status-in_library { background: #8e44ad; color: #fff; }

/* ─── Ratings row ─── */
.ratings-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.rating-link, .rating-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: transform 0.15s, opacity 0.15s;
}
.rating-link:hover { transform: scale(1.05); opacity: 0.9; }
.rating-tmdb { background: var(--warning); color: #000; }
.rating-kp { background: #ff6600; color: #fff; }
.rating-imdb { background: #f5c518; color: #000; }
.rating-link { text-decoration: none; }
.rating-link.rating-tmdb:hover { color: #000; }
.rating-link.rating-kp:hover { color: #fff; }
.rating-link.rating-imdb:hover { color: #000; }

/* ─── Tags ─── */
.tags-section { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.tags-section h4 { margin-bottom: 0.5rem; font-size: 1rem; }
.tags-display { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.tag-chip {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    background: rgba(233, 69, 96, 0.15);
    color: var(--accent);
    border: 1px solid rgba(233, 69, 96, 0.3);
    transition: background 0.2s, border-color 0.2s;
}
.tag-chip:hover {
    background: rgba(233, 69, 96, 0.3);
    border-color: var(--accent);
    color: var(--accent);
}

/* ─── Plex file path ─── */
.plex-path {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
}
.path-icon { font-size: 0.9rem; }
.file-path {
    color: var(--text-muted);
    font-family: 'SF Mono', Monaco, 'Fira Code', monospace;
    font-size: 0.75rem;
    word-break: break-all;
    flex: 1;
}
.file-size {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    margin-left: 0.5rem;
}

/* ─── Detail page ─── */
.detail-page { max-width: 960px; margin: 0 auto; }
.detail-layout { display: grid; grid-template-columns: 250px 1fr; gap: 2rem; margin-bottom: 2rem; }
.detail-poster { width: 100%; border-radius: 10px; }
.detail-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.detail-original { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.detail-description { color: var(--text-muted); margin-bottom: 1rem; line-height: 1.6; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 1rem; }
.detail-meta dt { color: var(--text-muted); font-size: 0.8rem; }
.detail-meta dd { font-weight: 500; margin-bottom: 0.5rem; }
.detail-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }

/* ─── Comments ─── */
.comments { margin-top: 2rem; }
.comment {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 0.75rem;
}
.comment-header { display: flex; justify-content: space-between; margin-bottom: 0.25rem; }
.comment-author { font-weight: 600; color: var(--accent); font-size: 0.85rem; }
.comment-date { color: var(--text-muted); font-size: 0.8rem; }
.comment-text { font-size: 0.9rem; }

/* ─── Filters ─── */
.filters {
    display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem;
    align-items: center;
}
.filters a.active { background: var(--accent); color: #fff; }
.filter-chip {
    padding: 0.3rem 0.75rem; border-radius: 20px; font-size: 0.8rem;
    background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted);
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-chip-sm { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.active-clear { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag-filter { background: rgba(233, 69, 96, 0.1); border-color: rgba(233, 69, 96, 0.3); }

.filters-extra {
    display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem;
}
.filter-group {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
.filter-label {
    color: var(--text-muted); font-size: 0.8rem; font-weight: 500; flex-shrink: 0;
}
.filter-chips {
    display: flex; gap: 0.35rem; flex-wrap: wrap;
}

/* ─── Search ─── */
.search-form { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.search-form input { flex: 1; }

/* ─── Login ─── */
.login-box {
    max-width: 360px; margin: 4rem auto; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: 12px; padding: 2rem;
}
.login-box h2 { text-align: center; margin-bottom: 1.5rem; }
.error-msg { color: var(--accent); font-size: 0.85rem; margin-bottom: 1rem; text-align: center; }

/* ─── Search results (TMDB) ─── */
.search-result {
    display: flex; gap: 1rem; padding: 1rem; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.75rem;
}
.search-result img { width: 60px; height: 90px; object-fit: cover; border-radius: 4px; }
.search-result-info { flex: 1; }
.search-result-title { font-weight: 600; }
.search-result-meta { color: var(--text-muted); font-size: 0.8rem; }

/* ─── Empty state ─── */
.empty-state {
    text-align: center; padding: 3rem 1rem; color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }

/* ─── Utility ─── */
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 1rem; }

/* ─── Sync bar ─── */
.sync-bar {
    display: flex; gap: 0.5rem; align-items: center;
    margin-bottom: 1rem; flex-wrap: wrap;
}
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

/* ─── Alerts ─── */
.alert {
    padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.alert-success { background: rgba(46, 204, 113, 0.15); border: 1px solid var(--success); color: var(--success); }
.alert-warning { background: rgba(243, 156, 18, 0.15); border: 1px solid var(--warning); color: var(--warning); }
.alert-info { background: rgba(52, 152, 219, 0.15); border: 1px solid #3498db; color: #3498db; }

/* ─── Priority controls ─── */
.priority-controls {
    display: flex; align-items: center; gap: 0.25rem; margin-top: 0.4rem;
}
.priority-controls-inline {
    display: inline-flex; align-items: center; gap: 0.25rem;
}
.btn-icon {
    background: var(--bg-input); border: 1px solid var(--border); color: var(--text-muted);
    border-radius: 4px; padding: 0 0.3rem; cursor: pointer; font-size: 0.7rem; line-height: 1.4;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.priority-value {
    font-size: 0.8rem; font-weight: 600; min-width: 24px; text-align: center;
    color: var(--text-muted);
}

/* ─── Torrent ─── */
.bg-torrent { background: #8e44ad; color: #fff; }
.torrent-info { display: flex; align-items: center; gap: 0.5rem; }
.torrent-info small { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── KP badge ─── */
.bg-kp { background: #ff6600; color: #fff; }

/* ─── Note badge ─── */
.bg-note { background: transparent; font-size: 0.75rem; padding: 0; min-width: auto; }

/* ─── Personal note section ─── */
.personal-note-section { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.personal-note-section h4 { margin-bottom: 0.75rem; font-size: 1rem; }
.note-display {
    background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px;
    padding: 0.75rem 1rem; margin-bottom: 0.75rem; white-space: pre-wrap;
    line-height: 1.5; color: var(--text);
}

/* ─── Detail priority ─── */
.detail-priority { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }

/* ─── Text helpers ─── */
.text-sm { font-size: 0.8rem; }

/* ─── Responsive ─── */
@media (max-width: 640px) {
    .navbar-inner { padding: 0.5rem 1rem; gap: 0.75rem; }
    .navbar-links { gap: 0.5rem; }
    .detail-layout { grid-template-columns: 1fr; }
    .detail-layout img { max-width: 200px; }
    .form-row { flex-direction: column; }
    .item-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .main-content { padding: 1rem 0.75rem; }
}
