/* ─── Google Fonts ──────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Cormorant+Garamond:wght@400;600&family=IBM+Plex+Mono:wght@400;500&family=Inter:wght@300;400;500;600;700&family=Manrope:wght@400;500;700&family=Space+Grotesk:wght@400;500;700&display=swap');

/* ─── Custom Properties ────────────────────────────────────────────── */
:root {
    --primary: #f0f0f0;
    --bg: #0a0a0a;
    --bg-surface: #141414;
    --bg-elevated: #1e1e1e;
    --text: #f0f0f0;
    --text-muted: #888;
    --accent: #ffffff;
    --border: #333;
    --radius: 8px;
    --font-scale: 1;
    --font-family: Inter, system-ui, -apple-system, sans-serif;
    --transition: 300ms ease;
}

/* ─── Reset & Base ─────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: calc(16px * var(--font-scale));
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-family);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

img {
    display: block;
    max-width: 100%;
}

button {
    font-family: inherit;
}

/* ─── Scrollbar ────────────────────────────────────────────────────── */
html {
    scrollbar-width: thin;
    scrollbar-color: #333 var(--bg);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ─── Portfolio Wrapper ────────────────────────────────────────────── */
.ap-header,
.ap-grid-section,
.ap-footer {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 2rem;
    padding-right: 2rem;
}

.ap-header {
    min-height: 1px;
}

/* ─── Header ───────────────────────────────────────────────────────── */
.ap-header {
    padding-top: 3rem;
    padding-bottom: 1rem;
}

.ap-site-name {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.ap-tagline {
    color: var(--text-muted);
    font-weight: 300;
    margin-bottom: 0;
}

/* ─── Filter Navigation ────────────────────────────────────────────── */
.ap-filters {
    display: flex;
    gap: 0.5rem;
    margin: 2rem 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
}

.ap-filters::-webkit-scrollbar {
    display: none;
}

.ap-filters {
    scrollbar-width: none;
}

.ap-filter-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1.25rem;
    border-radius: 2rem;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-size: 0.875rem;
    line-height: 1;
    flex-shrink: 0;
}

.ap-filter-btn:hover {
    border-color: var(--text-muted);
}

.ap-filter-btn.is-active {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.ap-surprise-btn {
    border-color: var(--accent);
    color: var(--accent);
}

.ap-surprise-btn:hover {
    border-color: var(--text);
    color: var(--text);
}

.ap-surprise-btn.is-disabled,
.ap-surprise-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: #333;
    color: var(--text-muted);
}

.ap-admin-tab-btn {
    border-color: var(--accent);
    color: var(--accent);
}

.ap-admin-tab-btn:hover {
    color: var(--text);
    border-color: var(--text);
}

/* ─── Portfolio Grid ───────────────────────────────────────────────── */
.ap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* ─── Portfolio Cards ──────────────────────────────────────────────── */
.ap-card {
    background: var(--bg-surface);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: transform var(--transition), box-shadow var(--transition);
}

.ap-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* ─── BUG FIX 7: Collection Cards ──────────────────────────────────── */
.ap-collection-card {
    background: var(--bg-surface);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: transform var(--transition), box-shadow var(--transition);
    border-left: 3px solid var(--text-muted);
}

.ap-collection-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    border-left-color: var(--accent);
}

/* BUG FIX 1: Collection badge positioning */
.ap-card-figure .ap-collection-badge {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.3rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    color: var(--text);
    z-index: 1;
}

/* When no image, badge appears inline in caption */
.ap-card-caption .ap-collection-badge {
    position: static;
    display: inline-block;
}

/* Collection detail view */
.ap-collection-detail {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 2rem;
    padding-right: 2rem;
    display: none;
}

.ap-about-section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

.ap-about-header {
    display: grid;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.ap-about-image-wrap {
    width: min(100%, 520px);
    margin: 0 auto;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border);
}

.ap-about-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.ap-about-image--placeholder {
    min-height: 220px;
    aspect-ratio: 4 / 5;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
}

.ap-about-title {
    font-size: clamp(1.4rem, 5vw, 2rem);
    letter-spacing: 0.04em;
}

