/* ═══════════════════════════════════════════════════════════════════════════
   IMDB Portfolio Display — Frontend CSS
   10 Themes + Grunge Effects + Full UI Styling
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400;1,700&family=Bebas+Neue&family=Cinzel:wght@400;700;900&family=Special+Elite&family=Creepster&family=Metal+Mania&family=Raleway:wght@200;400;600;800&family=Courier+Prime:wght@400;700&family=Exo+2:wght@100;400;700;900&display=swap');

/* ─── CSS Variables ────────────────────────────────────────────────────────── */
.ipd-wrapper {
    --ipd-bg:         #0a0a0a;
    --ipd-surface:    #141414;
    --ipd-surface2:   #1e1e1e;
    --ipd-border:     #2a2a2a;
    --ipd-accent:     #c9a84c;
    --ipd-accent2:    #e8c97a;
    --ipd-text:       #e8e8e8;
    --ipd-text-muted: #666;
    --ipd-radius:     8px;
    --ipd-shadow:     0 4px 24px rgba(0,0,0,.6);
    --ipd-font-ui:    'Raleway', sans-serif;
    --ipd-font-display: 'Playfair Display', serif;
    --grunge-opacity: 0.4;
    --user-bg:        #0a0a0a;

    background: var(--ipd-bg);
    color: var(--ipd-text);
    font-family: var(--ipd-font-ui);
    padding: 2rem;
    border-radius: var(--ipd-radius);
    position: relative;
    overflow: hidden;
}

/* ─── Base UI Components ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

.ipd-step-header { margin-bottom: 2rem; text-align: center; }
.ipd-step-number {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    color: var(--ipd-accent);
    background: rgba(201,168,76,0.1);
    border: 1px solid rgba(201,168,76,0.3);
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}
.ipd-step-title {
    font-family: var(--ipd-font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--ipd-text);
    margin: 0.5rem 0;
}
.ipd-step-sub {
    color: var(--ipd-text-muted);
    font-size: 0.95rem;
    margin: 0;
}

/* Buttons */
.ipd-btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border: none; cursor: pointer;
    border-radius: var(--ipd-radius);
    font-family: var(--ipd-font-ui);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    text-decoration: none;
}
.ipd-btn--primary {
    background: linear-gradient(135deg, var(--ipd-accent), var(--ipd-accent2));
    color: #000;
}
.ipd-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201,168,76,0.4);
}
.ipd-btn--ghost {
    background: transparent;
    color: var(--ipd-text-muted);
    border: 1px solid var(--ipd-border);
}
.ipd-btn--ghost:hover {
    border-color: var(--ipd-accent);
    color: var(--ipd-accent);
}
.ipd-btn--sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.ipd-btn svg { width: 16px; height: 16px; }

/* URL Form */
.ipd-url-form { max-width: 680px; margin: 0 auto; }
.ipd-input-group {
    display: flex; gap: 0;
    background: var(--ipd-surface);
    border: 1px solid var(--ipd-border);
    border-radius: var(--ipd-radius);
    overflow: hidden;
    transition: border-color 0.2s;
}
.ipd-input-group:focus-within { border-color: var(--ipd-accent); }
.ipd-input-icon {
    display: flex; align-items: center;
    padding: 0 1rem;
    color: var(--ipd-text-muted);
}
.ipd-input-icon svg { width: 18px; height: 18px; }
.ipd-url-input {
    flex: 1;
    background: transparent;
    border: none; outline: none;
    color: var(--ipd-text);
    font-size: 0.95rem;
    font-family: var(--ipd-font-ui);
    padding: 0.9rem 0;
}
.ipd-url-input::placeholder { color: var(--ipd-text-muted); }
.ipd-url-form .ipd-btn--primary { border-radius: 0; padding: 0.9rem 1.5rem; flex-shrink: 0; }
.ipd-hint { color: var(--ipd-text-muted); font-size: 0.8rem; margin-top: 0.5rem; }
.ipd-hint code { background: var(--ipd-surface2); padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.85em; }

/* Loading & Error */
.ipd-loading {
    display: flex; align-items: center; gap: 0.75rem;
    color: var(--ipd-text-muted);
    margin-top: 1rem;
    font-size: 0.9rem;
}
.ipd-spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--ipd-border);
    border-top-color: var(--ipd-accent);
    border-radius: 50%;
    animation: ipd-spin 0.7s linear infinite;
}
@keyframes ipd-spin { to { transform: rotate(360deg); } }
.ipd-error {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(220,38,38,0.1);
    border: 1px solid rgba(220,38,38,0.3);
    border-radius: var(--ipd-radius);
    color: #f87171;
    font-size: 0.875rem;
}

/* Person Card */
.ipd-person-card {
    display: flex; align-items: center; gap: 1.25rem;
    background: var(--ipd-surface);
    border: 1px solid var(--ipd-border);
    border-radius: var(--ipd-radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}
.ipd-person-card img {
    width: 60px; height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid var(--ipd-accent);
}
.ipd-person-card-name { font-size: 1.3rem; font-weight: 700; font-family: var(--ipd-font-display); }
.ipd-person-card-meta { color: var(--ipd-text-muted); font-size: 0.85rem; margin-top: 0.2rem; }

/* Selection Toolbar */
.ipd-selection-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem; flex-wrap: wrap; gap: 0.75rem;
}
.ipd-selection-count { font-weight: 600; color: var(--ipd-accent); }
.ipd-toolbar-actions { display: flex; gap: 0.5rem; align-items: center; }
.ipd-filter-input {
    background: var(--ipd-surface);
    border: 1px solid var(--ipd-border);
    color: var(--ipd-text);
    padding: 0.45rem 0.75rem;
    border-radius: var(--ipd-radius);
    font-size: 0.85rem;
    font-family: var(--ipd-font-ui);
    outline: none;
    width: 180px;
}
.ipd-filter-input:focus { border-color: var(--ipd-accent); }

