/* ===== MiniFinity Upload (creator) — noir, token-only ===== */

/* Floating upload button (creator-only; JS reveals it) */
.mf-upload-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 40;
    display: none; /* JS -> flex for creators */
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-md, 0);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 6px 20px var(--accent-glow);
    transition: transform 0.18s, box-shadow 0.18s;
}
.mf-upload-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 28px var(--accent-glow); }
.mf-upload-fab svg { width: 18px; height: 18px; color: var(--accent-primary); }

/* Modal */
.mf-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.mf-modal-overlay.active { display: flex; }

.mf-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 0);
    width: 460px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    animation: mfFade 0.25s ease;
}
@keyframes mfFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.mf-modal h3 { font-size: 18px; font-weight: 700; color: var(--text-primary); margin: 0 0 16px; }
.mf-modal label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 14px 0 6px;
}
.mf-modal input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 0);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    outline: none;
}
.mf-modal input[type="text"]:focus { border-color: var(--accent-primary); }

/* Segmented post_type control */
.mf-seg {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 0);
    padding: 4px;
}
.mf-seg-btn {
    padding: 9px 8px;
    border: none;
    border-radius: var(--radius-sm, 0);
    background: transparent;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.22s var(--ease-out, ease), color 0.22s var(--ease-out, ease), transform 0.12s var(--ease-out, ease);
}
.mf-seg-btn:active { transform: scale(0.96); }
.mf-seg-btn:hover { color: var(--text-secondary); }
.mf-seg-btn.active { background: var(--accent-primary); color: var(--btn-primary-text, #fff); }

/* Picker grid (ChromaGrid noir port) */
.mf-picker-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 8px;
    margin-top: 10px;
    max-height: 210px;
    overflow-y: auto;
    padding: 2px;
}
.mf-picker-results:empty { display: none; }

.mf-pcard {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 0);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-secondary);
    transition: border-color 0.18s var(--ease-out, ease), transform 0.18s var(--ease-out, ease), box-shadow 0.18s var(--ease-out, ease);
}
.mf-pcard:hover { transform: translateY(-2px); border-color: var(--accent-primary); box-shadow: 0 4px 14px var(--accent-glow); }
.mf-pcard-img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
    filter: grayscale(1) brightness(0.82);
    transition: filter 0.25s ease;
}
.mf-pcard:hover .mf-pcard-img,
.mf-pcard.selected .mf-pcard-img { filter: grayscale(0) brightness(1); }
.mf-pcard-meta { padding: 5px 6px; }
.mf-pcard-title {
    font-size: 10.5px; font-weight: 600; color: var(--text-primary); line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mf-pcard-year { font-size: 9.5px; color: var(--text-muted); margin-top: 2px; }
.mf-pcard.selected { border-color: var(--accent-primary); box-shadow: 0 0 0 2px var(--accent-primary) inset, 0 4px 14px var(--accent-glow); }
.mf-pcard-check {
    position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--accent-primary); color: var(--btn-primary-text, #fff); display: none;
    align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.mf-pcard.selected .mf-pcard-check { display: flex; }

.mf-pcard-skel {
    aspect-ratio: 2 / 3; border-radius: var(--radius-sm, 0);
    background: linear-gradient(100deg, var(--bg-secondary) 30%, var(--bg-card) 50%, var(--bg-secondary) 70%);
    background-size: 200% 100%; animation: mfShimmer 1.1s linear infinite;
}
@keyframes mfShimmer { to { background-position: -200% 0; } }

.mf-picker-state { grid-column: 1 / -1; text-align: center; font-size: 12px; color: var(--text-muted); padding: 14px 8px; }

/* Picked chip */
.mf-chip {
    display: none; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 10px;
    background: var(--bg-secondary); border: 1px solid var(--accent-primary); border-radius: var(--radius-sm, 0);
}
.mf-chip.show { display: flex; }
.mf-chip img { width: 30px; height: 42px; object-fit: cover; border-radius: 0; flex-shrink: 0; }
.mf-chip-info { flex: 1; min-width: 0; }
.mf-chip-title { font-size: 12.5px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mf-chip-clear { background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 4px; line-height: 1; }
.mf-chip-clear:hover { color: var(--text-primary); }

/* Forum rows */
.mf-forum-results { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 180px; overflow-y: auto; }
.mf-forum-results:empty { display: none; }
.mf-frow {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
    padding: 9px 12px; background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 0); cursor: pointer; text-align: left; transition: border-color 0.15s var(--ease-out, ease);
}
.mf-frow:hover { border-color: var(--accent-primary); }
.mf-frow-title { font-size: 12.5px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mf-frow-cat { font-size: 10px; color: var(--text-muted); flex-shrink: 0; }

/* Dropzone + preview */
.mf-dropzone {
    margin-top: 8px; padding: 26px 16px; border: 1.5px dashed var(--border-color); border-radius: var(--radius-md, 0);
    text-align: center; color: var(--text-muted); cursor: pointer;
    transition: border-color 0.18s var(--ease-out, ease), background 0.18s var(--ease-out, ease), transform 0.18s var(--ease-out, ease);
}
.mf-dropzone:hover { border-color: var(--accent-primary); background: var(--bg-secondary); }
.mf-dropzone.drag { border-color: var(--accent-primary); border-style: solid; background: var(--accent-glow); transform: scale(1.01); }
.mf-dropzone svg { width: 26px; height: 26px; color: var(--accent-primary); margin-bottom: 6px; }
.mf-dropzone .mf-dz-main { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.mf-dropzone .mf-dz-sub { font-size: 11px; margin-top: 3px; }

.mf-preview-wrap { display: none; margin-top: 10px; gap: 12px; align-items: center; }
.mf-preview-thumb { width: 56px; height: 78px; border-radius: 0; object-fit: cover; background: var(--bg-secondary); border: 1px solid var(--border-color); flex-shrink: 0; }
.mf-preview-name { font-size: 12px; color: var(--text-secondary); word-break: break-word; }

/* Progress + status */
.mf-progress { display: none; height: 6px; border-radius: 0; background: var(--bg-secondary); margin-top: 14px; overflow: hidden; }
.mf-progress-bar { height: 100%; width: 0; background: var(--accent-primary); transition: width 0.25s ease; }

.mf-status { display: none; font-size: 12px; margin-top: 12px; padding: 8px 12px; border-radius: 0; border-left: 3px solid var(--border-color); }
.mf-status-ok { color: #79d39a; background: rgba(80, 200, 120, 0.1); border-left-color: #79d39a; }
.mf-status-warn { color: var(--text-secondary); background: var(--bg-secondary); border-left-color: var(--acc, #d9a441); }
.mf-status-error { color: #f08a8a; background: rgba(240, 90, 90, 0.1); border-left-color: #f08a8a; }

/* Actions */
.mf-modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.mf-modal-actions button { flex: 1; padding: 12px; border-radius: var(--radius-sm, 0); font-weight: 700; font-size: 14px; cursor: pointer; transition: background 0.2s var(--ease-out, ease), color 0.2s var(--ease-out, ease), border-color 0.2s var(--ease-out, ease), transform 0.12s var(--ease-out, ease); border: 1px solid var(--border-color); }
.mf-modal-actions button:active:not(:disabled) { transform: scale(0.97); }
.mf-btn-cancel { background: transparent; color: var(--text-secondary); }
.mf-btn-cancel:hover { border-color: var(--text-secondary); }
.mf-btn-submit { background: var(--accent-primary); color: var(--btn-primary-text, #fff); border-color: transparent; }
.mf-btn-submit:disabled { opacity: 0.45; cursor: not-allowed; }

/* Visually-hidden media used only for frame extraction */
.mf-offscreen { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; left: -9999px; }

/* Reduced-motion: kill modal entrance, shimmer, and every hover/press transform */
@media (prefers-reduced-motion: reduce) {
    .mf-modal { animation: none; }
    .mf-pcard-skel { animation: none; }
    .mf-upload-fab,
    .mf-pcard,
    .mf-dropzone,
    .mf-seg-btn,
    .mf-progress-bar,
    .mf-modal-actions button { transition: none; }
    .mf-upload-fab:hover,
    .mf-pcard:hover,
    .mf-dropzone.drag,
    .mf-seg-btn:active,
    .mf-modal-actions button:active:not(:disabled) { transform: none; }
}
