/* ═══════════════════════════════════════════════
   Design System & CSS Variables
   ═══════════════════════════════════════════════ */
:root {
    --bg-main: #0B0F19;
    --bg-panel: rgba(17, 24, 39, 0.88);
    --bg-sidebar: rgba(17, 24, 39, 0.92);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(52, 211, 153, 0.4);

    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;

    --accent: #10B981; /* Emerald Green */
    --accent-hover: #34D399;
    --accent-bg: rgba(16, 185, 129, 0.15);

    --danger: #EF4444;
    --danger-hover: #F87171;

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-header: 'Outfit', var(--font-sans);

    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --panel-width: 380px;
    --panel-margin: 20px;
}

/* ═══════════════════════════════════════════════
   Base Styles
   ═══════════════════════════════════════════════ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ═══════════════════════════════════════════════
   App Layout
   ═══════════════════════════════════════════════ */
#app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: relative;
}

#canvas-container {
    flex-grow: 1;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* ═══════════════════════════════════════════════
   Paneles Laterales Flotantes (Glassmorphism)
   ═══════════════════════════════════════════════ */
#sidebar-left,
#sidebar-right {
    width: var(--panel-width);
    height: calc(100vh - 40px - 32px); /* resta footer status-bar */
    background: var(--bg-panel);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin: var(--panel-margin);
    z-index: 10;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: absolute;
    top: 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
}

#sidebar-left {
    left: 0;
}
#sidebar-left.collapsed {
    transform: translateX(calc(-100% - 40px));
    opacity: 0;
    pointer-events: none;
}

#sidebar-right {
    right: 0;
}
#sidebar-right.collapsed {
    transform: translateX(calc(100% + 40px));
    opacity: 0;
    pointer-events: none;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ═══════════════════════════════════════════════
   Sidebar Header
   ═══════════════════════════════════════════════ */
.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-icon {
    font-size: 26px;
    color: var(--accent);
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.4));
}
.sidebar-header h1 {
    font-family: var(--font-header);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #FFF;
    line-height: 1;
}
.subtitle {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 4px;
    display: inline-block;
}

/* ═══════════════════════════════════════════════
   Secciones Colapsables (details/summary)
   ═══════════════════════════════════════════════ */
.collapsible-section {
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.collapsible-section > summary {
    padding: 15px 24px;
    font-family: var(--font-header);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: color 0.2s ease, background 0.15s ease;
}
.collapsible-section > summary::-webkit-details-marker {
    display: none;
}
.collapsible-section > summary::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    margin-left: auto;
    color: var(--text-muted);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
.collapsible-section[open] > summary::after {
    transform: rotate(180deg);
}
.collapsible-section > summary:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}
.collapsible-section > summary i {
    color: var(--accent);
    font-size: 13px;
    flex-shrink: 0;
}

/* Contenido de cada sección */
.section-content {
    padding: 4px 24px 20px;
}

/* Compatibilidad con .sidebar-section (clases heredadas) */
.sidebar-section {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-section h2 {
    font-family: var(--font-header);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sidebar-section h2 i {
    color: var(--accent);
}

/* ═══════════════════════════════════════════════
   Botones Flotantes de Control
   ═══════════════════════════════════════════════ */
.floating-btn {
    position: absolute;
    z-index: 15;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(11, 15, 25, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.floating-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.3);
    transform: scale(1.08);
}

/* Botones estilo menú hamburguesa / cerrar */
.menu-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px; /* Diseño moderno semi-cuadrado */
    font-size: 16px;
    background: rgba(17, 24, 39, 0.9);
    z-index: 20; /* Siempre por encima del sidebar (z-index: 10) */
    border: 1px solid rgba(255, 255, 255, 0.15);
}

#toggle-left {
    top: 32px;
    left: 32px;
}

#toggle-right {
    top: 32px;
    right: 32px;
}

#btn-fullscreen {
    bottom: 48px;
    right: 14px;
    z-index: 20;
}

