/*
 * Cloud Droncore — estilos específicos del producto.
 *
 * El "chrome" del layout (body, sidebar, header superior, tipografía) viene
 * de /assets/css/layout.css (sistema dc-* portado de droncore-webapp). Este
 * archivo añade SOLO los componentes propios de Cloud Droncore: explorer,
 * visor, mapa, forms, tablas, modales.
 */

/* Respetar el atributo HTML `hidden` aunque haya reglas display: flex/grid
   posteriores — clave para los modales que arrancan ocultos. */
[hidden] { display: none !important; }

/* SVG inline en el chrome dc-* (sidebar, burger, logout). layout.css define
   .dc-nav__icon como contenedor 26x26 pensando en <img>, pero nuestros
   iconos son SVG inline sin width/height propios. Sin estas reglas el SVG
   se renderiza al default 300x150 ignorando el padre. */
.dc-nav__icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 26px; width: 26px; height: 26px; }
.dc-nav__icon svg { width: 100%; height: 100%; display: block; }
.dc-burger { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 4px; background: transparent; border: 0; color: inherit; cursor: pointer; }
.dc-burger svg { width: 100%; height: 100%; display: block; }

/* El .dc-header es position:fixed (layout.css línea 308) y no reserva espacio
   en el flujo. layout.css ya define `body.dc-layout .dc-content { padding-top: 40px }`
   pero 40px no cubre header_top_gap(14) + header_h(64) = 78px → el contenido se
   solapa. Necesitamos mayor padding-top con specificity igual o mayor
   (body.dc-layout .dc-content tiene 0,0,2,0 → cloud.css carga después, gana). */
body.dc-layout .dc-content {
    padding-top: calc(var(--header-h, 64px) + var(--header-top-gap, 14px) + 24px);
}

/* Defensa del logo del sidebar: garantizar zona visible aunque el SVG falle */
.dc-sidebar__brand { min-height: 64px; }
.dc-brand__logo { max-width: 100%; }