.ap-about-admin-controls {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.5rem;
    align-items: end;
    margin-bottom: 0.9rem;
}

.ap-about-plus-btn,
.ap-about-save-btn,
.ap-about-plus-actions button,
.ap-about-editor-cancel,
.ap-about-editor-save {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    cursor: pointer;
    font-size: 0.82rem;
}

.ap-about-plus-btn {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    font-size: 1.2rem;
    line-height: 1;
}

.ap-about-plus-actions {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}

.ap-about-title-label {
    display: grid;
    gap: 0.3rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.ap-about-title-input {
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text);
    border-radius: 10px;
    padding: 0.5rem 0.7rem;
}

.ap-about-grid {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.ap-about-box {
    position: relative;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    border-radius: var(--radius);
    padding: 0.85rem;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.ap-about-box-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
}

.ap-about-box-body p,
.ap-about-box-body ul,
.ap-about-box-body blockquote {
    margin-bottom: 0.55rem;
}

.ap-about-box-body p:last-child,
.ap-about-box-body ul:last-child,
.ap-about-box-body blockquote:last-child {
    margin-bottom: 0;
}

.ap-about-box-actions {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    display: inline-flex;
    gap: 0.2rem;
    opacity: 0.3;
    transition: opacity 180ms ease;
}

.ap-about-box:hover .ap-about-box-actions {
    opacity: 1;
}

.ap-about-box-actions button {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 6px;
    cursor: pointer;
}

.ap-about-editor {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 2300;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.ap-about-editor[hidden] {
    display: none !important;
}

.ap-about-editor-inner {
    width: min(760px, 100%);
    max-height: 90vh;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    padding: 1rem;
}

.ap-about-editor-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.ap-about-editor-close {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    cursor: pointer;
}

.ap-about-editor-field {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.65rem;
}

.ap-about-editor-field span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ap-about-editor-field input,
.ap-about-editor-field textarea {
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    border-radius: 10px;
    padding: 0.6rem 0.7rem;
}

.ap-about-editor-tabs {
    display: inline-flex;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.ap-about-editor-tab {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    cursor: pointer;
}

.ap-about-editor-tab.is-active {
    color: var(--bg);
    background: var(--text);
    border-color: var(--text);
}

.ap-about-editor-preview {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    padding: 0.75rem;
    min-height: 100px;
}

.ap-about-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.7rem;
}

.ap-back-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1.25rem;
    border-radius: 2rem;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.875rem;
    font-family: inherit;
    margin-bottom: 2rem;
}

.ap-back-btn:hover {
    border-color: var(--text);
    color: var(--text);
}

.ap-collection-header {
    margin-bottom: 3rem;
}

.ap-collection-banner {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.ap-collection-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.ap-collection-meta {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.ap-collection-description {
    line-height: 1.7;
    color: var(--text-muted);
    max-width: 800px;
}

.ap-collection-media {
    margin-bottom: 1.5rem;
}

.ap-visualizer-wrapper {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                margin-bottom 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.35s ease;
    margin-bottom: 1rem;
    opacity: 1;
    overflow: hidden;
}

.ap-visualizer-container {
    position: relative;
    width: 100%;
    aspect-ratio: 21 / 9;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 0;
}

.ap-collection-media.viz-collapsed .ap-visualizer-wrapper {
    grid-template-rows: 0fr;
    margin-bottom: 0;
    opacity: 0;
    pointer-events: none;
}

.ap-visualizer-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.ap-visualizer-controls {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    display: flex;
    gap: 0.45rem;
}

.ap-visualizer-mode-btn {
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: none;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.ap-visualizer-mode-btn:hover {
    background: var(--accent);
    color: var(--bg);
}

.ap-visualizer-mode-btn.is-active {
    background: var(--accent);
    color: var(--bg);
}

.ap-album-player {
    position: relative;
    display: grid;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius);
    background: var(--bg-surface);
    margin-bottom: 1rem;
    overflow: hidden;
    z-index: 1;
}

.ap-album-player::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--player-bg-image, none);
    background-size: 100% auto;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.5;
    z-index: -1;
    pointer-events: none;
    transition: background-image 0.3s ease;
}

.ap-player-track {
    color: var(--text);
    font-size: 0.95rem;
}

.ap-player-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ap-player-prev,
.ap-player-toggle,
.ap-player-next,
.ap-player-shuffle,
.ap-player-repeat-one {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #3b82f6;
    background: #3b82f6;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    transition: all var(--transition);
}

.ap-player-prev:hover,
.ap-player-toggle:hover,
.ap-player-next:hover,
.ap-player-shuffle:hover:not(.is-active),
.ap-player-repeat-one:hover:not(.is-active) {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.ap-player-shuffle,
.ap-player-repeat-one {
    width: 42px;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
}

.ap-player-controls button.is-active {
    background: #fff;
    color: #3b82f6;
    border-color: #fff;
}

.ap-player-progress-wrap {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.5rem;
    align-items: center;
}

.ap-player-progress {
    width: 100%;
    accent-color: var(--accent);
}

.ap-player-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    min-width: 2.4rem;
    text-align: center;
}

.ap-album-audio {
    width: 100%;
}

.ap-persistent-audio {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

body.ap-mini-player-visible {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}

.ap-mini-player {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    padding: 0.45rem 0.6rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(10, 10, 10, 0) 0%, rgba(10, 10, 10, 0.9) 20%, rgba(10, 10, 10, 0.96) 100%);
}

.ap-mini-player-inner {
    max-width: 1400px;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    background: rgba(20, 20, 20, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.35);
    padding: 0.55rem 0.75rem 0.5rem;
}

.ap-mini-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.55rem;
    align-items: center;
}

