/* =========================
   COVER / GALLERY
========================= */
.cover-preview-box, .selected-image-box, .gallery-preview-box { border: 1px solid var(--line); border-radius: 12px; background: #fafbfe; min-height: 180px; padding: 12px; }
.gallery-preview-box { min-height: 320px; }
.cover-preview-box.empty, .selected-image-box.empty, .gallery-preview-box.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.cover-preview-image, .selected-image-preview, .gallery-preview-image { width: 100%; display: block; border-radius: 10px; }
.cover-preview-caption, .selected-image-name, .gallery-preview-title { margin-top: 8px; color: var(--muted); font-size: 0.8125rem; text-align: center; }
.asset-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.asset-actions .primary-btn, .asset-actions .nav-btn { width: 100%; height: 48px; min-width: 0; }
.gallery-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.gallery-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; max-height: 320px; overflow: auto; }
.gallery-list.large { max-height: 70vh; }
.gallery-item { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; }
.gallery-item:hover { border-color: #b7c6df; background: #fafcff; }
.gallery-item.active { background: var(--accent-soft); border-color: var(--accent); }
.gallery-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; display: block; }
.gallery-item-title { font-size: 0.875rem; font-weight: 700; }
.gallery-item-sub { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.gallery-empty, .link-empty { color: var(--muted); font-size: 0.875rem; padding: 8px 0; }

/* =========================
   GALLERY PAGE
========================= */
.gallery-page { display: grid; grid-template-columns: 360px 1fr; gap: 24px; padding: 24px; min-height: calc(100vh - 58px); }
.gallery-page-sidebar, .gallery-page-main { min-width: 0; }

/* =========================
   LINKS
========================= */
.link-results { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-height: 280px; overflow: auto; }
.link-insert-btn { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.link-insert-btn:hover { border-color: var(--accent); background: #fafcff; }

/* Overrides de Tema (Dark) */
:root.dark .gallery-item, :root.dark .link-insert-btn, :root.dark .cover-preview-box, :root.dark .selected-image-box, :root.dark .gallery-preview-box { background: #1d2230; color: var(--text); border-color: var(--line); }
:root.dark .gallery-item-sub, :root.dark .cover-preview-caption, :root.dark .selected-image-name, :root.dark .gallery-preview-title, :root.dark .gallery-empty, :root.dark .link-empty { color: var(--muted); }
:root.dark .gallery-item:hover, :root.dark .link-insert-btn:hover { background: #22293a; border-color: #3c4961; }
:root.dark .gallery-item.active { background: var(--accent-soft); border-color: var(--accent); }

/* Overrides de Tema (Crema) */
:root.crema .gallery-item, :root.crema .link-insert-btn, :root.crema .cover-preview-box, :root.crema .selected-image-box, :root.crema .gallery-preview-box { background: #fff8ee; color: var(--text); border-color: var(--line); }
:root.crema .gallery-item.active { background: var(--accent-soft); border-color: var(--accent); }

/* Responsive */
@media (max-width: 900px) { .gallery-page { grid-template-columns: 1fr; } .asset-actions { grid-template-columns: 1fr; } }