/* Evitar solapamiento con el logo del panel izquierdo */
#sidebar-left .logo-area {
    padding-left: 44px;
}

/* ═══════════════════════════════════════════════
   Form Controls
   ═══════════════════════════════════════════════ */
.control-group {
    margin-bottom: 14px;
}
.control-group:last-child {
    margin-bottom: 0;
}
label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 7px;
}

/* Inputs */
input[type="text"],
input[type="url"],
input[type="number"],
select {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 9px 12px;
    color: #FFF;
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
input[type="text"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

/* Textarea */
.form-textarea {
    width: 100%;
    resize: vertical;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition-fast);
}
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

/* File Upload Style */
.file-drop-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 22px 16px;
    cursor: pointer;
    text-align: center;
    background: rgba(255, 255, 255, 0.01);
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.file-drop-area:hover {
    border-color: var(--accent);
    background: rgba(16, 185, 129, 0.02);
}
.file-drop-area i {
    font-size: 26px;
    color: var(--text-muted);
    margin-bottom: 10px;
    transition: color var(--transition-fast), transform var(--transition-fast);
}
.file-drop-area:hover i {
    color: var(--accent);
    transform: translateY(-2px);
}
.file-drop-area span {
    font-size: 12px;
    color: var(--text-secondary);
}
.file-drop-area input[type="file"] {
    display: none;
}

/* Compact File drop */
.file-drop-area.compact {
    padding: 12px 16px;
    flex-direction: row;
    gap: 10px;
}
.file-drop-area.compact i {
    font-size: 16px;
    margin-bottom: 0;
}

/* File Info Box */
.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--accent-bg);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--accent-hover);
    word-break: break-all;
    animation: fadeIn var(--transition-fast);
}
.file-info i {
    font-size: 14px;
}
.hidden {
    display: none !important;
}

/* Sub-encabezado de grupo dentro de una sección */
.control-subsection-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    opacity: 0.85;
    margin: 14px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(16, 185, 129, 0.2);
}

/* ═══════════════════════════════════════════════
   Sliders
   ═══════════════════════════════════════════════ */
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.slider-header span {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-hover);
}
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
    transition: transform var(--transition-fast);
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* ═══════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════ */
.btn-primary,
.btn-secondary,
.btn-text {
    width: 100%;
    padding: 10px 16px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-fast);
}
.btn-primary {
    background-color: var(--accent);
    border: none;
    color: #FFF;
}
.btn-primary:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}
.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--text-secondary);
}
.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
}
.btn-text:hover {
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════
   Collapsible Details (sub-level, e.g. BBOX Grid)
   ═══════════════════════════════════════════════ */
.collapsible-details {
    margin-top: 12px;
    margin-bottom: 8px;
}
.collapsible-details summary {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 0;
    outline: none;
    user-select: none;
}
.collapsible-details summary:hover {
    color: var(--text-primary);
}
.bbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 12px;
}
.bbox-input label {
    font-size: 10px;
    margin-bottom: 4px;
    color: var(--text-muted);
}
.bbox-input input {
    padding: 6px 8px;
    font-size: 11px;
}

/* ═══════════════════════════════════════════════
   Layer Management list
   ═══════════════════════════════════════════════ */
#layerListContainer {
    margin-top: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.layer-list-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}
#layerList {
    padding: 6px;
    max-height: 250px;
    overflow-y: auto;
}
.layer-list-empty {
    padding: 20px 12px !important;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}
.layer-list-empty p {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.layer-list-empty i {
    font-size: 20px;
}

/* Layer Item Cards */
.layer-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all var(--transition-fast);
    animation: slideIn var(--transition-fast);
}
.layer-item:last-child {
    margin-bottom: 0;
}
.layer-item:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
}
.layer-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.layer-name-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-grow: 1;
    overflow: hidden;
}
.layer-icon {
    color: var(--accent);
    font-size: 14px;
    flex-shrink: 0;
}
.layer-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}
.layer-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}
.btn-icon:hover {
    color: #FFF;
    background: rgba(255, 255, 255, 0.08);
}
.btn-icon.active {
    color: var(--accent-hover);
}
.btn-icon.delete:hover {
    color: var(--danger-hover);
    background: rgba(239, 68, 68, 0.1);
}