.ap-mini-expand {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #3b82f6;
    background: #3b82f6;
    color: #fff;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all var(--transition);
}

.ap-mini-expand:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.ap-mini-track {
    min-width: 0;
}

.ap-mini-title {
    font-size: 0.88rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.ap-mini-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ap-mini-controls {
    display: flex;
    align-items: center;
    gap: 0.32rem;
}

.ap-mini-prev,
.ap-mini-play,
.ap-mini-next,
.ap-mini-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #3b82f6;
    background: #3b82f6;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    transition: all var(--transition);
}

.ap-mini-prev:hover,
.ap-mini-play:hover,
.ap-mini-next:hover,
.ap-mini-close:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.ap-mini-close {
    font-size: 1rem;
}

.ap-mini-progress-wrap {
    margin-top: 0.4rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.45rem;
    align-items: center;
}

.ap-mini-progress {
    width: 100%;
    accent-color: var(--accent);
}

.ap-mini-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    min-width: 2.3rem;
    text-align: center;
}

.ap-mini-status {
    margin-top: 0.2rem;
    min-height: 1.05em;
    font-size: 0.7rem;
    color: #ffb1b1;
}

.ap-collection-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.ap-collection-view-toggle {
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.25rem;
    border: 1px solid #2f2f2f;
    border-radius: 999px;
    margin-bottom: 1rem;
}

.ap-view-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    font-size: 0.78rem;
    cursor: pointer;
}

.ap-view-btn.is-active {
    background: var(--bg-elevated);
    color: var(--text);
}

.ap-item-info-btn {
    position: absolute;
    top: 0.55rem;
    left: 0.55rem;
    width: 26px;
    height: 26px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 3;
    line-height: 1;
}

.ap-collection-items-grid.is-list-view {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ap-list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    column-gap: 0.65rem;
    row-gap: 0.35rem;
    padding: 0.6rem 0.75rem;
}

.ap-list-row .ap-list-title-row {
    display: block;
    width: 100%;
    grid-column: 1 / -1;
    min-width: 0;
}

.ap-list-row .ap-list-title-row .ap-card-title {
    display: block;
    line-height: 1.25;
}

.ap-list-row .ap-list-meta-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 1rem;
    min-width: 0;
    grid-column: 1 / 2;
}

.ap-list-row .ap-list-sub {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 0;
}

.ap-list-row .ap-list-actions {
    display: flex;
    align-items: center;
    grid-column: 2 / 3;
}

.ap-list-row .ap-item-info-btn {
    position: static;
}

.ap-list-row .ap-card-caption {
    padding: 0;
}