/* Movies Grid */
.ipd-movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-bottom: 1.5rem;
}
.ipd-movies-grid::-webkit-scrollbar { width: 4px; }
.ipd-movies-grid::-webkit-scrollbar-track { background: var(--ipd-surface); }
.ipd-movies-grid::-webkit-scrollbar-thumb { background: var(--ipd-border); border-radius: 2px; }

.ipd-movie-card {
    position: relative;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    background: var(--ipd-surface);
}
.ipd-movie-card:hover { border-color: var(--ipd-accent); transform: translateY(-3px); }
.ipd-movie-card.ipd-selected { border-color: var(--ipd-accent); box-shadow: 0 0 0 2px rgba(201,168,76,0.3); }
.ipd-movie-card input[type="checkbox"] { display: none; }
.ipd-movie-poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; }
.ipd-movie-poster-placeholder {
    width: 100%; aspect-ratio: 2/3;
    background: var(--ipd-surface2);
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 0.5rem;
    color: var(--ipd-text-muted);
    font-size: 0.7rem;
    text-align: center;
    padding: 0.5rem;
}
.ipd-movie-poster-placeholder svg { width: 28px; height: 28px; opacity: 0.4; }
.ipd-movie-info { padding: 0.5rem; }
.ipd-movie-title { font-size: 0.75rem; font-weight: 600; line-height: 1.3; color: var(--ipd-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ipd-movie-year { font-size: 0.7rem; color: var(--ipd-text-muted); margin-top: 0.1rem; }
.ipd-movie-check {
    position: absolute; top: 6px; right: 6px;
    width: 22px; height: 22px;
    background: rgba(201,168,76,0.9);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.15s;
    color: #000;
}
.ipd-movie-check svg { width: 12px; height: 12px; }
.ipd-selected .ipd-movie-check { opacity: 1; }

/* Step Actions */
.ipd-step-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 2rem; }

/* ─── Config Panels ────────────────────────────────────────────────────────── */
.ipd-config-panels { display: flex; flex-direction: column; gap: 1.5rem; }
.ipd-config-panel {
    background: var(--ipd-surface);
    border: 1px solid var(--ipd-border);
    border-radius: var(--ipd-radius);
    padding: 1.5rem;
}
.ipd-config-panel--row { display: flex; gap: 2rem; flex-wrap: wrap; }
.ipd-config-panel--row .ipd-config-group { flex: 1; min-width: 220px; }
.ipd-config-heading {
    display: flex; align-items: center; gap: 0.6rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ipd-accent);
    margin: 0 0 1rem 0;
}
.ipd-config-heading svg { width: 15px; height: 15px; }

/* Theme Grid */
.ipd-themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.75rem;
}
.ipd-theme-card {
    display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
    cursor: pointer;
    padding: 0.5rem;
    border: 2px solid var(--ipd-border);
    border-radius: var(--ipd-radius);
    transition: all 0.2s;
    text-align: center;
}
.ipd-theme-card:hover { border-color: var(--ipd-accent); }
.ipd-theme-card--active, .ipd-theme-card input:checked ~ * { border-color: var(--ipd-accent) !important; }
.ipd-theme-card input { display: none; }
.ipd-theme-preview {
    width: 56px; height: 70px;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    position: relative;
    overflow: hidden;
}
.ipd-theme-name { font-size: 0.7rem; font-weight: 700; color: var(--ipd-text); line-height: 1.2; }
.ipd-theme-vibe { font-size: 0.6rem; color: var(--ipd-text-muted); }