/* Layer Control Subpanel (Opacity, Color, etc.) */
.layer-controls-drawer {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--border-color);
}
.layer-control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.layer-control-row span {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Tiny custom input color picker wrapper */
.color-picker-container {
    display: flex;
    align-items: center;
    gap: 4px;
}
.color-picker-container input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    background: none;
}
.color-picker-container input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
.color-picker-container input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--border-color);
    border-radius: 50%;
}

/* Tiny opacity slider inside layers drawer */
.layer-opacity-slider {
    flex-grow: 1;
    max-width: 100px;
    height: 4px;
}
.layer-opacity-slider::-webkit-slider-thumb {
    width: 10px;
    height: 10px;
}

/* ═══════════════════════════════════════════════
   Brújula Interactiva 3D
   ═══════════════════════════════════════════════ */
#compass-widget {
    position: absolute;
    top: 90px; /* Alineado verticalmente debajo del botón de menú derecho */
    right: 32px;
    width: 82px;
    height: 82px;
    z-index: 20;
    cursor: pointer;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.55));
    transition: filter 0.2s ease;
}
#compass-widget:hover {
    filter: drop-shadow(0 4px 16px rgba(52, 211, 153, 0.4));
}
#compass-svg {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: visible;
}
#compass-angle-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.05em;
    text-align: center;
    line-height: 1;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* ═══════════════════════════════════════════════
   Status Bar Footer
   ═══════════════════════════════════════════════ */
#status-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    font-size: 11px;
    color: var(--text-secondary);
    gap: 12px;
}
.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.status-item i {
    color: var(--accent);
}
.status-credit {
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.status-credit a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}
.status-credit a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════
   Exportación de Mapa — Controles Específicos
   ═══════════════════════════════════════════════ */
.export-map-checks {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 14px;
}
.export-map-checks label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    margin-bottom: 0;
}
.export-map-checks input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* Lista de leyendas editables */
.legend-editor-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 6px 0;
    margin-top: 8px;
}
.legend-editor-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.legend-editor-item input[type="color"] {
    width: 22px;
    height: 22px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    background: none;
    padding: 1px;
    flex-shrink: 0;
}
.legend-editor-item input[type="text"] {
    flex-grow: 1;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 5px;
}
.legend-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.legend-empty i {
    font-size: 18px;
}

/* Hint de exportación */
.export-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.5;
    display: flex;
    gap: 6px;
    align-items: flex-start;
}
.export-hint i {
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 1px;
}

/* ═══════════════════════════════════════════════
   Color picker para leyenda en categorizado
   ═══════════════════════════════════════════════ */
.legend-color-picker {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: none !important;
    display: inline-block;
    vertical-align: middle;
}
.legend-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}
.legend-color-picker::-webkit-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}
.legend-color-picker::-moz-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}

/* ═══════════════════════════════════════════════
   Paleta de Colores del Terreno
   ═══════════════════════════════════════════════ */
.palette-control-group {
    margin-top: 10px;
}