.ap-list-row .ap-card-admin {
    position: static;
    margin-left: 0;
    padding: 0;
    grid-column: 3 / 4;
}

.ap-card-figure {
    margin: 0;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    position: relative;
}

.ap-card-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 500ms ease;
}

.ap-card:hover .ap-card-img {
    transform: scale(1.05);
}

/* Hover overlay */
.ap-card-figure::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 40%, rgba(0, 0, 0, 0.85));
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}

.ap-card:hover .ap-card-figure::after {
    opacity: 1;
}

.ap-card-caption {
    padding: 1rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    color: var(--text);
}

.ap-card-title {
    font-size: 1rem;
    font-weight: 500;
}

.ap-card-year,
.ap-card-genre {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ap-card-badge {
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    background: var(--bg-elevated);
    color: var(--text-muted);
    margin-top: 0;
}

/* Placeholder (no image) */
.ap-card-placeholder {
    aspect-ratio: 4 / 3;
    min-height: 200px;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    position: relative;
}

.ap-card-placeholder::after {
    content: '\1F3A8';
    font-size: 2rem;
    opacity: 0.3;
}

/* Star Rating System */
.ap-star-rating {
    display: inline-flex;
    gap: 2px;
    align-items: center;
}

.ap-star {
    font-size: 1.1rem;
    color: var(--text-muted);
    opacity: 0.3;
    transition: color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.ap-star.is-active,
.ap-star-rating.is-admin .ap-star.hover-filled {
    color: #ffb300;
    opacity: 1;
    text-shadow: 0 0 4px rgba(255, 179, 0, 0.6);
}

/* Admin pointer and hover */
.ap-star-rating.is-admin .ap-star {
    cursor: pointer;
}

.ap-star-rating.is-admin .ap-star:hover {
    transform: scale(1.25);
}

/* Gallery image overlay rating */
.ap-card-figure .ap-star-rating,
.ap-card-placeholder .ap-star-rating {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(15, 23, 42, 0.75);
    padding: 3px 8px;
    border-radius: 12px;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Faded empty rating for admin overlay (only visible on hover) */
.ap-card-figure .ap-star-rating[data-rating="0"],
.ap-card-placeholder .ap-star-rating[data-rating="0"] {
    opacity: 0;
    transform: translateY(4px);
    pointer-events: none;
}

.ap-card:hover .ap-card-figure .ap-star-rating[data-rating="0"],
.ap-card:hover .ap-card-placeholder .ap-star-rating[data-rating="0"] {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* List mode row rating */
.ap-list-meta-row .ap-star-rating {
    margin-left: 0.75rem;
}

.ap-list-meta-row .ap-star-rating .ap-star {
    font-size: 0.95rem;
}

/* Faded empty rating for admin list row (only visible on hover) */
.ap-list-meta-row .ap-star-rating[data-rating="0"] {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.ap-card.ap-list-row:hover .ap-list-meta-row .ap-star-rating[data-rating="0"] {
    opacity: 1;
    pointer-events: auto;
}

/* Info modal rating at the bottom */
.ap-modal-details .ap-star-rating {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    width: 100%;
    justify-content: flex-start;
}

.ap-modal-details .ap-star-rating .ap-star {
    font-size: 1.4rem;
}

/* Animation on save */
@keyframes ratingBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.ap-star-rating.rating-saved {
    animation: ratingBounce 0.3s ease-out;
}

/* Card visibility states */
.ap-card.card-hidden,
.ap-collection-card.card-hidden {
    display: none;
}

/* Entrance animation — cards visible by default; .is-visible enhances entrance */
.ap-card {
    opacity: 1;
    transform: translateY(0);
}

.ap-card.is-visible {
    animation: ap-card-enter 500ms ease both;
}

@keyframes ap-card-enter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger children */
.ap-card.is-visible:nth-child(2) { animation-delay: 50ms; }
.ap-card.is-visible:nth-child(3) { animation-delay: 100ms; }
.ap-card.is-visible:nth-child(4) { animation-delay: 150ms; }
.ap-card.is-visible:nth-child(5) { animation-delay: 200ms; }
.ap-card.is-visible:nth-child(6) { animation-delay: 250ms; }

/* ─── Admin Controls on Cards ──────────────────────────────────────── */
.ap-card-admin {
    position: absolute;
    top: 0;
    right: 0;
    display: none;
    flex-direction: row;
    gap: 0.5rem;
    padding: 0.5rem;
    z-index: 2;
}

body.is-admin .ap-card-admin {
    display: flex;
}

.ap-card-edit,
.ap-card-visibility,
.ap-card-delete,
.ap-collection-edit,
.ap-collection-visibility,
.ap-collection-delete {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: none;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all var(--transition);
    line-height: 1;
}

.ap-card-edit:hover,
.ap-card-visibility:hover,
.ap-collection-edit:hover,
.ap-collection-visibility:hover {
    background: var(--accent);
    color: var(--bg);
}

/* BUG FIX 3: Delete button hover state */
.ap-card-delete:hover,
.ap-collection-delete:hover {
    background: #c92a2a;
    color: #fff;
}

/* Invisible card state for admin */
.ap-card.card-invisible,
.ap-collection-card.card-invisible {
    opacity: 0.4;
    border: 1px dashed #333;
}

/* ─── Modal ────────────────────────────────────────────────────────── */
.ap-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

body.modal-open .ap-modal {
    opacity: 1;
    pointer-events: auto;
}

.ap-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.ap-modal-content {
    position: relative;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-surface);
    border-radius: var(--radius);
    z-index: 1;
    transform: scale(0.95);
    transition: transform var(--transition);
    scrollbar-width: thin;
    scrollbar-color: #333 var(--bg-surface);
}

.ap-modal-content::-webkit-scrollbar {
    width: 4px;
}

.ap-modal-content::-webkit-scrollbar-track {
    background: var(--bg-surface);
}

.ap-modal-content::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

body.modal-open .ap-modal-content {
    transform: scale(1);
}

/* Modal accent bar (rendered in JS as .ap-modal-accent) */
.ap-modal-accent {
    height: 3px;
    width: 100%;
    background: var(--modal-accent, var(--accent));
}

/* Modal image */
.ap-modal-image img {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    background: #000;
    display: block;
}

/* Modal iframe embed */
.ap-modal-body iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    display: block;
}

/* Modal audio */
.ap-modal-audio {
    width: 100%;
    padding: 1rem 2rem;
    background: var(--bg-elevated);
}

.ap-modal-audio audio {
    width: 100%;
    height: 48px;
    border-radius: 4px;
}

/* Modal details */
.ap-modal-details {
    padding: 2rem;
}

.ap-modal-title {
    font-size: 1.5rem;
    font-weight: 500;
}

.ap-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.75rem;
}

.ap-modal-meta span {
    display: inline-flex;
    align-items: center;
}

.ap-modal-meta .middot {
    margin: 0 0.25rem;
}

.ap-modal-description {
    margin-top: 1rem;
    line-height: 1.7;
}

.ap-modal-link {
    display: inline-flex;
    padding: 0.6rem 1.5rem;
    border: 1px solid var(--text-muted);
    border-radius: 2rem;
    color: var(--text);
    text-decoration: none;
    margin-top: 1.5rem;
    transition: all var(--transition);
}

.ap-modal-link:hover {
    background: var(--text);
    color: var(--bg);
}

/* Close button */
.ap-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: none;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    line-height: 1;
}

.ap-modal-close:hover {
    background: var(--accent);
    color: var(--bg);
}

/* Prev / Next */
.ap-modal-prev,
.ap-modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: none;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    line-height: 1;
}