/* Theme preview backgrounds */
.ipd-theme-preview--studio-gold     { background: linear-gradient(135deg,#111 0%,#2a1f00 100%); border: 1px solid #c9a84c; }
.ipd-theme-preview--silver-screen   { background: linear-gradient(135deg,#111 0%,#333 100%); border: 1px solid #ccc; }
.ipd-theme-preview--noir            { background: linear-gradient(135deg,#000 0%,#1a1a1a 100%); border: 1px solid #444; }
.ipd-theme-preview--vintage-reel    { background: linear-gradient(135deg,#1a1200 0%,#3d2e00 100%); border: 1px solid #8b7536; }
.ipd-theme-preview--neon-dystopia   { background: linear-gradient(135deg,#000510 0%,#0a002a 100%); border: 1px solid #00ffff; }
.ipd-theme-preview--crimson-horror  { background: linear-gradient(135deg,#0a0000 0%,#1a0000 100%); border: 1px solid #8b0000; }
.ipd-theme-preview--grunge-underground { background: linear-gradient(135deg,#0d0d0d 0%,#1a1209 100%); border: 1px solid #555; }
.ipd-theme-preview--deep-dread      { background: linear-gradient(135deg,#000 0%,#001200 100%); border: 1px solid #003300; }
.ipd-theme-preview--splatter-house  { background: linear-gradient(135deg,#0a0000 0%,#2a0000 100%); border: 1px solid #cc0000; }
.ipd-theme-preview--psycho-circus   { background: linear-gradient(135deg,#0a0010 0%,#1a0010 100%); border: 1px solid #ff00aa; }

/* Layout Options */
.ipd-layout-options { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.ipd-radio-card {
    display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
    cursor: pointer;
    padding: 0.6rem 0.8rem;
    border: 2px solid var(--ipd-border);
    border-radius: var(--ipd-radius);
    min-width: 70px;
    transition: all 0.2s;
    font-size: 0.72rem;
    color: var(--ipd-text-muted);
}
.ipd-radio-card:hover { border-color: var(--ipd-accent); color: var(--ipd-text); }
.ipd-radio-card--active { border-color: var(--ipd-accent) !important; color: var(--ipd-accent) !important; }
.ipd-radio-card input { display: none; }
.ipd-radio-card svg { width: 24px; height: 24px; }

/* Color Picker */
.ipd-color-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.ipd-color-picker {
    width: 48px; height: 40px;
    border: 2px solid var(--ipd-border);
    border-radius: 6px;
    background: none;
    cursor: pointer;
    padding: 2px;
}
.ipd-color-label { font-family: 'Courier Prime', monospace; font-size: 0.85rem; color: var(--ipd-text-muted); }
.ipd-preset-colors { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.ipd-preset-color-label { font-size: 0.75rem; color: var(--ipd-text-muted); margin-right: 0.25rem; }
.ipd-color-preset {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    outline: none;
}
.ipd-color-preset:hover { transform: scale(1.2); border-color: var(--ipd-text); }

/* Toggles */
.ipd-overlay-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.5rem; margin-bottom: 1rem; }
.ipd-toggle-group h4 { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ipd-text-muted); margin: 0 0 0.75rem 0; }
.ipd-toggle {
    display: flex; align-items: center; gap: 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--ipd-text);
    margin-bottom: 0.5rem;
    user-select: none;
}
.ipd-toggle input { display: none; }
.ipd-toggle-slider {
    width: 36px; height: 20px;
    background: var(--ipd-surface2);
    border-radius: 10px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.ipd-toggle-slider::after {
    content: '';
    position: absolute;
    width: 14px; height: 14px;
    background: #fff;
    border-radius: 50%;
    top: 3px; left: 3px;
    transition: left 0.2s;
}
.ipd-toggle input:checked ~ .ipd-toggle-slider { background: var(--ipd-accent); }
.ipd-toggle input:checked ~ .ipd-toggle-slider::after { left: 19px; }
.ipd-overlay-intensity { display: flex; align-items: center; gap: 0.75rem; }
.ipd-overlay-intensity label { font-size: 0.8rem; color: var(--ipd-text-muted); white-space: nowrap; }
.ipd-overlay-intensity input[type="range"] { flex: 1; accent-color: var(--ipd-accent); }
#ipd-grunge-val { font-size: 0.8rem; color: var(--ipd-accent); min-width: 35px; font-family: 'Courier Prime', monospace; }

/* ═══════════════════════════════════════════════════════════════════════════
   SHOWCASE OUTPUT — Base Styles
   ═══════════════════════════════════════════════════════════════════════════ */
.ipd-showcase-actions { display: flex; justify-content: space-between; margin-bottom: 1.5rem; }

#ipd-showcase-output {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #0a0905; /* fallback — engine sets this inline */
}

/* Byline Header */
.ipd-showcase-header {
    text-align: center;
    padding: 3rem 2rem 1.5rem;
    position: relative;
    z-index: 2;
}
.ipd-showcase-byline {
    font-size: 0.7rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    opacity: 0.5;
    margin-bottom: 0.5rem;
}
.ipd-showcase-name {
    font-family: var(--showcase-font-display, 'Playfair Display');
    font-size: clamp(2rem, 6vw, 4.5rem);
    font-weight: 900;
    line-height: 1;
    color: var(--showcase-accent, #c9a84c);
}
.ipd-showcase-sub {
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    opacity: 0.6;
    margin-top: 0.5rem;
}

/* Decorative rule */
.ipd-showcase-rule {
    display: flex; align-items: center; gap: 1rem;
    padding: 0 2rem;
    margin-bottom: 0.5rem;
}
.ipd-showcase-rule-line { flex: 1; height: 1px; background: var(--showcase-accent, #c9a84c); opacity: 0.3; }
.ipd-showcase-rule-icon { font-size: 1.2rem; opacity: 0.5; }

/* Poster Grid Layouts */
.ipd-poster-grid {
    padding: 1.5rem 2rem 3rem;
    position: relative;
    z-index: 2;
}
/* Grid */
.ipd-layout-grid .ipd-poster-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
}
/* Masonry */
.ipd-layout-masonry .ipd-poster-grid-inner {
    columns: 5;
    column-gap: 1rem;
}
.ipd-layout-masonry .ipd-poster-item { break-inside: avoid; margin-bottom: 1rem; }
/* Film Strip */
.ipd-layout-horizontal .ipd-poster-grid-inner {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}
.ipd-layout-horizontal .ipd-poster-item { flex: 0 0 140px; }
/* Featured */
.ipd-layout-featured .ipd-poster-grid-inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 1rem;
}
.ipd-layout-featured .ipd-poster-item:first-child { grid-row: span 2; }

/* Individual Poster */
.ipd-poster-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 6px;
    transform-origin: center bottom;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.ipd-poster-item:hover { transform: scale(1.04) translateY(-4px); }
.ipd-poster-img { width: 100%; display: block; aspect-ratio: 2/3; object-fit: cover; }
.ipd-poster-no-img {
    width: 100%; aspect-ratio: 2/3;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column;
    gap: 0.5rem;
    background: #111;
}

/* Poster overlay info */
.ipd-poster-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 60%);
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 0.75rem;
    opacity: 0; transition: opacity 0.3s ease;
}
.ipd-poster-item.ipd-always-show .ipd-poster-overlay { opacity: 1; }
.ipd-poster-item:hover .ipd-poster-overlay { opacity: 1; }
.ipd-poster-movie-title { font-size: 0.75rem; font-weight: 700; line-height: 1.3; color: #fff; }
.ipd-poster-movie-year { font-size: 0.65rem; color: rgba(255,255,255,0.6); }
.ipd-poster-movie-role { font-size: 0.65rem; color: rgba(255,255,255,0.5); font-style: italic; }

/* ─── Global Overlay Effects ───────────────────────────────────────────────── */
.ipd-fx-overlay {
    position: absolute; inset: 0; pointer-events: none; z-index: 10;
}

/* Vignette */
.ipd-fx-vignette {
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.8) 100%);
}

/* Film Grain */
.ipd-fx-grain {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.4'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 128px 128px;
    mix-blend-mode: overlay;
    opacity: var(--grunge-opacity);
    animation: ipd-grain 0.3s steps(1) infinite;
}
@keyframes ipd-grain {
    0%   { background-position: 0 0; }
    25%  { background-position: -50px -30px; }
    50%  { background-position: -100px 0; }
    75%  { background-position: -50px 30px; }
    100% { background-position: 0 0; }
}

/* Scanlines */
.ipd-fx-scanlines {
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.15) 2px,
        rgba(0,0,0,0.15) 4px
    );
}

/* Fog */
.ipd-fx-fog {
    background: radial-gradient(ellipse 80% 40% at 20% 80%, rgba(255,255,255,0.04) 0%, transparent 70%),
                radial-gradient(ellipse 60% 30% at 80% 20%, rgba(255,255,255,0.02) 0%, transparent 60%);
    animation: ipd-fog 8s ease-in-out infinite alternate;
}
@keyframes ipd-fog { from { opacity: 0.5; } to { opacity: 1; } }

/* Drips */
.ipd-fx-drips::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 120px;
    background:
        radial-gradient(ellipse 3px 40px at 15% 0%, rgba(180,0,0,0.7) 0%, transparent 100%),
        radial-gradient(ellipse 2px 60px at 35% 0%, rgba(140,0,0,0.5) 0%, transparent 100%),
        radial-gradient(ellipse 3px 30px at 55% 0%, rgba(180,0,0,0.6) 0%, transparent 100%),
        radial-gradient(ellipse 2px 50px at 70% 0%, rgba(160,0,0,0.4) 0%, transparent 100%),
        radial-gradient(ellipse 3px 45px at 85% 0%, rgba(180,0,0,0.7) 0%, transparent 100%);
}

/* ─── Per-poster Effects ───────────────────────────────────────────────────── */
/* Grunge */
.ipd-poster-fx-grunge::before {
    content: '';
    position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='0.5'/%3E%3C/svg%3E");
    background-size: cover;
    mix-blend-mode: multiply;
    opacity: var(--grunge-opacity);
    pointer-events: none;
    z-index: 3;
}

/* Scratches */
.ipd-poster-fx-scratch::after {
    content: '';
    position: absolute; inset: 0;
    background:
        linear-gradient(100deg, transparent 40%, rgba(255,255,255,0.04) 40.5%, transparent 41%),
        linear-gradient(98deg, transparent 70%, rgba(255,255,255,0.03) 70.5%, transparent 71%),
        linear-gradient(102deg, transparent 20%, rgba(255,255,255,0.02) 20.5%, transparent 21%);
    pointer-events: none; z-index: 4;
}

/* Burnt Edges */
.ipd-poster-fx-burn::before {
    content: '';
    position: absolute; inset: 0;
    box-shadow: inset 0 0 30px 10px rgba(0,0,0,0.9);
    pointer-events: none; z-index: 4;
    border-radius: inherit;
}

/* Torn Edges */
.ipd-poster-fx-torn {
    clip-path: polygon(
        0% 2%, 2% 0%, 98% 1%, 100% 0%,
        100% 98%, 98% 100%, 3% 99%, 0% 100%
    );
}

/* Blood Splatter */
.ipd-poster-fx-blood::after {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 40%;
    background:
        radial-gradient(ellipse 8px 12px at 20% 5%, rgba(180,0,0,0.6) 0%, transparent 100%),
        radial-gradient(ellipse 5px 8px at 45% 10%, rgba(150,0,0,0.5) 0%, transparent 100%),
        radial-gradient(ellipse 10px 6px at 75% 3%, rgba(180,0,0,0.4) 0%, transparent 100%),
        radial-gradient(ellipse 6px 10px at 90% 15%, rgba(160,0,0,0.6) 0%, transparent 100%);
    pointer-events: none; z-index: 5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME 1: STUDIO GOLD  (Professional, Prestige, Hollywood)
   ═══════════════════════════════════════════════════════════════════════════ */
.ipd-theme-studio-gold {
    --showcase-font-display: 'Cinzel', serif;
    --showcase-font-body: 'Raleway', sans-serif;
    --showcase-accent: #c9a84c;
    --showcase-text: #f0e8d0;
    background: var(--user-bg);
}
.ipd-theme-studio-gold .ipd-showcase-header {
    background: linear-gradient(180deg, rgba(201,168,76,0.08) 0%, transparent 100%);
    border-bottom: 1px solid rgba(201,168,76,0.2);
}
.ipd-theme-studio-gold .ipd-showcase-name {
    font-family: 'Cinzel', serif;
    background: linear-gradient(135deg, #c9a84c, #f0d070, #c9a84c);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    text-shadow: none;
    letter-spacing: 0.08em;
}
.ipd-theme-studio-gold .ipd-poster-item {
    box-shadow: 0 8px 24px rgba(0,0,0,0.6), 0 0 0 1px rgba(201,168,76,0.2);
}
.ipd-theme-studio-gold .ipd-poster-item:hover {
    box-shadow: 0 16px 40px rgba(0,0,0,0.8), 0 0 0 2px rgba(201,168,76,0.5);
}
.ipd-theme-studio-gold .ipd-poster-no-img {
    background: linear-gradient(135deg, #1a1400, #2a2000);
    border: 1px solid rgba(201,168,76,0.2);
    color: #c9a84c;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME 2: SILVER SCREEN (Prestige, Awards-Season)
   ═══════════════════════════════════════════════════════════════════════════ */
.ipd-theme-silver-screen {
    --showcase-font-display: 'Playfair Display', serif;
    --showcase-accent: #e0e0e0;
}
.ipd-theme-silver-screen .ipd-showcase-name {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    color: #e0e0e0;
    letter-spacing: 0.02em;
}
.ipd-theme-silver-screen .ipd-showcase-header {
    border-bottom: 3px double rgba(200,200,200,0.3);
}
.ipd-theme-silver-screen .ipd-poster-item {
    filter: contrast(1.05) brightness(0.95);
    box-shadow: 4px 4px 0 rgba(255,255,255,0.05), -1px -1px 0 rgba(0,0,0,0.5);
}
.ipd-theme-silver-screen .ipd-poster-no-img {
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border: 1px solid #333;
    color: #888;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME 3: FILM NOIR  (Cinematic, Moody)
   ═══════════════════════════════════════════════════════════════════════════ */
.ipd-theme-noir {
    --showcase-font-display: 'Playfair Display', serif;
    --showcase-accent: #e8e8e8;
}
.ipd-theme-noir .ipd-showcase-name {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    color: #fff;
    text-shadow: 3px 3px 0 #000, -1px -1px 0 #333;
    letter-spacing: 0.05em;
}
.ipd-theme-noir .ipd-poster-item {
    filter: grayscale(60%) contrast(1.2);
    box-shadow: 6px 6px 20px rgba(0,0,0,0.8);
}
.ipd-theme-noir .ipd-poster-item:hover { filter: grayscale(20%) contrast(1.15); }
.ipd-theme-noir .ipd-poster-no-img { background: #111; border: 1px solid #333; color: #555; }

/* ═══════════════════════════════════════════════════════════════════════════
   THEME 4: VINTAGE REEL  (Old Hollywood Sepia)
   ═══════════════════════════════════════════════════════════════════════════ */
.ipd-theme-vintage-reel {
    --showcase-font-display: 'Special Elite', cursive;
    --showcase-accent: #d4a84b;
}
.ipd-theme-vintage-reel .ipd-showcase-name {
    font-family: 'Special Elite', cursive;
    color: #d4a84b;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    letter-spacing: 0.04em;
}
.ipd-theme-vintage-reel .ipd-poster-item {
    filter: sepia(40%) contrast(1.1) brightness(0.9);
    box-shadow: 4px 4px 0 rgba(212,168,75,0.2);
}
.ipd-theme-vintage-reel .ipd-poster-no-img {
    background: linear-gradient(135deg, #1a1200, #2d1f00);
    border: 1px solid #5a4010;
    color: #7a5a20;
}
.ipd-theme-vintage-reel #ipd-showcase-output::before {
    content: '';
    position: absolute; inset: 0;
    background:
        repeating-linear-gradient(90deg, transparent 0, transparent 30px, rgba(212,168,75,0.03) 30px, rgba(212,168,75,0.03) 31px);
    pointer-events: none; z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME 5: NEON DYSTOPIA  (Cyberpunk)
   ═══════════════════════════════════════════════════════════════════════════ */
.ipd-theme-neon-dystopia {
    --showcase-font-display: 'Exo 2', sans-serif;
    --showcase-accent: #00ffff;
}
.ipd-theme-neon-dystopia .ipd-showcase-name {
    font-family: 'Exo 2', sans-serif;
    font-weight: 900;
    color: #00ffff;
    text-shadow: 0 0 20px rgba(0,255,255,0.8), 0 0 40px rgba(0,255,255,0.4);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.ipd-theme-neon-dystopia .ipd-showcase-header {
    border-bottom: 1px solid rgba(0,255,255,0.2);
}
.ipd-theme-neon-dystopia .ipd-poster-item {
    box-shadow: 0 0 15px rgba(0,255,255,0.15), 0 0 0 1px rgba(0,255,255,0.1);
}
.ipd-theme-neon-dystopia .ipd-poster-item:hover {
    box-shadow: 0 0 30px rgba(0,255,255,0.4), 0 0 0 1px rgba(0,255,255,0.5);
}
.ipd-theme-neon-dystopia .ipd-poster-no-img {
    background: linear-gradient(135deg, #000510, #000a2a);
    border: 1px solid rgba(0,255,255,0.2);
    color: #00ffff;
}
.ipd-theme-neon-dystopia #ipd-showcase-output::before {
    content: '';
    position: absolute; inset: 0;
    background:
        linear-gradient(180deg, rgba(0,255,255,0.03) 0%, transparent 30%),
        repeating-linear-gradient(0deg, transparent 0px, transparent 3px, rgba(0,255,255,0.02) 3px, rgba(0,255,255,0.02) 4px);
    pointer-events: none; z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME 6: CRIMSON HORROR
   ═══════════════════════════════════════════════════════════════════════════ */
.ipd-theme-crimson-horror {
    --showcase-font-display: 'Creepster', cursive;
    --showcase-accent: #cc0000;
}
.ipd-theme-crimson-horror .ipd-showcase-name {
    font-family: 'Creepster', cursive;
    color: #cc0000;
    text-shadow: 0 0 30px rgba(200,0,0,0.6), 2px 2px 0 #000;
    letter-spacing: 0.05em;
    font-size: clamp(2.5rem, 7vw, 5rem);
}
.ipd-theme-crimson-horror .ipd-showcase-header {
    border-bottom: 1px solid rgba(200,0,0,0.3);
}
.ipd-theme-crimson-horror .ipd-poster-item {
    box-shadow: 0 8px 30px rgba(200,0,0,0.2), 0 0 0 1px rgba(200,0,0,0.15);
}
.ipd-theme-crimson-horror .ipd-poster-item:hover {
    box-shadow: 0 12px 40px rgba(200,0,0,0.4), 0 0 0 2px rgba(200,0,0,0.4);
}
.ipd-theme-crimson-horror .ipd-poster-no-img {
    background: linear-gradient(135deg, #0a0000, #180000);
    border: 1px solid rgba(200,0,0,0.2);
    color: #660000;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME 7: GRUNGE UNDERGROUND  (Punk / Industrial)
   ═══════════════════════════════════════════════════════════════════════════ */
.ipd-theme-grunge-underground {
    --showcase-font-display: 'Special Elite', cursive;
    --showcase-accent: #ff6600;
}
.ipd-theme-grunge-underground .ipd-showcase-name {
    font-family: 'Special Elite', cursive;
    color: #ff6600;
    text-shadow: 3px 3px 0 #000, -2px -1px 0 #333;
    letter-spacing: 0.02em;
    transform: rotate(-1deg);
    display: inline-block;
}
.ipd-theme-grunge-underground .ipd-poster-item {
    filter: contrast(1.15) saturate(0.8);
    transform: rotate(calc((var(--i, 0) % 3 - 1) * 0.5deg));
    box-shadow: 4px 4px 0 #000;
}
.ipd-theme-grunge-underground .ipd-poster-item:hover {
    filter: contrast(1.2) saturate(1);
    transform: rotate(0) scale(1.05);
}
.ipd-theme-grunge-underground .ipd-poster-no-img {
    background: repeating-linear-gradient(45deg, #111 0px, #111 10px, #0d0d0d 10px, #0d0d0d 20px);
    border: 2px solid #333;
    color: #555;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME 8: DEEP DREAD  (Dark Horror, Forest/Creature)
   ═══════════════════════════════════════════════════════════════════════════ */
.ipd-theme-deep-dread {
    --showcase-font-display: 'Creepster', cursive;
    --showcase-accent: #00aa44;
}
.ipd-theme-deep-dread .ipd-showcase-name {
    font-family: 'Creepster', cursive;
    color: #00aa44;
    text-shadow: 0 0 40px rgba(0,180,60,0.5), 2px 2px 0 #000;
    letter-spacing: 0.08em;
}
.ipd-theme-deep-dread .ipd-poster-item {
    filter: hue-rotate(100deg) saturate(0.7) contrast(1.1);
    box-shadow: 0 8px 30px rgba(0,100,30,0.3);
}
.ipd-theme-deep-dread .ipd-poster-item:hover {
    filter: hue-rotate(90deg) saturate(1) contrast(1.15);
    box-shadow: 0 0 40px rgba(0,150,50,0.5);
}
.ipd-theme-deep-dread .ipd-poster-no-img {
    background: linear-gradient(135deg, #000d00, #001a00);
    border: 1px solid rgba(0,100,30,0.3);
    color: #003300;
}
.ipd-theme-deep-dread #ipd-showcase-output::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,20,0,0.6) 100%);
    pointer-events: none; z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME 9: SPLATTER HOUSE  (Extreme Horror)
   ═══════════════════════════════════════════════════════════════════════════ */
.ipd-theme-splatter-house {
    --showcase-font-display: 'Metal Mania', cursive;
    --showcase-accent: #ff0000;
}
.ipd-theme-splatter-house .ipd-showcase-name {
    font-family: 'Metal Mania', cursive;
    color: #ff0000;
    text-shadow: 0 0 20px rgba(255,0,0,0.8), 3px 3px 0 #000;
    letter-spacing: 0.04em;
    font-size: clamp(2.5rem, 7vw, 5.5rem);
}
.ipd-theme-splatter-house .ipd-poster-item {
    box-shadow: 0 0 20px rgba(255,0,0,0.15), 0 0 0 1px rgba(255,0,0,0.1);
}
.ipd-theme-splatter-house .ipd-poster-item:hover {
    box-shadow: 0 0 40px rgba(255,0,0,0.5), 0 0 0 2px rgba(255,0,0,0.5);
}
.ipd-theme-splatter-house .ipd-poster-no-img {
    background: linear-gradient(135deg, #0a0000, #200000);
    border: 1px solid rgba(255,0,0,0.15);
    color: #800000;
}
.ipd-theme-splatter-house #ipd-showcase-output::before {
    content: '';
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 20px 40px at 10% 2%, rgba(180,0,0,0.5) 0%, transparent 100%),
        radial-gradient(ellipse 15px 30px at 30% 1%, rgba(150,0,0,0.4) 0%, transparent 100%),
        radial-gradient(ellipse 25px 50px at 60% 3%, rgba(180,0,0,0.5) 0%, transparent 100%),
        radial-gradient(ellipse 12px 20px at 80% 1%, rgba(160,0,0,0.3) 0%, transparent 100%),
        radial-gradient(ellipse 20px 35px at 95% 2%, rgba(180,0,0,0.5) 0%, transparent 100%);
    pointer-events: none; z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME 10: PSYCHO CIRCUS  (Twisted / Occult Horror)
   ═══════════════════════════════════════════════════════════════════════════ */
.ipd-theme-psycho-circus {
    --showcase-font-display: 'Creepster', cursive;
    --showcase-accent: #ff00cc;
}
.ipd-theme-psycho-circus .ipd-showcase-name {
    font-family: 'Creepster', cursive;
    background: linear-gradient(135deg, #ff00cc, #ff6600, #ffff00, #00ffcc);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgba(255,0,200,0.6));
    letter-spacing: 0.06em;
    font-size: clamp(2.5rem, 7vw, 5rem);
}
.ipd-theme-psycho-circus .ipd-poster-item {
    box-shadow: 0 0 20px rgba(255,0,200,0.2);
}
.ipd-theme-psycho-circus .ipd-poster-item:nth-child(odd) {
    filter: hue-rotate(0deg);
}
.ipd-theme-psycho-circus .ipd-poster-item:nth-child(even) {
    filter: hue-rotate(30deg) saturate(1.2);
}
.ipd-theme-psycho-circus .ipd-poster-item:hover {
    box-shadow: 0 0 40px rgba(255,0,200,0.6);
    filter: hue-rotate(45deg) saturate(1.5) contrast(1.1) !important;
}
.ipd-theme-psycho-circus .ipd-poster-no-img {
    background: linear-gradient(135deg, #0a0010, #200010);
    border: 1px solid rgba(255,0,200,0.2);
    color: #660066;
}
.ipd-theme-psycho-circus #ipd-showcase-output::before {
    content: '';
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(255,0,200,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0,255,200,0.04) 0%, transparent 50%);
    pointer-events: none; z-index: 1;
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .ipd-themes-grid { grid-template-columns: repeat(5, 1fr); }
    .ipd-layout-featured .ipd-poster-grid-inner { grid-template-columns: 1fr 1fr; }
    .ipd-layout-featured .ipd-poster-item:first-child { grid-row: span 1; }
    .ipd-showcase-name { font-size: clamp(1.8rem, 8vw, 3rem); }
    .ipd-config-panel--row { flex-direction: column; }
}
@media (max-width: 480px) {
    .ipd-themes-grid { grid-template-columns: repeat(3, 1fr); }
    .ipd-movies-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    .ipd-layout-masonry .ipd-poster-grid-inner { columns: 3; }
}

/* ─── Manual Fallback UI ───────────────────────────────────────────────────── */
.ipd-fallback-box {
    background: var(--ipd-surface);
    border: 1px solid #3a2000;
    border-radius: var(--ipd-radius);
    padding: 1.5rem;
    margin-top: 1.25rem;
}
.ipd-fallback-header {
    display: flex; align-items: flex-start; gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.ipd-fallback-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: 2px; }
.ipd-fallback-header strong { color: #fbbf24; display: block; margin-bottom: 0.25rem; }
.ipd-fallback-header p { color: var(--ipd-text-muted); font-size: 0.85rem; margin: 0; }

.ipd-fallback-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.ipd-ftab {
    background: var(--ipd-surface2);
    border: 1px solid var(--ipd-border);
    color: var(--ipd-text-muted);
    padding: 0.45rem 0.9rem;
    border-radius: var(--ipd-radius);
    cursor: pointer;
    font-size: 0.82rem;
    font-family: var(--ipd-font-ui);
    transition: all 0.15s;
}
.ipd-ftab:hover { border-color: var(--ipd-accent); color: var(--ipd-accent); }
.ipd-ftab--active { background: rgba(201,168,76,0.1); border-color: var(--ipd-accent); color: var(--ipd-accent); }

.ipd-fallback-note {
    color: var(--ipd-text-muted);
    font-size: 0.82rem;
    margin: 0 0 1rem;
    line-height: 1.6;
}
.ipd-fallback-note code { background: var(--ipd-surface2); color: var(--ipd-accent); padding: 0.1rem 0.35rem; border-radius: 3px; }
.ipd-fallback-note a { color: var(--ipd-accent); }

.ipd-search-row {
    display: flex;
    margin-bottom: 0.75rem;
}
.ipd-search-results {
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 0.75rem;
}
.ipd-search-results::-webkit-scrollbar { width: 4px; }
.ipd-search-results::-webkit-scrollbar-thumb { background: var(--ipd-border); border-radius: 2px; }
.ipd-added-list { margin-bottom: 1rem; max-height: 180px; overflow-y: auto; }

.ipd-fallback-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 0.75rem; }

.ipd-paste-area {
    width: 100%;
    background: #0d0d0d;
    border: 1px solid var(--ipd-border);
    border-radius: var(--ipd-radius);
    color: var(--ipd-text);
    font-family: 'Courier Prime', monospace;
    font-size: 0.85rem;
    padding: 0.75rem;
    height: 180px;
    resize: vertical;
    outline: none;
    line-height: 1.6;
    box-sizing: border-box;
}
.ipd-paste-area:focus { border-color: var(--ipd-accent); }

/* ─── Session Restore Banner ──────────────────────────────────────────────── */
.ipd-session-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: rgba(201,168,76,0.08);
    border: 1px solid rgba(201,168,76,0.25);
    border-radius: var(--ipd-radius);
    padding: 0.75rem 1.1rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    color: var(--ipd-text);
}
.ipd-session-banner strong { color: var(--ipd-accent); }

/* ─── Gutenberg Block preview ─────────────────────────────────────────────── */
.wp-block-imdb-portfolio-display {
    border-radius: 8px;
    overflow: hidden;
}

/* ─── Published Showcase Bar ──────────────────────────────────────────────── */
#ipd-published-showcase { position: relative; }
.ipd-published-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(201,168,76,0.06);
    border: 1px solid rgba(201,168,76,0.2);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    font-family: Raleway, sans-serif;
    font-size: 0.85rem;
    color: var(--ipd-text-muted, #888);
}
.ipd-published-bar span { color: #c9a84c; font-weight: 700; }
#ipd-pub-output { border-radius: 0 0 8px 8px; overflow: hidden; }

/* ─── Save Modal transition ───────────────────────────────────────────────── */
#ipd-save-modal { animation: ipd-modal-in 0.15s ease; }
@keyframes ipd-modal-in { from { opacity:0; } to { opacity:1; } }
#ipd-save-modal > div { animation: ipd-modal-slide 0.15s ease; }
@keyframes ipd-modal-slide { from { transform:scale(0.96) translateY(8px); opacity:0; } to { transform:none; opacity:1; } }

/* ─── Research Panel (Step 1 redesign) ────────────────────────────────────── */
.ipd-research-panel { max-width: 720px; margin: 0 auto; }
.ipd-research-field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.ipd-research-fields-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media(max-width:600px){ .ipd-research-fields-row { grid-template-columns: 1fr; } }

.ipd-research-label {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.82rem; font-weight: 700; color: var(--ipd-text);
    text-transform: uppercase; letter-spacing: 0.08em;
}
.ipd-research-label-icon { font-size: 1rem; }
.ipd-research-required { color: var(--ipd-accent); font-size: 0.7rem; font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 0.3rem; }
.ipd-research-optional { color: var(--ipd-text-muted); font-size: 0.7rem; font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 0.3rem; }

.ipd-research-input {
    background: var(--ipd-surface);
    border: 1px solid var(--ipd-border);
    border-radius: var(--ipd-radius);
    color: var(--ipd-text);
    font-family: var(--ipd-font-ui);
    font-size: 0.95rem;
    padding: 0.7rem 1rem;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}
.ipd-research-input:focus { border-color: var(--ipd-accent); }
.ipd-research-hint { color: var(--ipd-text-muted); font-size: 0.72rem; margin-top: 0.1rem; }

.ipd-btn--lg { padding: 0.85rem 2rem; font-size: 1rem; }

/* Source Badges */
.ipd-source-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.ipd-src-badge {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: var(--ipd-surface);
    border: 1px solid var(--ipd-border);
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ipd-text-muted);
    letter-spacing: 0.05em;
    transition: all 0.2s;
    cursor: default;
}
.ipd-src-badge.ipd-src--active {
    border-color: rgba(201,168,76,0.4);
    color: var(--ipd-accent);
    background: rgba(201,168,76,0.08);
}
.ipd-src-badge.ipd-src--done {
    border-color: rgba(74,222,128,0.4);
    color: #4ade80;
    background: rgba(74,222,128,0.06);
}
.ipd-src-badge.ipd-src--empty {
    border-color: rgba(248,113,113,0.3);
    color: #f87171;
}
.ipd-src-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--ipd-border);
    display: inline-block;
    transition: background 0.2s;
}
.ipd-src-dot--active { background: var(--ipd-accent); animation: ipd-pulse 1.5s infinite; }
@keyframes ipd-pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
.ipd-src-dot--done    { background: #4ade80; animation: none; }
.ipd-src-dot--empty   { background: #f87171; animation: none; }

/* Source badges on movie cards in Step 2 */
.ipd-movie-sources {
    display: flex; gap: 0.2rem; flex-wrap: wrap;
    padding: 0.2rem 0.5rem 0.4rem;
}
.ipd-movie-src-chip {
    font-size: 0.58rem;
    padding: 0.1rem 0.35rem;
    border-radius: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ipd-src-chip-tmdb      { background:rgba(1,180,228,0.15); color:#01b4e4; }
.ipd-src-chip-wikidata  { background:rgba(153,102,0,0.15); color:#cc8800; }
.ipd-src-chip-wikipedia { background:rgba(100,100,255,0.15); color:#8888ff; }
.ipd-src-chip-google    { background:rgba(234,67,53,0.15); color:#ea4335; }

/* Source stats bar shown after fetch */
.ipd-source-stats-bar {
    display: flex; gap: 0.75rem; flex-wrap: wrap;
    padding: 0.6rem 0.9rem;
    background: var(--ipd-surface);
    border: 1px solid var(--ipd-border);
    border-radius: var(--ipd-radius);
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: var(--ipd-text-muted);
}
.ipd-source-stats-bar strong { color: var(--ipd-accent); }
.ipd-src-chip-imdb { background:rgba(245,197,24,0.15); color:#f5c518; }

/* ─── Source Filter Bar (Step 2) ──────────────────────────────────────────── */
.ipd-source-filter-bar {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    min-height: 28px;
}
.ipd-filter-btn {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: var(--ipd-surface);
    border: 1px solid var(--ipd-border);
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ipd-text-muted);
    cursor: pointer;
    font-family: var(--ipd-font-ui);
    transition: all 0.15s;
    letter-spacing: 0.03em;
}
.ipd-filter-btn:hover { border-color: var(--ipd-accent); color: var(--ipd-accent); }
.ipd-filter-btn--active {
    background: rgba(201,168,76,0.12);
    border-color: rgba(201,168,76,0.5);
    color: var(--ipd-accent);
}
.ipd-filter-count {
    background: var(--ipd-surface2);
    border-radius: 20px;
    padding: 0 0.4rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--ipd-text-muted);
    min-width: 18px;
    text-align: center;
}
.ipd-filter-btn--active .ipd-filter-count {
    background: rgba(201,168,76,0.2);
    color: var(--ipd-accent);
}

/* ─── Poster progress bar ─────────────────────────────────────────────────── */
#ipd-poster-progress { animation: ipd-fadein 0.3s ease; }
@keyframes ipd-fadein { from{opacity:0} to{opacity:1} }

/* ─── Upload-poster button on movie cards ─────────────────────────────────── */
.ipd-upload-poster-btn {
    position: absolute;
    bottom: 4px; right: 4px;
    width: 22px; height: 22px;
    background: rgba(201,168,76,0.85);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.15s;
}
.ipd-upload-poster-btn:hover { background: var(--ipd-accent); }

/* ─── Manual film modal poster upload prompt ──────────────────────────────── */
#ipd-mf-upload-prompt:hover { border-color: var(--ipd-accent); color: var(--ipd-accent); }

/* ─── Live Preview Strip (Step 3) ────────────────────────────────────────── */
.ipd-live-preview-wrap {
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-radius: var(--ipd-radius);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.ipd-live-preview-label {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 0.9rem;
    background: #111;
    border-bottom: 1px solid #222;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ipd-text-muted);
}
.ipd-live-preview-scroll {
    height: 300px;
    overflow: hidden;
    position: relative;
}
.ipd-live-preview-inner {
    width: 100%;
    min-height: 200px;
    overflow: hidden;
    position: relative;
}
.ipd-live-preview-inner > div {
    pointer-events: none;
    user-select: none;
}

/* ─── Upload poster btn on card placeholders ──────────────────────────────── */
.ipd-movie-poster-placeholder { position: relative; }
.ipd-upload-poster-btn {
    position: absolute;
    bottom: 5px; right: 5px;
    width: 22px; height: 22px;
    background: rgba(201,168,76,0.9);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.15s;
    border: none;
    outline: none;
}
.ipd-upload-poster-btn:hover { background: var(--ipd-accent); }

/* ─── Step 4 showcase output container ───────────────────────────────────── */
#ipd-showcase-output {
    border-radius: 8px;
    overflow: hidden;
    /* Remove old CSS-variable-based properties — engine handles these inline */
}
#ipd-showcase-output > div {
    /* Engine sets isolation:isolate and background inline */
}

/* ─── Letterboxd source chip ──────────────────────────────────────────────── */
.ipd-src-chip-letterboxd { background:rgba(0,192,48,0.12); color:#00c030; }

/* ─── Screen-reader only utility (for hidden labels) ─────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
