/* ============================================
   SHARED LIST MODAL STYLES — v2 Redesign
   Used by: anime page, seasonal page, user page
   ============================================ */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.25s ease;
    padding: 20px;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ============================================
   LIST MODAL (Add + Edit)
   ============================================ */

.add-list-modal {
    width: 100%;
    max-width: 440px;
    padding: 0;
    overflow: visible !important;
    overflow-y: visible !important;
    position: relative;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-family: var(--font-body), 'Space Grotesk', sans-serif;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

/* Modal stays same size with sidebar */
.add-list-modal.has-sidebar {
    max-width: 440px;
}

/* Main content wrapper - this is the scrollable area */
.modal-main {
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    transition: opacity 0.15s ease;
}

.modal-main.switching {
    opacity: 0.5;
    pointer-events: none;
}

.modal-main::-webkit-scrollbar {
    width: 4px;
}

.modal-main::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* ============================================
   SERIES SIDEBAR (Floating)
   ============================================ */

.series-sidebar {
    position: absolute;
    right: calc(100% + 12px);
    top: 0;
    width: 200px;
    display: none;
    flex-direction: column;
    gap: 8px;
    background: transparent;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 85vh;
    padding: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.series-sidebar::-webkit-scrollbar {
    width: 4px;
}

.series-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.series-sidebar-header {
    display: none;
}

/* Series Entry Button - Individual floating cards */
/* Use .series-sidebar to increase specificity over user.css */
.series-sidebar .series-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.series-sidebar .series-entry:hover {
    background: var(--bg-card);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.series-sidebar .series-entry.selected {
    background: rgba(139, 92, 246, 0.18);
    border-color: rgba(139, 92, 246, 0.45);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.2);
}

/* Series Entry Cover */
.series-sidebar .series-entry-cover {
    position: relative;
    width: 40px;
    height: 56px;
    flex-shrink: 0;
}

.series-sidebar .series-entry-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Status Indicator Dot */
.series-sidebar .series-status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
    animation: dotPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dotPop {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.series-sidebar .series-entry.selected .series-status-dot {
    border-color: rgba(139, 92, 246, 0.15);
}

/* Series Entry Info */
.series-sidebar .series-entry-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.series-sidebar .series-entry-title {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.series-sidebar .series-entry-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.modal-overlay.open .add-list-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Exit animation */
.modal-overlay.closing .add-list-modal {
    transform: scale(0.92) translateY(10px);
    opacity: 0;
    transition: transform 0.2s ease-in, opacity 0.15s ease-in;
}

.modal-overlay.closing {
    opacity: 0;
    transition: opacity 0.2s ease-in;
}

/* Modal container keeps overflow visible for floating sidebar */
.add-list-modal {
    max-height: 85vh;
}

/* ============================================
   CLOSE BUTTON — Glass effect
   ============================================ */

.modal-close-float {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-close-float:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
    color: #f87171;
}

.modal-close-float svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   REMOVE ICON BUTTON (Edit modal header)
   ============================================ */

.btn-remove-icon {
    position: absolute;
    top: 10px;
    right: 44px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    color: #f87171;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.btn-remove-icon:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
}

.btn-remove-icon svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   CINEMATIC HERO HEADER
   ============================================ */

.add-list-header {
    position: relative;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
    min-height: 120px;
}

.header-banner {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center 20%;
    filter: blur(12px) brightness(0.5);
    transform: scale(1.15);
    z-index: 0;
}

.header-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 10, 15, 0.3) 0%, rgba(10, 10, 15, 0.85) 100%);
    z-index: 1;
}

.header-content {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 14px;
    padding: 20px;
    align-items: flex-end;
}

.header-cover {
    width: 64px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.add-list-info {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
}

.add-list-info h4 {
    font-family: var(--font-display), 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.add-list-info p {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

/* ============================================
   FAVORITE BUTTON — Header heart toggle
   ============================================ */

.btn-fav-modal {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    flex-shrink: 0;
    margin-left: auto;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.btn-fav-modal:hover {
    background: rgba(239, 68, 108, 0.2);
    border-color: rgba(239, 68, 108, 0.4);
    color: #f87171;
}

.btn-fav-modal.active {
    background: rgba(239, 68, 108, 0.25);
    border-color: rgba(239, 68, 108, 0.5);
    color: #ef4444;
}

.btn-fav-modal.active svg {
    fill: #ef4444;
    stroke: #ef4444;
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.4));
}

.btn-fav-modal svg {
    width: 18px;
    height: 18px;
    transition: all 0.2s ease;
}

.btn-fav-modal:active {
    transform: scale(0.9);
}

/* ============================================
   STATUS CHIPS — Horizontal scroll
   ============================================ */

.status-chips-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 20px;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border);
}

.status-chips-scroll::-webkit-scrollbar {
    display: none;
}

.status-chips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 14px 0;
}