.ap-modal-prev { left: -60px; }
.ap-modal-next { right: -60px; }

.ap-modal-prev:hover,
.ap-modal-next:hover {
    background: var(--accent);
    color: var(--bg);
}

/* ─── Floating Action Button ───────────────────────────────────────── */
.ap-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 900;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--text);
    color: var(--bg);
    font-size: 1.5rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: transform var(--transition);
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

body.is-admin .ap-fab {
    display: flex;
}

.ap-fab:hover {
    transform: scale(1.1);
}

/* ─── Bottom Sheet ─────────────────────────────────────────────────── */
.ap-bottomsheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 950;
    background: var(--bg-elevated);
    border-radius: 1rem 1rem 0 0;
    transform: translateY(100%);
    transition: transform 400ms ease;
    max-height: 85vh;
    overflow-y: auto;
    display: none;
}

body.is-admin .ap-bottomsheet {
    display: block;
}

.ap-bottomsheet.sheet-open {
    transform: translateY(0);
}

.ap-bottomsheet-inner {
    padding: 2rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
}

/* Drag handle */
.ap-bottomsheet-inner::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: #444;
    border-radius: 2px;
    margin: 0 auto 1.5rem;
}

/* ─── BUG FIX 1: Form Toggle ───────────────────────────────────────── */
.ap-form-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border: 1px solid #333;
    border-radius: var(--radius);
    overflow: hidden;
}