.palette-preview-bar {
    width: 100%;
    height: 14px;
    border-radius: 7px;
    margin-top: 6px;
    background: linear-gradient(to right, #228B22, #55B732, #A0D646, #F5E650, #E6A032, #C36E28, #965A3C, #F0F0F5);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
    transition: background 0.35s ease;
}

/* Editor de paleta personalizada */
.custom-palette-editor {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 8px;
    padding: 10px;
    margin-top: 8px;
}

.custom-palette-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.custom-palette-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.custom-stop-pct {
    width: 48px;
    padding: 4px 6px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 12px;
    text-align: right;
}

.custom-stop-pct-label {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 12px;
}

.custom-stop-color {
    width: 36px;
    height: 28px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: none;
    cursor: pointer;
}

.btn-icon-remove {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-radius: 5px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    flex-shrink: 0;
    transition: background 0.15s;
}
.btn-icon-remove:hover {
    background: rgba(239, 68, 68, 0.3);
}

.btn-small {
    font-size: 12px;
    padding: 5px 10px;
}

/* ═══════════════════════════════════════════════
   Panel de Servicios Remotos — transición suave
   ═══════════════════════════════════════════════ */
#remoteServiceUrl,
#remoteServiceLayer,
#remoteWmtsTileMatrix,
#remoteWmtsFormat,
#remoteArcGISLayers,
#xyzPresetSelect {
    transition: opacity 0.2s ease;
}

/* Grupos de campos con animación de aparición */
#fieldXyzPreset,
#fieldLayer,
#fieldWmtsMatrix,
#fieldArcLayers,
#fieldOpacity {
    animation: fadeInField 0.2s ease forwards;
}

@keyframes fadeInField {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Botón conectar con estilo de acción importante */
#btnLoadRemoteService {
    width: 100%;
    margin-top: 4px;
    gap: 8px;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent) 0%, #3b82f6 100%);
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
    transition: all 0.2s ease;
}
#btnLoadRemoteService:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
}
#btnLoadRemoteService:active {
    transform: translateY(0);
}

/* ═══════════════════════════════════════════════
   Modal de Propiedades
   ═══════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.25s ease-out;
}

.modal-content {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 550px;
    max-height: 80vh;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-modal-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: color var(--transition-fast), transform var(--transition-fast);
}

.close-modal-btn:hover {
    color: #f87171;
    transform: scale(1.1);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.properties-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    color: var(--text-primary);
}

.properties-table th,
.properties-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.properties-table th {
    font-weight: 600;
    color: var(--accent);
    background: rgba(16, 185, 129, 0.05);
}

.properties-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.properties-table td:first-child {
    font-weight: 600;
    color: var(--text-secondary);
    width: 35%;
}

/* ═══════════════════════════════════════════════
   Animations
   ═══════════════════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════════
   Responsive — Tablet (≤1200px)
   ═══════════════════════════════════════════════ */
@media (max-width: 1200px) {
    :root {
        --panel-width: 320px;
    }
    #toggle-left {
        left: 24px;
        top: 24px;
    }
    #toggle-right {
        right: 24px;
        top: 24px;
    }
    #compass-widget {
        top: 80px;
        right: 24px;
    }
}

/* ═══════════════════════════════════════════════
   Responsive — Mobile (≤768px)
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
    :root {
        --panel-width: calc(100vw - 20px);
        --panel-margin: 10px;
    }

    #sidebar-left,
    #sidebar-right {
        width: calc(100vw - 20px);
        height: 48vh;
        position: fixed;
        bottom: 32px;
        top: auto;
        left: 10px;
        right: 10px;
        margin: 0;
        border-radius: 12px 12px 0 0;
        border-bottom: none;
    }

    #sidebar-left {
        z-index: 11;
    }
    #sidebar-left.collapsed {
        transform: translateY(calc(100% + 36px));
        opacity: 0;
    }

    #sidebar-right {
        z-index: 12;
    }
    #sidebar-right.collapsed {
        transform: translateY(calc(100% + 36px));
        opacity: 0;
    }

    #toggle-left {
        top: 16px;
        left: 16px;
        bottom: auto;
    }
    
    #toggle-right {
        top: 16px;
        right: 16px;
        bottom: auto;
    }

    #btn-fullscreen {
        right: 16px;
        bottom: 72px;
    }

    #status-bar {
        font-size: 9px;
        padding: 0 10px;
        height: 28px;
    }
    .status-credit {
        display: none;
    }

    #compass-widget {
        top: 70px;
        right: 16px;
        width: 60px;
        height: 60px;
        z-index: 20;
    }
    #compass-svg {
        width: 52px;
        height: 52px;
    }
}