.status-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
    white-space: nowrap;
}

.status-chip svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.status-chip:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

/* Per-color active states */
.status-chip[data-color="blue"].active {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.4);
    color: #60a5fa;
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.15);
}

.status-chip[data-color="green"].active {
    background: rgba(74, 222, 128, 0.15);
    border-color: rgba(74, 222, 128, 0.4);
    color: #4ade80;
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.15);
}

.status-chip[data-color="cyan"].active {
    background: rgba(192, 132, 252, 0.15);
    border-color: rgba(192, 132, 252, 0.4);
    color: #c084fc;
    box-shadow: 0 0 12px rgba(192, 132, 252, 0.15);
}

.status-chip[data-color="purple"].active {
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.4);
    color: var(--primary-light);
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.15);
}

.status-chip[data-color="yellow"].active {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.4);
    color: #fbbf24;
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.15);
}

.status-chip[data-color="red"].active {
    background: rgba(248, 113, 113, 0.15);
    border-color: rgba(248, 113, 113, 0.4);
    color: #f87171;
    box-shadow: 0 0 12px rgba(248, 113, 113, 0.15);
}

/* Selection bounce animation */
.status-chip.active {
    animation: chipSelect 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes chipSelect {
    0% { transform: scale(0.92); }
    60% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ============================================
   STACKED CONTROLS
   ============================================ */

.add-list-controls-v2 {
    padding: 16px 20px 8px;
    background: var(--bg-deep);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
}

/* Rewatch row animation */
.control-row.rewatch-row {
    display: grid;
    grid-template-columns: 1fr auto;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease,
                padding 0.3s ease,
                margin 0.3s ease;
}

.control-row.rewatch-row.visible {
    max-height: 60px;
    opacity: 1;
    padding: 6px 0;
    margin: 0;
}

.control-row.rewatch-row input[type="hidden"] {
    display: none;
}

.control-label {
    font-family: var(--font-display), 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-row .stepper-control {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    height: 38px;
    width: 160px;
}

.stepper-btn {
    width: 36px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.stepper-btn:hover {
    background: var(--primary);
    color: white;
}

.stepper-btn:active {
    transform: scale(0.92);
}

.stepper-value-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 4px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    height: 100%;
    white-space: nowrap;
}

.stepper-value-wrap input {
    width: 32px;
    padding: 0;
    text-align: center;
    font-family: var(--font-body), 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    background: transparent;
    border: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.stepper-value-wrap input::-webkit-outer-spin-button,
.stepper-value-wrap input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.stepper-value-wrap input:focus {
    outline: none;
}

/* Score input specific styles */
.stepper-value-wrap input.score-input {
    width: 44px;
    font-size: 1rem;
    font-weight: 700;
}

.stepper-value-wrap input.score-input::placeholder {
    color: var(--text-muted);
    font-weight: 600;
}

.stepper-max {
    font-family: var(--font-body), 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.stepper-value {
    font-family: var(--font-body), 'Space Grotesk', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 36px;
    text-align: center;
    transition: color 0.2s ease;
}

.stepper-value.has-score {
    color: var(--primary);
    font-weight: 700;
}

/* Episode Progress Track */
.episode-progress-track {
    height: 0;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    margin: 0;
    overflow: hidden;
    transition: height 0.2s ease;
}

.episode-progress-track.has-progress {
    height: 3px;
}

.episode-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============================================
   SCORE FEEDBACK — Compact animated
   ============================================ */

.score-feedback {
    padding: 0 20px;
    background: var(--bg-deep);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    overflow: hidden;
    transition: height 0.2s ease, padding 0.2s ease;
}

.score-feedback.has-score {
    height: 72px;
    padding: 6px 20px 12px;
}

.score-feedback:not(.has-score) {
    height: 0;
}

.score-feedback-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: opacity 0.15s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.score-feedback-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.4;
    max-width: 360px;
    transition: opacity 0.15s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.score-feedback-label.score-changing,
.score-feedback-desc.score-changing {
    opacity: 0;
    transform: translateY(-6px);
}

/* ============================================
   EXTRAS SECTION — Inline expandable
   ============================================ */

.modal-extras {
    padding: 12px 20px 16px;
    background: var(--bg-deep);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Visibility toggle row */
.visibility-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.visibility-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.visibility-info svg {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

/* Small toggle switch */
.toggle-switch-sm {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.toggle-switch-sm input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider-sm {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-slider-sm::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-switch-sm input:checked + .toggle-slider-sm {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.4);
}

.toggle-switch-sm input:checked + .toggle-slider-sm::before {
    background: white;
    transform: translateX(18px);
}

/* ============================================
   INLINE EXPANDABLE — Notes & Custom Lists
   ============================================ */

.add-list-notes,
.add-list-custom {
    background: transparent;
    border-radius: 10px;
}

.add-list-notes summary,
.add-list-custom summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    list-style: none;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.add-list-notes summary::-webkit-details-marker,
.add-list-custom summary::-webkit-details-marker {
    display: none;
}

.add-list-notes summary::marker,
.add-list-custom summary::marker {
    display: none;
    content: '';
}

.add-list-notes summary svg,
.add-list-custom summary svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.add-list-notes[open] summary svg,
.add-list-custom[open] summary svg {
    color: var(--primary);
}

.add-list-notes summary:hover,
.add-list-custom summary:hover {
    border-color: rgba(var(--primary-rgb), 0.3);
    color: var(--text-primary);
}

.add-list-notes[open] summary,
.add-list-custom[open] summary {
    border-radius: 10px 10px 0 0;
    border-bottom-color: transparent;
    background: rgba(255, 255, 255, 0.03);
}

/* Notes indicator */
.extras-indicator {
    color: var(--primary);
    font-size: 0.9rem;
    line-height: 1;
    margin-left: auto;
}

/* Notes textarea */
.add-list-notes textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 10px 10px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    margin: 0;
}

.add-list-notes textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Custom Lists content */
.custom-lists-content {
    margin: 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 10px 10px;
}

.modal-custom-lists {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.custom-list-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.custom-list-toggle:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.custom-list-toggle.active {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: rgba(var(--primary-rgb), 0.4);
    color: var(--primary);
}

.custom-list-toggle .check-icon {
    width: 14px;
    height: 14px;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.15s ease;
}

.custom-list-toggle.active .check-icon {
    opacity: 1;
    transform: scale(1);
}

/* Inline list create */
.inline-list-create {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.inline-list-create input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.8rem;
}

.inline-list-create input:focus {
    outline: none;
    border-color: var(--primary);
}

.inline-list-create input::placeholder {
    color: var(--text-muted);
}

.btn-inline-create {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-inline-create:hover {
    background: var(--primary-hover);
}

.btn-inline-create svg {
    width: 16px;
    height: 16px;
}

.no-lists-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 0 0 6px 0;
}

/* ============================================
   ACTION BUTTONS — Inside modal
   ============================================ */

.modal-actions {
    padding: 16px 20px 20px;
    background: var(--bg-deep);
    border-radius: 0 0 16px 16px;
}

.btn-save-primary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn-save-primary:hover {
    transform: translateY(-1px);
}

.btn-save-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-save-primary svg {
    width: 18px;
    height: 18px;
}

/* Secondary save button (for "Update" when "Update All" is also shown) */
.btn-save-secondary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn-save-secondary:hover {
    background: var(--bg-elevated);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-save-secondary:active {
    transform: scale(0.98);
}

.btn-save-secondary svg {
    width: 16px;
    height: 16px;
}

/* When both buttons are shown, adjust layout */
.modal-actions:has(.btn-save-secondary) {
    display: flex;
    gap: 10px;
}

.modal-actions:has(.btn-save-secondary) .btn-save-primary {
    flex: 1.5;
    width: auto;
}

/* ============================================
   MOBILE — Bottom sheet (480px and below)
   ============================================ */

/* ============================================
   RESPONSIVE SIDEBAR — Show 7 entries, 8 with score
   ============================================ */

/* Base: show 7 entries (~87px each including gap) */
.series-sidebar {
    max-height: min(85vh, 600px);
}

/* When rewatch row is visible, show +1 entry (8 total) */
.modal-overlay:has(.rewatch-row.visible) .series-sidebar {
    max-height: min(88vh, 690px);
}

/* When modal has score, show +1 entry (8 total) */
/* Series modal adds has-score to overlay, entry modal adds to feedback */
#seriesModal.has-score .series-sidebar,
.modal-overlay:has(.score-feedback.has-score) .series-sidebar {
    max-height: min(88vh, 690px);
}

/* When both rewatch and score are present, show +2 entries (9 total) */
#seriesModal.has-score:has(.rewatch-row.visible) .series-sidebar,
.modal-overlay:has(.rewatch-row.visible):has(.score-feedback.has-score) .series-sidebar {
    max-height: min(90vh, 780px);
}

@media (max-width: 640px) {
    /* Hide series sidebar on mobile */
    .series-sidebar {
        display: none !important;
    }

    /* Bottom sheet layout for all mobile */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
        justify-content: flex-end;
    }

    .add-list-modal {
        max-width: 100%;
        width: 100%;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
        overflow-y: auto !important;
        transform: translateY(100%);
        opacity: 1;
        transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .modal-overlay.open .add-list-modal {
        transform: translateY(0);
    }

    .modal-overlay.closing .add-list-modal {
        transform: translateY(100%);
        transition: transform 0.25s ease-in;
    }

    /* Bottom sheet drag indicator — overlays on banner */
    .add-list-modal::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
        margin: 0 auto;
        position: relative;
        z-index: 11;
        top: 10px;
    }

    .add-list-header {
        border-radius: 0;
        margin-top: -4px;
    }

    /* Keep close/delete buttons square on mobile */
    .modal-close-float,
    .btn-remove-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        flex-shrink: 0;
    }

    .btn-remove-icon {
        right: 48px;
    }

    .header-cover {
        width: 56px;
        height: 80px;
    }

    .add-list-info h4 {
        font-size: 0.95rem;
    }

    .status-chip {
        padding: 8px 14px;
        font-size: 0.78rem;
    }

    .control-row .stepper-control {
        height: 44px;
        width: 170px;
    }

    .stepper-btn {
        width: 44px;
        min-height: 44px;
    }

    .btn-save-primary {
        min-height: 52px;
        font-size: 1rem;
        border-radius: 14px;
    }

    .btn-save-secondary {
        min-height: 52px;
        font-size: 0.9rem;
        border-radius: 14px;
    }

    .header-content {
        padding: 16px;
    }

    .score-feedback-desc {
        font-size: 0.68rem;
    }

    .add-list-notes textarea {
        font-size: 16px; /* Prevent iOS zoom */
    }

    .inline-list-create input {
        font-size: 16px; /* Prevent iOS zoom */
        min-height: 44px;
    }

    .btn-inline-create {
        width: 44px;
        height: 44px;
    }

    .modal-actions {
        border-radius: 0;
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }

    /* Hide episodes sidebar on mobile */
    .episodes-sidebar {
        display: none !important;
    }
}


/* ============================================
   EPISODES SIDEBAR — Right side floating panel
   ============================================ */

.episodes-sidebar {
    position: absolute;
    left: calc(100% + 12px);
    top: 0;
    width: 270px;
    display: none;
    flex-direction: column;
    gap: 8px;
    background: transparent;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 85vh;
    padding: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.episodes-sidebar::-webkit-scrollbar {
    width: 4px;
}

.episodes-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.episodes-sidebar-header {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.episodes-sidebar-header .ep-count {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Episode pagination navigation */
.episodes-sidebar-header .ep-nav-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: var(--bg-card);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.episodes-sidebar-header .ep-nav-btn svg {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
}

.episodes-sidebar-header .ep-nav-btn:hover:not(.disabled) {
    background: var(--bg-hover);
}

.episodes-sidebar-header .ep-nav-btn:hover:not(.disabled) svg {
    color: var(--text-primary);
}

.episodes-sidebar-header .ep-nav-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.episodes-sidebar-header .ep-page-info {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 50px;
    text-align: center;
}

/* Episode Grid Container - transparent, no background */
.episode-grid-container {
    background: transparent;
    padding: 0;
}

/* Episode Grid Layout - 5 columns */
.episode-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

/* Episode Square - floating with full color background */
.episode-square {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-deep);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    min-height: 48px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.episode-square:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.episode-square .ep-number {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
}

.episode-square .ep-score {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 2px;
    line-height: 1;
}

/* Score color coding - FULL background color */
.episode-square.score-red {
    background: rgba(248, 113, 113, 0.85);
}
.episode-square.score-red .ep-number,
.episode-square.score-red .ep-score { color: #fff; }

.episode-square.score-orange {
    background: rgba(251, 146, 60, 0.85);
}
.episode-square.score-orange .ep-number,
.episode-square.score-orange .ep-score { color: #fff; }

.episode-square.score-yellow {
    background: rgba(251, 191, 36, 0.85);
}
.episode-square.score-yellow .ep-number { color: #1a1a22; }
.episode-square.score-yellow .ep-score { color: rgba(0, 0, 0, 0.6); }

.episode-square.score-green {
    background: rgba(74, 222, 128, 0.85);
}
.episode-square.score-green .ep-number { color: #1a1a22; }
.episode-square.score-green .ep-score { color: rgba(0, 0, 0, 0.6); }

.episode-square.score-blue {
    background: rgba(96, 165, 250, 0.85);
}
.episode-square.score-blue .ep-number,
.episode-square.score-blue .ep-score { color: #fff; }

.episode-square.score-purple {
    background: rgba(192, 132, 252, 0.85);
}
.episode-square.score-purple .ep-number,
.episode-square.score-purple .ep-score { color: #fff; }

/* User has explicitly scored this episode - full opacity (vs inherited dimmed) */
.episode-square.user-scored .ep-score {
    font-weight: 600;
}

/* Inherited from entry score - slightly dimmed */
.episode-square.inherited-score {
    opacity: 0.7;
}

.episode-square.inherited-score:hover {
    opacity: 1;
}

/* Episode Sections (for 100+ episode anime) */
.episode-section {
    background: transparent;
    border: none;
    overflow: visible;
}

.episode-section summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    list-style: none;
    background: var(--bg-deep);
    border-radius: 6px;
    margin-bottom: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.episode-section summary::-webkit-details-marker {
    display: none;
}

.episode-section summary::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-muted);
    transition: transform 0.2s ease;
}

.episode-section[open] summary::after {
    transform: rotate(180deg);
}

.episode-section summary:hover {
    background: var(--bg-card);
}

.episode-section .episode-grid {
    padding: 0;
    border-top: none;
    margin-bottom: 8px;
}

/* Episode Score Popover */
.episode-score-popover {
    position: fixed;
    z-index: 10002;
    background: #1a1a22;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    width: 260px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
    animation: popoverIn 0.15s ease;
}

@keyframes popoverIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-4px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ep-popover-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 14px;
    background: #13131a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ep-popover-header span:first-child {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ep-community-info {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Score feedback (label + description) */
.ep-score-feedback {
    padding: 12px 14px;
    height: 105px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ep-score-feedback-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: color 0.15s ease;
    flex-shrink: 0;
}

.ep-score-feedback.has-score .ep-score-feedback-label {
    color: var(--primary);
}

.ep-score-feedback-desc {
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 4px;
    min-height: 48px;
    overflow: hidden;
}

/* Score stepper */
.ep-score-stepper {
    display: flex;
    align-items: center;
    background: #13131a;
    margin: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    height: 44px;
}

.ep-score-stepper button {
    width: 44px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.ep-score-stepper button:first-child {
    border-radius: 10px 0 0 10px;
}

.ep-score-stepper button:last-child {
    border-radius: 0 10px 10px 0;
}

.ep-score-stepper button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
}

.ep-score-stepper button:active {
    transform: scale(0.92);
}

.ep-score-stepper input {
    flex: 1;
    text-align: center;
    background: transparent;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
    height: 100%;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.ep-score-stepper input::-webkit-outer-spin-button,
.ep-score-stepper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ep-score-stepper input::placeholder {
    color: var(--text-muted);
    font-weight: 600;
}

/* Popover actions */
.ep-popover-actions {
    padding: 0 14px 12px;
}

.ep-popover-actions button {
    width: 100%;
    padding: 10px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--primary);
    border: none;
    color: white;
}

.ep-popover-actions button:hover {
    background: var(--primary-hover);
}

/* Popover backdrop */
.ep-popover-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    background: transparent;
}

/* No episodes message */
.episodes-empty {
    padding: 20px 12px;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}


/* ============================================
   SHARED MODAL SYSTEM STYLES
   (confirm/alert modals — kept from v1)
   ============================================ */

#sharedModalContainer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    pointer-events: none;
}

#sharedModal.modal-overlay {
    z-index: 10001 !important;
    pointer-events: none;
}

#sharedModal.modal-overlay.open {
    pointer-events: auto;
}

#sharedModal .modal.shared-modal {
    z-index: 10002;
}

.shared-modal {
    max-width: 420px;
    padding: 0;
    overflow: hidden;
}

.shared-modal .modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.shared-modal .modal-header h3 {
    flex: 1;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.shared-modal .modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.shared-modal .modal-close:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.shared-modal .modal-close svg {
    width: 18px;
    height: 18px;
}

.shared-modal .modal-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
}

.shared-modal .modal-icon svg {
    width: 24px;
    height: 24px;
}

.shared-modal .icon-info { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.shared-modal .icon-success { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.shared-modal .icon-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.shared-modal .icon-danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.shared-modal .icon-question { background: rgba(var(--primary-rgb), 0.15); color: var(--primary); }

.shared-modal .modal-body {
    padding: 20px;
    background: var(--bg-card);
}

.shared-modal .modal-message {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.shared-modal .modal-message strong {
    color: var(--text-primary);
    font-weight: 600;
}

.shared-modal .modal-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

.shared-modal .modal-footer button {
    flex: 1;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.shared-modal .btn-cancel { background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-secondary); }
.shared-modal .btn-cancel:hover { background: var(--bg-elevated); border-color: var(--border-hover); color: var(--text-primary); }
.shared-modal .btn-primary { background: var(--primary); border: none; color: white; }
.shared-modal .btn-primary:hover { background: var(--primary-hover); }
.shared-modal .btn-danger { background: #ef4444; border: none; color: white; }
.shared-modal .btn-danger:hover { background: #dc2626; }
.shared-modal .btn-secondary { background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-primary); }
.shared-modal .btn-secondary:hover { background: var(--bg-elevated); border-color: var(--border-hover); }

.shared-modal.modal-danger .modal-header { background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, var(--bg-elevated) 100%); }
.shared-modal.modal-success .modal-header { background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, var(--bg-elevated) 100%); }
.shared-modal.modal-warning .modal-header { background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, var(--bg-elevated) 100%); }

.shared-modal .modal-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-top: 12px;
    transition: border-color 0.2s;
}

.shared-modal .modal-input:focus { outline: none; border-color: var(--primary); }
.shared-modal .modal-input::placeholder { color: var(--text-muted); }

.shared-modal .form-group { margin-bottom: 16px; }
.shared-modal .form-group:last-child { margin-bottom: 0; }
.shared-modal .form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shared-modal .form-group input,
.shared-modal .form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.shared-modal .form-group input:focus,
.shared-modal .form-group textarea:focus { outline: none; border-color: var(--primary); }
.shared-modal .form-group textarea { resize: vertical; min-height: 80px; }

.shared-modal .checkbox-group { display: flex; align-items: center; }
.shared-modal .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.shared-modal .checkbox-label input[type="checkbox"] {
    width: auto;
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
    flex-shrink: 0;
    padding: 0;
}

.shared-modal .checkbox-label input[type="checkbox"]:hover { border-color: var(--primary); }
.shared-modal .checkbox-label input[type="checkbox"]:checked { background: var(--primary); border-color: var(--primary); }
.shared-modal .checkbox-label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.shared-modal .checkbox-label span { font-size: 0.9rem; color: var(--text-primary); }

@media (max-width: 480px) {
    .shared-modal { max-width: 100%; margin: 10px; }
    .shared-modal .modal-footer { flex-direction: column; }
    .shared-modal .modal-footer button { width: 100%; }
}