.ap-toggle-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
}

.ap-toggle-btn:not(:last-child) {
    border-right: 1px solid #333;
}

.ap-toggle-btn.is-active {
    background: var(--text);
    color: var(--bg);
}

.ap-toggle-btn:hover:not(.is-active) {
    background: rgba(255, 255, 255, 0.05);
}

/* ─── Form Fields ──────────────────────────────────────────────────── */
.ap-form-field {
    margin-bottom: 1rem;
}

.ap-form-field label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.ap-form-field input[type="text"],
.ap-form-field input[type="url"],
.ap-form-field input[type="number"],
.ap-form-field textarea,
.ap-form-field select {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid #333;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color var(--transition);
}

.ap-form-field input:focus,
.ap-form-field textarea:focus,
.ap-form-field select:focus {
    border-color: var(--accent);
    outline: none;
}

.ap-form-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* File input */
.ap-form-field input[type="file"] {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

.ap-form-field input[type="file"] + .ap-file-label,
.ap-form-field label[for="ap-new-file"] + input[type="file"] ~ .ap-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1.5rem;
    border: 2px dashed #333;
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    text-align: center;
    transition: border-color var(--transition);
    font-size: 0.875rem;
}

.ap-form-field input[type="file"]:focus + .ap-file-label,
.ap-form-field input[type="file"]:hover + .ap-file-label {
    border-color: var(--accent);
}

/* Color input */
.ap-form-field input[type="color"] {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    background: none;
    padding: 0;
}

.ap-form-field input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.ap-form-field input[type="color"]::-webkit-color-swatch {
    border: 2px solid #333;
    border-radius: var(--radius);
}

.ap-form-field input[type="color"]::-moz-color-swatch {
    border: 2px solid #333;
    border-radius: var(--radius);
}

/* Interactive Tools field */
/* Interactive Tools & Genre fields */
.ap-tools-field,
.ap-genre-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ap-tools-tags-container,
.ap-genre-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 2px;
}

.ap-tool-tag,
.ap-genre-tag {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85rem;
    color: var(--text);
    gap: 6px;
    transition: background var(--transition);
}

.ap-tool-tag:hover,
.ap-genre-tag:hover {
    background: rgba(255, 255, 255, 0.12);
}

.ap-tool-tag-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin: 0;
    transition: color var(--transition);
}

.ap-tool-tag-remove:hover {
    color: #ef4444;
}

.ap-tools-input-wrapper,
.ap-genre-input-wrapper {
    display: flex;
    gap: 8px;
    position: relative;
}

.ap-tools-input-wrapper input[type="text"],
.ap-genre-input-wrapper input[type="text"] {
    flex: 1;
    margin-bottom: 0;
}

.ap-tools-input-add-btn,
.ap-genre-input-add-btn {
    background: var(--bg-surface);
    border: 1px solid #333;
    border-radius: var(--radius);
    color: #3b82f6; /* Modern Blue */
    font-size: 1.25rem;
    font-weight: bold;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
}

.ap-tools-input-add-btn:hover,
.ap-genre-input-add-btn:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.ap-tools-suggestions-container,
.ap-genre-suggestions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: var(--radius);
    border: 1px solid #222;
}