/* Badge "Cloud" del logo en el sidebar (solo visible cuando sidebar expandido) */
.dc-sidebar__brand { position: relative; }
.dc-brand__badge {
    position: absolute;
    bottom: 6px; right: 10px;
    background: var(--secondary, #c15d1a);
    color: #fff;
    font-size: 0.62rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 6px;
    border-radius: 4px;
    display: none;
}
body.dc-nav-open .dc-brand__badge,
.dc-sidebar:hover .dc-brand__badge { display: inline-block; }

/* Fullscreen visor (sin sidebar) */
.dc-layout--fullscreen { background: #0b0b0c; color: #f1f5f9; }
.dc-layout--fullscreen .dc-fullscreen { min-height: 100vh; padding: 0; }

/* Page header */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h1 { margin: 0; font-size: 1.6rem; font-weight: 600; }

/* Buttons */
.btn {
    display: inline-block; padding: 8px 16px; border-radius: 6px;
    font-size: 13px; font-weight: 500; text-decoration: none;
    border: 1px solid transparent; cursor: pointer; line-height: 1.2;
    background: #fff; color: #222;
}
.btn-primary { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }
.btn-primary:hover { background: #234d77; }
.btn-secondary { background: #fff; color: #444; border-color: #d0d4d9; }
.btn-secondary:hover { background: #f0f2f5; }
.btn-link {
    background: transparent; border: none; color: #1a3a5c;
    padding: 4px 8px; cursor: pointer; text-decoration: underline;
}
.btn-danger { color: #b3261e; }

/* Forms */
.form { max-width: 640px; }
.form-row { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-weight: 500; font-size: 0.9rem; color: #444; }
.form-row .required { color: #b3261e; }
.form-row input[type=text],
.form-row input[type=number],
.form-row textarea,
.form-row select {
    padding: 8px 10px; border: 1px solid #d0d4d9; border-radius: 6px;
    font: inherit; background: #fff;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
    outline: none; border-color: #1a3a5c; box-shadow: 0 0 0 3px rgba(26,58,92,0.15);
}
.form-row-split { flex-direction: row; gap: 16px; }
.form-row-split > div { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }
.inline-form { display: inline; }

/* Alerts */
.alert {
    padding: 12px 16px; border-radius: 6px; margin-bottom: 16px;
    border-left: 4px solid; background: #f7f8fa;
}
.alert-error { border-color: #b3261e; background: #fdecea; color: #5e1916; }
.alert p { margin: 0 0 6px; }
.alert p:last-child { margin-bottom: 0; }

/* Empty state */
.empty-state {
    text-align: center; padding: 64px 24px;
    background: #fff; border-radius: 8px; border: 1px dashed #d0d4d9;
}
.empty-state p { color: #666; margin-bottom: 16px; }

/* Uppy + archivos list */
#uppy-root { margin: 16px 0 32px; }
.archivos-list { margin-top: 32px; }
.archivos-list h2 { font-size: 1rem; font-weight: 600; margin: 0 0 12px; }
.archivos-list .muted { color: #888; font-style: italic; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
.data-table th, .data-table td {
    padding: 12px 12px; text-align: left; border-bottom: 1px solid rgba(28,31,35,.06);
    font-size: 13px;
}
.data-table th { background: #fff; font-weight: 850; color: var(--text, #1d2025); border-bottom-color: rgba(28,31,35,.10); }
.data-table tr:last-child td { border-bottom: none; }
.tipo-badge {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.3px;
}
.tipo-foto         { background: #e0f2fe; color: #075985; }
.tipo-foto360      { background: #ddd6fe; color: #5b21b6; }
.tipo-video        { background: #fee2e2; color: #991b1b; }
.tipo-pdf          { background: #fef3c7; color: #92400e; }
.tipo-nube_puntos  { background: #d1fae5; color: #065f46; }
.tipo-modelo3d     { background: #f3e8ff; color: #6b21a8; }
.tipo-otro         { background: #e5e7eb; color: #374151; }
.tipo-folder       { background: #fef3c7; color: #92400e; }

/* ============================================================
   Explorer (fase 4)
   ============================================================ */
#explorer {
    background: #fff; border: 1px solid #e1e5ea; border-radius: 8px;
    overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* Banner sticky de "modo operacion" - lo pinta `src/View/layout_start.php`
   sobre TODAS las pages de cloud (explorer, ubicaciones, visor) mientras la
   sesion tenga contexto de operacion. Vive DENTRO de .dc-content (debajo
   del .dc-header fixed). El usuario lo retira con "Quitar filtro"
   (?clear_op=1, gestionado por el mismo layout). */
.cloud-op-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 16px;
    background: linear-gradient(180deg, #fef9e7, #fcf3cf);
    border: 1px solid #f1c40f;
    border-radius: 8px;
    color: #7d6608;
    font-size: 13px;
}
.cloud-op-banner__icon { font-size: 18px; line-height: 1; }
.cloud-op-banner__text { flex: 1; min-width: 0; }
.cloud-op-banner__text strong { color: #5d4a06; }
.cloud-op-banner__clear {
    flex: 0 0 auto;
    padding: 4px 10px;
    border: 1px solid #d4ac0d;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.5);
    color: #5d4a06;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
}
.cloud-op-banner__clear:hover { background: rgba(255, 255, 255, 0.85); }
.cloud-op-banner__upload {
    flex: 0 0 auto;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

/* Toolbar */
.explorer-toolbar {
    background: linear-gradient(180deg, #f8f9fa, #eef0f3);
    border-bottom: 1px solid #d1d5db;
    padding: 8px 12px; display: flex; align-items: center; gap: 6px;
    flex-wrap: wrap;
}
.btn-tool {
    background: #fff; border: 1px solid #d0d4d9; border-radius: 6px;
    padding: 5px 10px; font-size: 0.85rem; cursor: pointer; line-height: 1.2;
    color: #222;
}
.btn-tool:hover { background: #f0f2f5; border-color: #9ca3af; }
.btn-tool:disabled { opacity: 0.45; cursor: not-allowed; }
.toolbar-sep { color: #ccc; padding: 0 4px; font-size: 0.8rem; }
.toolbar-spacer { flex: 1; }

/* Breadcrumb / address bar */
.explorer-address {
    background: #f8f9fa; border-bottom: 1px solid #e1e5ea;
    padding: 8px 14px; font-size: 0.9rem;
}
.explorer-breadcrumb {
    list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap;
    align-items: center; gap: 4px;
}
.explorer-breadcrumb li { display: inline-flex; align-items: center; }
.explorer-breadcrumb a { color: #1a3a5c; text-decoration: none; padding: 2px 6px; border-radius: 4px; }
.explorer-breadcrumb a:hover { background: #e0e7ef; }
.explorer-breadcrumb strong { padding: 2px 6px; }
.crumb-sep { color: #aaa; }

/* Body layout */
.explorer-body { display: flex; min-height: 60vh; }
.explorer-sidebar {
    width: 240px; min-width: 240px;
    background: #f8f9fa; border-right: 1px solid #e1e5ea;
    padding: 12px 0; overflow-y: auto; max-height: 70vh;
}
.sidebar-title {
    font-size: 0.75rem; font-weight: 600; color: #6b7280;
    text-transform: uppercase; letter-spacing: 0.5px;
    padding: 0 14px 8px;
    margin: 0;
}
.sb-tree { list-style: none; padding: 0; margin: 0; }
.sb-tree li { padding: 0; margin: 0; }
.sb-link {
    display: block; padding: 6px 12px; color: #333; text-decoration: none;
    font-size: 0.88rem; border-left: 3px solid transparent;
}
.sb-link:hover { background: #e2e6ea; }
.sb-link.active { background: #cce5ff; border-left-color: #1a3a5c; font-weight: 600; }

.explorer-content { flex: 1; padding: 0; overflow-y: auto; max-height: 70vh; min-width: 0; }

.explorer-uppy-wrap { padding: 12px; border-bottom: 1px solid #e1e5ea; background: #fafbfc; }

/* Selection bar */
.selection-bar {
    background: #fff8db; border-bottom: 1px solid #f6d76a;
    padding: 8px 14px; display: flex; align-items: center; gap: 12px;
    font-size: 0.88rem;
}
.selection-bar .btn-link { padding: 2px 8px; }

/* Table */
.explorer-table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}
.explorer-table thead th {
    background: #f0f2f5; border-bottom: 1px solid #d1d5db;
    padding: 8px 12px; font-weight: 600; color: #555; text-align: left;
    position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
.explorer-table tbody tr {
    border-bottom: 1px solid #f0f2f5; cursor: default;
}
.explorer-table tbody tr:hover { background: #f7f8fa; }
.explorer-table tbody tr.selected { background: #cce5ff; }
.explorer-table tbody tr.cut { opacity: 0.55; }
.explorer-table td { padding: 6px 12px; vertical-align: middle; }
.col-check { width: 36px; text-align: center; }
.col-name { max-width: 360px; }
.col-name .row-name {
    display: inline-block; color: #222; text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.col-name .row-name:hover { color: #1a3a5c; text-decoration: underline; }
.col-name .row-name { display: inline-flex; align-items: center; gap: 8px; }
.row-thumb {
    width: 40px; height: 30px; object-fit: cover;
    border-radius: 3px; flex-shrink: 0; background: #1e293b;
}
.row-icon { width: 24px; text-align: center; flex-shrink: 0; }
.row-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tipo-override-mark { color: #f59e0b; font-weight: 700; margin-left: 4px; }

/* ============================================================
   Map picker modal (ubicaciones/edit.php)
   ============================================================ */
.form-fieldset {
    border: 1px solid #e1e5ea; border-radius: 6px; padding: 16px; margin-bottom: 16px;
}
.form-fieldset legend {
    font-weight: 600; padding: 0 8px;
    display: flex; align-items: center; gap: 12px;
}
.map-picker-modal {
    position: fixed; inset: 0; z-index: 1100;
    display: flex; align-items: center; justify-content: center;
}
.map-picker-overlay {
    position: absolute; inset: 0; background: rgba(15, 23, 42, 0.72);
}
.map-picker-content {
    position: relative; z-index: 1; display: flex; flex-direction: column;
    background: #fff; color: #222; border-radius: 8px;
    width: min(90vw, 880px); max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4); overflow: hidden;
}
.map-picker-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: #f8f9fa; border-bottom: 1px solid #e1e5ea;
}
.map-picker-body {
    padding: 14px 16px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 10px;
}
.map-picker-body input { padding: 8px 10px; border: 1px solid #d0d4d9; border-radius: 6px; font: inherit; }
.map-picker-body input:focus { outline: none; border-color: #1a3a5c; box-shadow: 0 0 0 3px rgba(26,58,92,0.15); }
#picker-map {
    width: 100%; height: 320px; border-radius: 6px;
    background: #e5e7eb;
}
.map-picker-fields {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
}
.map-picker-fields > div { display: flex; flex-direction: column; gap: 4px; }
.map-picker-fields label { font-size: 0.78rem; color: #555; }
.map-picker-fields input[readonly] { background: #f8f9fa; color: #444; }
.map-picker-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 16px; border-top: 1px solid #e1e5ea; background: #f8f9fa;
}
@media (max-width: 768px) {
    .map-picker-fields { grid-template-columns: 1fr 1fr; }
}

/* Google Places Autocomplete dropdown — Google lo inyecta en <body> con
   z-index: 1000 por defecto, y queda DETRÁS de nuestro .map-picker-modal
   (z-index 1100). Subimos para que sea visible. */
.pac-container { z-index: 1200 !important; }

/* ============================================================
   Galería por ubicación (/ubicaciones/galeria.php)
   ============================================================ */

/* Permisos: ocultar acciones de admin para usuarios "lectura". El backend
   también rechaza los endpoints con 403, esto es solo UX para no enseñar
   botones que no funcionarían. */
body[data-admin-cloud="0"] .needs-admin { display: none !important; }

/* Vista 1: tarjetas de resumen por tipo */
.galeria-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.galeria-card {
    display: flex; flex-direction: column;
    background: #fff;
    border: 1px solid #e1e5ea;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .15s, transform .15s, box-shadow .15s;
    padding: 0;
    text-align: left;
    font: inherit;
    color: inherit;
}
.galeria-card:hover {
    border-color: var(--primary, #21505b);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}
.galeria-card-image {
    width: 100%; aspect-ratio: 16/10;
    background: #1e293b center/cover no-repeat;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.5);
}
.galeria-card-image.has-thumb .galeria-card-icon { display: none; }
.galeria-card-icon { font-size: 2.8rem; }
.galeria-card-body { padding: 12px 14px; }
.galeria-card-title { font-weight: 600; font-size: 1rem; color: #222; }
.galeria-card-count { color: #666; font-size: 0.85rem; margin-top: 2px; }

/* Sección "Subcarpetas" arriba del resumen por tipo. */
.galeria-padre { margin-bottom: 8px; }
.galeria-subcarpetas { margin-top: 8px; margin-bottom: 24px; }
.galeria-section-title {
    font-size: 0.95rem; font-weight: 600; color: #495057;
    text-transform: uppercase; letter-spacing: 0.04em;
    margin: 0 0 10px;
}
.galeria-subcarpetas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
/* Las cards de subcarpeta son <a> (navegables): mismo estilo que .galeria-card
   más un acento visual para diferenciarlas de las tarjetas de tipo. */
.galeria-card--sub {
    text-decoration: none;
    border-color: #d6e3da;
    background: #f6faf7;
}
.galeria-card--sub:hover { border-color: var(--primary, #21505b); }
.galeria-card--sub .galeria-card-image { background-color: #2f5d4a; }

/* Vista 2: grid filtrado por tipo */
.galeria-filtered-header {
    display: flex; align-items: center; gap: 12px;
    margin: 16px 0;
    flex-wrap: wrap;
}
.galeria-filtered-header h2 { margin: 0; font-size: 1.15rem; font-weight: 600; flex: 1; min-width: 200px; }
.galeria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.galeria-tile {
    display: flex; flex-direction: column;
    background: #fff;
    border: 1px solid #e1e5ea;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    text-align: left;
    font: inherit;
    color: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.galeria-tile:hover {
    border-color: var(--primary, #21505b);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.galeria-tile-image {
    aspect-ratio: 4/3;
    background: #1e293b center/cover no-repeat;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.5);
}
.galeria-tile-image.has-thumb .galeria-tile-icon { display: none; }
.galeria-tile-icon { font-size: 2rem; }
.galeria-tile-name {
    padding: 8px 10px; font-size: 0.85rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.galeria-loading { padding: 32px; text-align: center; color: #666; }
.galeria-empty { padding: 64px 24px; text-align: center; }

/* Modal de la galería (mismo aspecto que .visor-modal pero con autoplay) */
.galeria-modal {
    position: fixed; inset: 0; z-index: 1100;
    display: flex; align-items: center; justify-content: center;
}
.galeria-modal-overlay {
    position: absolute; inset: 0; background: rgba(15, 23, 42, 0.92);
}
.galeria-modal-content {
    position: relative; z-index: 1; display: flex; flex-direction: column;
    background: #111; color: #f1f5f9; border-radius: 8px;
    width: min(95vw, 1400px); height: min(92vh, 900px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
}
.galeria-modal-header {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; background: #1e293b; border-bottom: 1px solid #334155;
}
.galeria-modal-title { font-weight: 600; max-width: 50%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.galeria-modal-counter { color: #94a3b8; font-size: 0.85rem; }
.galeria-modal-spacer { flex: 1; }
.galeria-modal-header .btn-icon { background: transparent; color: #cbd5e1; border-color: transparent; font-size: 1.1rem; }
.galeria-modal-header .btn-icon:hover { background: #334155; color: #fff; }
.galeria-modal-body {
    flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
    background: #000; overflow: hidden;
}

@media (max-width: 768px) {
    .galeria-summary { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .galeria-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* Mini-modal "Nueva carpeta" del explorer */
.folder-modal {
    position: fixed; inset: 0; z-index: 1050;
    display: flex; align-items: center; justify-content: center;
}
.folder-modal-overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.6); }
.folder-modal-content {
    position: relative; z-index: 1; background: #fff; border-radius: 8px;
    width: min(90vw, 480px); display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.folder-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; background: #f8f9fa; border-bottom: 1px solid #e1e5ea;
    border-radius: 8px 8px 0 0;
}
.folder-modal-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.folder-modal-body input[type=text] {
    padding: 8px 10px; border: 1px solid #d0d4d9; border-radius: 6px; font: inherit;
}
.folder-location-summary { color: #2563eb; display: block; margin-top: 6px; font-size: 0.85rem; }
.folder-modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 16px; border-top: 1px solid #e1e5ea; background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

/* Modal "Selecciona ubicación para esta subida" - se abre al pulsar Subir
   archivos cuando estás en modo "filtrado por operación" y aún no has
   entrado en una carpeta. Lista las ubicaciones más cercanas al centro del
   área de la operación + atajo para crear una ubicación nueva. */
.op-ubic-picker {
    position: fixed; inset: 0; z-index: 1050;
    display: flex; align-items: center; justify-content: center;
}
.op-ubic-picker__overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.6); }
.op-ubic-picker__content {
    position: relative; z-index: 1; background: #fff; border-radius: 8px;
    width: min(92vw, 540px); max-height: 86vh; display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.op-ubic-picker__header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; background: #f8f9fa; border-bottom: 1px solid #e1e5ea;
    border-radius: 8px 8px 0 0;
}
.op-ubic-picker__body {
    padding: 16px; display: flex; flex-direction: column; gap: 16px;
    overflow-y: auto;
}
.op-ubic-picker__intro {
    margin: 0; color: #4b5563; font-size: 13px; line-height: 1.5;
}
.op-ubic-picker__section h4 {
    margin: 0 0 8px; font-size: 13px; color: #6b7280; text-transform: uppercase;
    letter-spacing: 0.04em; font-weight: 600;
}
.op-ubic-picker__list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 6px;
}
.op-ubic-picker__placeholder {
    padding: 12px; color: #6b7280; font-size: 13px; font-style: italic;
    background: #f8f9fa; border-radius: 6px; text-align: center;
}
.op-ubic-picker__item {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    width: 100%; padding: 10px 12px; border: 1px solid #e1e5ea; border-radius: 6px;
    background: #fff; cursor: pointer; font: inherit; text-align: left;
    transition: background 0.12s, border-color 0.12s;
}
.op-ubic-picker__item:hover { background: #eef2ff; border-color: #6366f1; }
.op-ubic-picker__item strong { font-weight: 600; color: #111827; font-size: 14px; }
.op-ubic-picker__item small { color: #6b7280; font-size: 12px; }
.op-ubic-picker__dist {
    background: #6366f1; color: #fff; padding: 1px 6px; border-radius: 999px;
    font-size: 11px; font-weight: 700; margin-right: 6px;
}
.op-ubic-picker__form {
    display: flex; flex-direction: column; gap: 8px;
}
.op-ubic-picker__form-label {
    font-size: 12px; color: #6b7280; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.op-ubic-picker__name-input {
    padding: 8px 10px; border: 1px solid #d0d4d9; border-radius: 6px;
    font: inherit; font-size: 14px; width: 100%; box-sizing: border-box;
}
.op-ubic-picker__name-input:focus {
    outline: 0; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.18);
}
.op-ubic-picker__create {
    align-self: flex-start;
}
.op-ubic-picker__create:disabled {
    opacity: 0.55; cursor: not-allowed;
}
.op-ubic-picker__dup-warning {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
    padding: 8px 10px; border-radius: 6px;
    background: rgba(245,158,11,.14);
    border: 1px solid rgba(245,158,11,.4);
    color: #92400e; font-size: 13px; line-height: 1.4;
}
.op-ubic-picker__dup-warning strong { color: #78350f; font-weight: 700; }
.op-ubic-picker__dup-icon { font-size: 14px; }
.op-ubic-picker__dup-use {
    margin-left: auto;
    padding: 4px 12px;
    background: #92400e; color: #fff; border: 0; border-radius: 4px;
    font-size: 12px; font-weight: 700; cursor: pointer;
}
.op-ubic-picker__dup-use:hover { background: #78350f; }
.op-ubic-picker__hint {
    display: block; margin-top: 6px; color: #6b7280; font-size: 12px;
}

/* Página /ubicaciones/mapa.php */
.mapa-page {
    display: grid; grid-template-columns: 320px 1fr; gap: 16px;
    margin: 0 auto; height: calc(100vh - 180px); min-height: 480px;
}
.mapa-sidebar {
    background: #fff; border: 1px solid #e1e5ea; border-radius: 8px;
    padding: 12px; display: flex; flex-direction: column; gap: 8px;
    min-height: 0;
}
.mapa-sidebar input[type=search] {
    padding: 8px 10px; border: 1px solid #d0d4d9; border-radius: 6px;
    font: inherit;
}
.mapa-list {
    list-style: none; margin: 0; padding: 0; overflow-y: auto;
    flex: 1; min-height: 0;
}
.mapa-list-item {
    padding: 10px 12px; border-radius: 6px; cursor: pointer;
    border: 1px solid transparent; margin-bottom: 4px;
    display: flex; flex-direction: column; gap: 2px;
}
.mapa-list-item:hover { background: #f0f2f5; border-color: #e1e5ea; }
.mapa-list-item small { color: #555; font-size: 0.8rem; }
.mapa-list-item small.muted { color: #888; }
.mapa-empty { text-align: center; padding: 32px 16px; color: #666; }
.mapa-canvas {
    background: #e5e7eb; border-radius: 8px; border: 1px solid #e1e5ea;
    min-height: 480px;
}
.map-info { font-size: 0.9rem; max-width: 260px; }
.map-info .muted { color: #666; font-size: 0.82rem; }
.map-info-actions {
    display: flex; gap: 12px; margin-top: 8px; padding-top: 8px;
    border-top: 1px solid #eef0f3;
}
.map-info-actions a { color: #1a3a5c; text-decoration: none; font-weight: 500; }
.map-info-actions a:hover { text-decoration: underline; }

@media (max-width: 768px) {
    .mapa-page { grid-template-columns: 1fr; height: auto; }
    .mapa-canvas { height: 60vh; }
}
.col-name .row-desc { display: block; color: #888; font-size: 0.78rem; margin-top: 2px; }
.col-type, .col-size, .col-date { color: #555; white-space: nowrap; }
.col-actions { text-align: right; white-space: nowrap; }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid transparent; color: #444;
    padding: 5px 8px; border-radius: 4px; cursor: pointer; font-size: 14px;
    line-height: 1; text-decoration: none;
}
.btn-icon:hover { background: #e8eaed; border-color: #d0d4d9; color: #1a3a5c; }
.btn-icon.btn-danger { color: #b3261e; }
.btn-icon.btn-danger:hover { background: #fdecea; border-color: #f1c2bd; color: #b3261e; }

.row-folder .col-name .row-name { font-weight: 500; }

.explorer-empty {
    padding: 48px 24px; text-align: center; color: #888;
}

/* Status bar */
.explorer-status {
    background: #f8f9fa; border-top: 1px solid #d1d5db;
    padding: 5px 14px; font-size: 0.8rem; color: #666;
    display: flex; justify-content: space-between;
}

/* Context menu */
.context-menu {
    position: fixed; z-index: 1000; min-width: 160px;
    background: #fff; border: 1px solid #d1d5db; border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    list-style: none; padding: 4px 0; margin: 0; font-size: 0.88rem;
}
.context-menu-item {
    padding: 6px 14px; cursor: pointer; color: #222;
}
.context-menu-item:hover { background: #f0f2f5; }
.context-menu-item.danger { color: #b3261e; }
.context-menu-item.danger:hover { background: #fdecea; }

/* ============================================================
   Visor (fase 5)
   ============================================================ */
body.no-scroll { overflow: hidden; }

/* Modal embebido en el explorer */
.visor-modal {
    position: fixed; inset: 0; z-index: 1100;
    display: flex; align-items: center; justify-content: center;
}
.visor-modal-overlay {
    position: absolute; inset: 0; background: rgba(15, 23, 42, 0.85);
}
.visor-modal-content {
    position: relative; z-index: 1; display: flex; flex-direction: column;
    background: #111; color: #f1f5f9; border-radius: 8px;
    width: min(95vw, 1400px); height: min(92vh, 900px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
}
.visor-modal-header {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; background: #1e293b; border-bottom: 1px solid #334155;
}
.visor-modal-title {
    font-weight: 600; max-width: 60%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.visor-modal-counter { color: #94a3b8; font-size: 0.85rem; }
.visor-modal-spacer { flex: 1; }
.visor-modal-header .btn-icon {
    background: transparent; color: #cbd5e1; border-color: transparent; font-size: 1.1rem;
}
.visor-modal-header .btn-icon:hover { background: #334155; border-color: transparent; color: #fff; }
.visor-modal-body {
    flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
    background: #000; overflow: hidden;
    position: relative; /* ancla del `.visor-360` absolute */
}

/* Página standalone /visor.php */
.visor-page { padding: 16px 0 32px; }
.visor-page-header {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    margin-bottom: 16px;
}
.visor-page-header h1 {
    margin: 0; font-size: 1.2rem; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex: 1; min-width: 200px;
}
.visor-standalone-body {
    background: #000; color: #f1f5f9; border-radius: 8px;
    /* Altura EXPLICITA (no solo min-height): PSV monta un canvas WebGL
       dentro de `.visor-360` y su clientHeight debe ser != 0 en el render
       inicial para que three.js calcule el viewport. `position: relative`
       sirve como ancla del `.visor-360` absolute (ver regla abajo).
       Resultado: foto normal carga (es un <img> y crece con el contenido)
       pero foto360 quedaba colgada porque su canvas era 0x0. */
    position: relative;
    height: calc(100vh - 140px);
    min-height: 480px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}

/* Visores específicos */
.visor-image, .visor-video {
    max-width: 100%; max-height: 100%; object-fit: contain; display: block;
}
.visor-pdf {
    width: 100%; height: 100%; border: 0; background: #fff;
}
.visor-360 {
    /* `absolute; inset: 0` garantiza dimensiones fijas independientes del
       align-items del padre flex. Si lo dejamos en width/height: 100% el
       padre `align-items: center` no estira el item al cross-axis y
       `clientHeight` queda 0 en el render inicial; PSV crea su canvas
       WebGL con esas medidas y la foto 360 no se ve. */
    position: absolute; inset: 0;
    min-height: 480px;
}
.visor-model {
    width: 100%; height: 100%; min-height: 480px; background: #1e293b;
}

.visor-placeholder {
    text-align: center; padding: 48px 32px; color: #cbd5e1; max-width: 480px;
}
.visor-placeholder p { margin: 0 0 16px; }
.visor-placeholder .btn-primary {
    background: #3b82f6; color: #fff; border-color: #3b82f6;
}
.visor-placeholder .btn-primary:hover { background: #2563eb; }

.visor-loading, .visor-error {
    color: #cbd5e1; padding: 32px; text-align: center; font-size: 0.95rem;
}
.visor-error { color: #fca5a5; }

/* Lightbox zoom para fotos */
.visor-image-wrap {
    width: 100%; height: 100%; overflow: hidden; position: relative;
    display: flex; align-items: center; justify-content: center;
    cursor: zoom-in;
}
.visor-image-swap {
    position: absolute; top: 12px; right: 12px; z-index: 10;
    background: rgba(15, 23, 42, 0.85); color: #fff; border: 1px solid #475569;
    border-radius: 6px; padding: 6px 12px; font-size: 0.82rem; cursor: pointer;
    backdrop-filter: blur(6px);
}
.visor-image-swap:hover { background: rgba(15, 23, 42, 0.95); }
.visor-image-swap:disabled { opacity: 0.6; cursor: wait; }
.visor-image-wrap.zoomed { cursor: grab; }
.visor-image-wrap.zoomed:active { cursor: grabbing; }
.visor-image-wrap .visor-image {
    transition: transform 0.05s linear;
    transform-origin: center center;
    user-select: none; -webkit-user-drag: none;
}

/* Quota bar en el status bar del explorer */
.explorer-quota {
    display: inline-flex; align-items: center; gap: 8px;
}
.quota-text { font-size: 0.78rem; color: #555; }
.quota-bar {
    display: inline-block; width: 120px; height: 6px;
    background: #e5e7eb; border-radius: 3px; overflow: hidden;
}
.quota-fill {
    display: block; height: 100%; width: 0;
    background: #1a3a5c; transition: width 0.3s;
}
.quota-fill.high { background: #d97706; }
.quota-fill.full { background: #b3261e; }

/* Tree */
.tree, .tree-children { list-style: none; padding: 0; margin: 0; }
.tree-children { padding-left: 24px; border-left: 2px solid #e1e5ea; margin-top: 4px; }
.tree-node { margin: 4px 0; }
.tree-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; background: #fff; border-radius: 6px;
    border: 1px solid #e1e5ea;
}
.tree-row:hover { border-color: #1a3a5c; }
.tree-name { font-weight: 500; font-size: 13px; }
.tree-desc { color: #666; font-size: 12px; flex: 1; }
.tree-meta { color: #888; font-size: 12px; font-family: monospace; }

/* Toggle expandir/colapsar subcarpetas. El --placeholder mantiene la
   alineación de los nodos hoja con los nodos que sí tienen toggle. */
.tree-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px;
    background: transparent; border: none; cursor: pointer;
    color: #6b7280; padding: 0; border-radius: 4px;
    font-size: 11px; line-height: 1; transition: color .15s, background .15s;
    flex: 0 0 22px;
}
.tree-toggle:hover { color: #1a3a5c; background: #e8eaed; }
.tree-toggle i { transition: transform .15s; }
.tree-toggle--placeholder {
    cursor: default; pointer-events: none;
}

/* ============================================================================
   Panel de control (admin)
   ============================================================================ */
.page-header__sub { margin: 4px 0 0; color: #666; font-size: 0.9rem; }
.page-header__sub .back-link { color: #1a3a5c; text-decoration: none; }
.page-header__sub .back-link:hover { text-decoration: underline; }

.admin-grid {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.admin-card {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 18px; border: 1px solid #e5e7eb; border-radius: 10px;
    background: #fff; text-decoration: none; color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.admin-card:hover {
    border-color: #1a3a5c;
    box-shadow: 0 4px 14px rgba(26, 58, 92, 0.08);
    transform: translateY(-1px);
}
.admin-card--placeholder {
    opacity: 0.55; cursor: default;
}
.admin-card--placeholder:hover {
    border-color: #e5e7eb; box-shadow: none; transform: none;
}
.admin-card__icon {
    flex: 0 0 40px; width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; background: #eef2f7; color: #1a3a5c;
}
.admin-card__icon svg { width: 22px; height: 22px; }
.admin-card__title { margin: 0 0 4px; font-size: 1rem; font-weight: 600; }
.admin-card__desc { margin: 0; color: #555; font-size: 0.85rem; line-height: 1.4; }

.admin-section { margin-top: 8px; }
.admin-filters {
    display: grid; gap: 12px;
    grid-template-columns: 2fr 1fr 1fr 1.5fr auto;
    align-items: end;
    padding: 14px; background: #f7f8fa; border-radius: 8px;
    margin-bottom: 16px;
}
.admin-filter { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.admin-filter > span { color: #444; font-weight: 500; }
.admin-filter input, .admin-filter select {
    padding: 7px 10px; border: 1px solid #d0d4d9; border-radius: 6px;
    background: #fff; font-size: 0.9rem; min-height: 34px;
}
.admin-filter--actions { align-self: end; }
@media (max-width: 900px) {
    .admin-filters { grid-template-columns: 1fr 1fr; }
}

.admin-summary {
    margin-bottom: 8px; color: #555; font-size: 0.85rem;
}

.admin-table-wrap {
    border: 1px solid #e5e7eb; border-radius: 8px; overflow: auto;
    background: #fff;
}
.admin-table {
    width: 100%; border-collapse: collapse; font-size: 0.88rem;
}
.admin-table thead th {
    text-align: left; padding: 10px 12px; background: #f7f8fa;
    border-bottom: 1px solid #e5e7eb; font-weight: 600; color: #444;
    white-space: nowrap;
}
.admin-table tbody td {
    padding: 9px 12px; border-bottom: 1px solid #f0f2f5; vertical-align: middle;
}
.admin-table tbody tr:hover { background: #fafbfc; }
.admin-table__name {
    max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 0.83rem;
}
.admin-table__actions { text-align: right; }

.admin-badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 0.75rem; font-weight: 600;
    background: #e5e7eb; color: #444;
}
.admin-badge.is-pending { background: #fef3c7; color: #92400e; }
.admin-badge.is-ok      { background: #d1fae5; color: #065f46; }
.admin-badge.is-error   { background: #fee2e2; color: #991b1b; cursor: help; }

.btn-small {
    padding: 4px 10px; font-size: 0.78rem;
    background: #fff; color: #1a3a5c; border: 1px solid #1a3a5c; border-radius: 5px;
    cursor: pointer;
}
.btn-small:hover { background: #1a3a5c; color: #fff; }
.btn-small--ghost {
    color: #64748b; border-color: #cbd5e1;
}
.btn-small--ghost:hover { background: #64748b; color: #fff; border-color: #64748b; }
.btn-small--browser {
    color: #7c2d12; border-color: #fdba74;
}
.btn-small--browser:hover { background: #c2410c; color: #fff; border-color: #c2410c; }
.btn-small:disabled { opacity: 0.55; cursor: wait; }

.admin-pagination {
    display: flex; align-items: center; justify-content: center; gap: 14px;
    margin-top: 16px;
}
.admin-pagination__info { color: #555; font-size: 0.85rem; }

.admin-intro {
    color: #555; font-size: 0.9rem; margin: 0 0 14px;
    padding: 12px 14px; background: #eef5fc; border-left: 3px solid #1a3a5c;
    border-radius: 4px;
}
.admin-coords {
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 0.83rem; color: #0f5132;
}
.admin-coords--missing {
    color: #92400e; font-style: italic; font-family: inherit;
}
.admin-coords--just-set {
    color: #065f46; font-weight: 600;
    animation: dc-flash-green 1.2s ease-out;
}
@keyframes dc-flash-green {
    0%   { background: #d1fae5; }
    100% { background: transparent; }
}
.tree-actions { margin-left: auto; display: flex; gap: 4px; align-items: center; }

/* ============================================================================
   Visor 360° de zona de vuelo (estilo OMIVERSO planta_visor360.php)
   ============================================================================ */
body.dc-layout--visor360 .dc-content {
    padding: 0; padding-top: calc(var(--header-h, 64px) + var(--header-top-gap, 14px));
}
.visor360-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0;
    height: calc(100vh - var(--header-h, 64px) - var(--header-top-gap, 14px));
    min-height: 600px;
}
.visor360-left {
    display: flex; flex-direction: column;
    padding: 14px 18px;
    overflow: hidden;
    background: linear-gradient(180deg, #0f1419 0%, #1a2530 100%);
    color: #f1f5f9;
}
.visor360-right {
    background: #0b0b0c;
    border-left: 1px solid #1f2937;
    overflow: hidden;
}

.visor360-header {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 12px; flex-shrink: 0;
}
.visor360-back {
    color: #cbd5e1; text-decoration: none; font-size: 0.9rem;
    padding: 6px 12px; border: 1px solid rgba(255,255,255,0.2); border-radius: 6px;
    background: rgba(255,255,255,0.05); transition: background 0.15s;
}
.visor360-back:hover { background: rgba(255,255,255,0.12); }
.visor360-title {
    margin: 0; font-size: 1.35rem; font-weight: 600; color: #fff; flex: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.visor360-badge {
    background: linear-gradient(135deg, #4fc3f7 0%, #1976d2 100%);
    color: #fff; font-weight: 600; font-size: 0.8rem;
    padding: 4px 12px; border-radius: 999px; flex-shrink: 0;
}

.visor360-viewer {
    flex: 1 1 60%;
    min-height: 380px;
    border-radius: 12px;
    background: #000;
    box-shadow: 0 8px 25px rgba(0,0,0,0.6);
    margin-bottom: 14px;
    overflow: hidden;
    position: relative;
}
.visor360-empty, .visor360-error {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; color: #94a3b8; text-align: center; padding: 24px;
    gap: 14px;
}
.visor360-error { color: #fca5a5; }

.visor360-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 150px);
    grid-auto-rows: 165px;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 4px 6px 0;
    flex-shrink: 0;
    max-height: 30vh;
}
.visor360-grid::-webkit-scrollbar { width: 8px; }
.visor360-grid::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 4px; }
.visor360-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
.visor360-grid::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.35); }

.visor360-card {
    position: relative;
    width: 150px; height: 165px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    background: #1f2937;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s, border-color 0.15s;
    display: flex; flex-direction: column;
}
.visor360-card:hover {
    transform: translateY(-2px);
    border-color: #4fc3f7;
}
.visor360-card.is-active {
    border-color: #4fc3f7;
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.3);
}
.visor360-card img {
    width: 100%; height: 110px; object-fit: cover; display: block;
}
.visor360-card.no-thumb::before {
    content: '360°';
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 110px;
    background: linear-gradient(135deg, #4fc3f7, #1976d2);
    color: #fff; font-weight: bold; font-size: 1.4rem;
}
.visor360-card-badge {
    position: absolute; top: 6px; right: 6px;
    background: rgba(0, 0, 0, 0.65); color: #4fc3f7;
    font-size: 0.65rem; font-weight: bold;
    padding: 2px 7px; border-radius: 999px;
    pointer-events: none;
}
.visor360-card-name {
    padding: 6px 8px; font-size: 0.72rem; color: #cbd5e1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-align: left; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

.visor360-map {
    width: 100%; height: 100%;
}
.visor360-map-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; padding: 24px; color: #94a3b8; text-align: center; gap: 8px;
}
.visor360-map-empty .hint {
    font-size: 0.8rem; color: #64748b; max-width: 280px;
}

/* InfoWindow del mapa */
.visor360-iw {
    min-width: 220px; max-width: 240px; padding: 4px;
}
.visor360-iw-title {
    margin: 0 0 8px; font-size: 0.95rem; font-weight: 600; color: #1e293b;
    word-break: break-word;
}
.visor360-iw-thumb {
    display: block; width: 100%; height: 130px; object-fit: cover;
    border-radius: 8px; cursor: pointer;
    transition: transform 0.15s;
}
.visor360-iw-thumb:hover { transform: scale(1.03); }
.visor360-iw-thumb--placeholder {
    background: linear-gradient(135deg, #4fc3f7, #1976d2);
    color: #fff; font-weight: bold; font-size: 1.4rem;
    display: flex; align-items: center; justify-content: center;
}
.visor360-iw-hint {
    margin: 8px 0 4px; font-size: 0.72rem; color: #94a3b8; text-align: center;
    font-style: italic;
}
.visor360-iw-coords {
    margin: 0; font-size: 0.75rem; color: #475569;
}

/* Responsive: en pantallas pequeñas el mapa se va debajo */
@media (max-width: 900px) {
    .visor360-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 280px;
        height: auto;
        min-height: 100vh;
    }
    .visor360-left { height: calc(100vh - 280px - 80px); }
    .visor360-right { border-left: none; border-top: 1px solid #1f2937; }
}