.ap-tools-suggestion-item,
.ap-genre-suggestion-item {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid #333;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 0.8rem;
    color: var(--text);
    cursor: pointer;
    gap: 6px;
    transition: all var(--transition);
}

.ap-tools-suggestion-item:hover,
.ap-genre-suggestion-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #444;
}

.ap-tools-suggestion-item .ap-suggestion-plus,
.ap-genre-suggestion-item .ap-suggestion-plus {
    color: #3b82f6; /* Blue + */
    font-weight: bold;
    font-size: 0.95rem;
    transition: transform var(--transition);
}

.ap-tools-suggestion-item:hover .ap-suggestion-plus,
.ap-genre-suggestion-item:hover .ap-suggestion-plus {
    transform: scale(1.2);
}

/* Collection & Grid Controls (Filters & Sorting) */
.ap-collection-controls,
.ap-grid-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin: 1.5rem 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ap-collection-controls {
    justify-content: space-between;
}

.ap-grid-controls {
    justify-content: flex-end;
}

.ap-collection-filters,
.ap-collection-sorting,
.ap-grid-sorting {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ap-collection-filters select,
.ap-collection-sorting select,
.ap-grid-sorting select {
    background: var(--bg-surface);
    border: 1px solid #333;
    border-radius: 20px;
    padding: 0.5rem 2rem 0.5rem 1rem;
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.ap-collection-filters select:hover,
.ap-collection-sorting select:hover,
.ap-grid-sorting select:hover {
    border-color: #555;
    background-color: rgba(255, 255, 255, 0.02);
}

.ap-collection-filters select:focus,
.ap-collection-sorting select:focus,
.ap-grid-sorting select:focus {
    border-color: var(--accent);
    outline: none;
}

/* Ensure dropdown options are readable on all themes and browsers */
.ap-form-field select option,
.ap-collection-controls select option,
.ap-grid-controls select option,
.ap-admin-social-row select option {
    background-color: var(--bg-surface);
    color: var(--text);
}

.ap-sort-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ap-col-sort-dir-btn {
    background: var(--bg-surface);
    border: 1px solid #333;
    border-radius: 50%;
    color: var(--text);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
}

.ap-col-sort-dir-btn:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
    color: #3b82f6;
}

@media (max-width: 768px) {
    .ap-collection-controls,
    .ap-grid-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ap-collection-filters {
        justify-content: flex-start;
    }
    
    .ap-collection-sorting,
    .ap-grid-sorting {
        justify-content: space-between;
    }
}

/* Submit button */
.ap-submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--text);
    color: var(--bg);
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: opacity var(--transition);
    font-family: inherit;
    margin-top: 0.5rem;
}

.ap-submit-btn:hover {
    opacity: 0.9;
}

.ap-form-status {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.ap-form-error {
    display: none;
    border: 1px solid rgba(255, 82, 82, 0.45);
    background: rgba(255, 82, 82, 0.12);
    color: #ffdede;
    border-radius: 0.5rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.82rem;
    line-height: 1.35;
}

.ap-form-error.is-visible {
    display: block;
}

.ap-upload-progress {
    border: 1px solid var(--border);
    border-radius: 999px;
    height: 0.9rem;
    background: #121212;
    overflow: hidden;
    position: relative;
}

.ap-upload-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4e9fff, #7cc2ff);
    transition: width 120ms linear;
}

.ap-upload-progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d7e8ff;
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    pointer-events: none;
}

.ap-upload-controls {
    display: flex;
    justify-content: flex-end;
}

.ap-upload-cancel-btn {
    border: 1px solid #4a4a4a;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border-radius: 999px;
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
}

.ap-upload-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.ap-adminsheet {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 2200;
    display: none;
    align-items: flex-end;
}

.ap-adminsheet.is-open {
    display: flex;
}

.ap-adminsheet-inner {
    width: min(720px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: var(--bg-surface);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1rem;
    margin: 0 auto;
}

.ap-adminsheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.ap-adminsheet-close {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    border-radius: 999px;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
}

.ap-admin-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: var(--bg-elevated);
}

.ap-admin-section h4 {
    margin-bottom: 0.6rem;
}

.ap-admin-social-row {
    display: grid;
    grid-template-columns: 1fr 1.2fr 0.9fr auto auto auto;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.ap-admin-social-row input,
.ap-admin-social-row select {
    width: 100%;
}

.ap-admin-social-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ap-admin-social-actions {
    display: inline-flex;
    gap: 0.25rem;
}

.ap-admin-social-actions button {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    border-radius: 6px;
    padding: 0.2rem 0.45rem;
    cursor: pointer;
}

.ap-admin-theme-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.ap-admin-theme-actions {
    display: grid;
    gap: 0.5rem;
}

.ap-admin-theme-delete-preset {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    border-radius: 999px;
    width: 1.9rem;
    height: 1.9rem;
    cursor: pointer;
    line-height: 1;
}

.ap-admin-theme-delete-preset:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ap-admin-status {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ─── Footer ───────────────────────────────────────────────────────── */
.ap-footer {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    padding: 4rem 2rem 2rem;
    border-top: 1px solid var(--bg-elevated);
}

.ap-footer-row {
    display: inline-flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.ap-social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.ap-social-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
}

.ap-social-links a:hover {
    color: var(--text);
}

.ap-social-icon {
    display: inline-flex;
    width: 1rem;
    height: 1rem;
}

.ap-social-icon svg {
    width: 100%;
    height: 100%;
}

/* ─── Responsive: 1024px ───────────────────────────────────────────── */
@media (max-width: 1024px) {
    .ap-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .ap-admin-social-row {
        grid-template-columns: 1fr;
    }

    .ap-admin-theme-grid {
        grid-template-columns: 1fr;
    }

    .ap-about-admin-controls {
        grid-template-columns: 1fr;
    }

    .ap-about-box-actions {
        opacity: 1;
    }
}

/* ─── Responsive: 768px ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .ap-header,
    .ap-grid-section,
    .ap-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .ap-site-name {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
    }

    .ap-modal-content {
        width: 95%;
    }

    .ap-modal-prev,
    .ap-modal-next {
        position: fixed;
        top: auto;
        bottom: 1.5rem;
        transform: none;
    }

    .ap-modal-prev { left: 1.5rem; }
    .ap-modal-next { right: 1.5rem; }

    .ap-visualizer-container {
        aspect-ratio: 16 / 9;
    }
}

/* ─── Responsive: 480px ────────────────────────────────────────────── */
@media (max-width: 480px) {
    .ap-grid {
        grid-template-columns: 1fr;
    }

    .ap-modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
        inset: 0;
    }

    .ap-modal {
        align-items: stretch;
    }

    .ap-bottomsheet {
        max-height: 95vh;
    }
}

/* ─── Reduced Motion ───────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ─── Top Genres & Tools Styling ───────────────────────────────────── */
.ap-top-genres-container,
.ap-top-tools-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
}

.ap-top-genre-label,
.ap-top-tool-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ap-top-genre-chip,
.ap-top-tool-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.ap-top-genre-chip:hover,
.ap-top-tool-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    color: var(--text);
}

/* Album Player Rating & Admin Edit Button */
.ap-player-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 0.75rem;
    padding: 0 0.5rem;
}

.ap-player-rating-container {
    display: flex;
    align-items: center;
}

.ap-player-edit {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.ap-player-edit:hover {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.08);
}

.ap-player-info {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    font-weight: 600;
    font-style: italic;
    font-family: "Cormorant Garamond", Georgia, serif;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.ap-player-info:hover {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.08);
}

.ap-player-meta-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ap-player-viz-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.ap-player-viz-toggle:hover {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.08);
}

.ap-player-viz-toggle.is-active {
    color: #3b82f6;
}

/* ─── Print ────────────────────────────────────────────────────────── */
@media print {
    body {
        background: #fff;
        color: #000;
    }

    .ap-filters,
    .ap-modal,
    .ap-fab,
    .ap-bottomsheet,
    .ap-card-admin,
    .ap-social-links {
        display: none !important;
    }

    .ap-grid {
        display: block;
    }

    .ap-card {
        break-inside: avoid;
        margin-bottom: 1rem;
        opacity: 1;
        transform: none;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .ap-footer {
        border-top-color: #ddd;
    }
}
