/**
 * Public Map Styles (Leaflet version)
 * 
 * Estilos personalizados para el mapa público interactivo
 * Bootstrap-free version - all components are custom
 */

/* ========== Bootstrap Replacement: Base ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ========== Bootstrap Replacement: Utilities ========== */
.small {
    font-size: 0.875em;
}

.fw-bold {
    font-weight: 700;
}

.text-muted {
    color: #64748b;
}

.text-decoration-none {
    text-decoration: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Spacing utilities */
.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.me-1 {
    margin-right: 0.25rem;
}

.me-2 {
    margin-right: 0.5rem;
}

.p-2 {
    padding: 0.5rem;
}

.pt-3 {
    padding-top: 1rem;
}

.py-4 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

/* Flexbox utilities */
.d-flex {
    display: flex;
}

.d-inline-flex {
    display: inline-flex;
}

.d-none {
    display: none;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.justify-content-center {
    justify-content: center;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.text-center {
    text-align: center;
}

.text-uppercase {
    text-transform: uppercase;
}

/* Border utilities */
.border-top {
    border-top: 1px solid #e2e8f0;
}

/* ========== Bootstrap Replacement: Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: 0.375rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    white-space: nowrap;
    font-family: inherit;
}

.btn:focus {
    outline: none;
}

.btn-primary {
    background-color: #1e293b;
    border-color: #1e293b;
    color: white;
}

.btn-primary:hover {
    background-color: #334155;
    border-color: #334155;
    color: white;
}

.btn-primary:focus {
    box-shadow: 0 0 0 0.2rem rgba(30, 41, 59, 0.25);
}

.btn-sm {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
}

.btn-close {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/0.75rem auto no-repeat;
    border: 0;
    border-radius: 0.25rem;
    opacity: 0.5;
    cursor: pointer;
}

.btn-close:hover {
    opacity: 0.75;
}

.btn-outline-secondary {
    background-color: transparent;
    border-color: #cbd5e1;
    color: #64748b;
}

.btn-outline-secondary:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}

/* Button check (radio/checkbox as buttons) */
.btn-check {
    position: absolute;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

.btn-group {
    display: inline-flex;
    /* border-radius: 50rem; */
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-of-type {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

.btn-group .btn:last-of-type {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

.btn-group .btn+.btn-check+.btn {
    margin-left: -1px;
}

.btn-group-sm .btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
}

.btn-check {
    position: absolute;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

.btn-check:checked+.btn-outline-secondary {
    background-color: #1e293b;
    border-color: #1e293b;
    color: white;
    z-index: 1;
    position: relative;
}

/* ========== Bootstrap Replacement: Forms ========== */
.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: #1e293b;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    font-family: inherit;
}

.form-control:focus {
    border-color: #475569;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(30, 41, 59, 0.1);
}

.form-control::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.form-control-sm {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
}

/* Input groups */
.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.input-group>.form-control {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.input-group>.form-control:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group>.btn:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
}

/* Form check (checkboxes/radios) */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 1.5rem;
    padding-left: 0;
    margin-bottom: 0.125rem;
}

.form-check-input {
    width: 1rem;
    height: 1rem;
    margin: 0;
    vertical-align: top;
    background-color: #fff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border: 1px solid #cbd5e1;
    appearance: none;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.form-check-input[type="checkbox"] {
    border-radius: 0.25rem;
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

.form-check-input:checked {
    background-color: #1e293b;
    border-color: #1e293b;
}

.form-check-input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

.form-check-input:focus {
    border-color: #475569;
    outline: 0;
    box-shadow: 0 0 0 0.15rem rgba(30, 41, 59, 0.15);
}

.form-check-label {
    cursor: pointer;
    color: #475569;
    font-size: 0.875rem;
}

/* Form switch (toggle) */
.form-switch {
    padding-left: 0;
}

.form-switch .form-check-input {
    width: 2.25rem;
    height: 1.25rem;
    background-color: #cbd5e1;
    border: none;
    border-radius: 2rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
    background-position: left center;
    transition: background-position 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.form-switch .form-check-input:checked {
    background-color: #1e293b;
    background-position: right center;
}

.form-switch .form-check-input:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
    box-shadow: 0 0 0 0.15rem rgba(30, 41, 59, 0.15);
}

/* ========== Bootstrap Replacement: Card ========== */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
}

.card-body {
    flex: 1 1 auto;
    padding: 1rem;
}

.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* ========== Bootstrap Replacement: List Group ========== */
.list-group {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    border-radius: 0.375rem;
}

.list-group-item {
    position: relative;
    display: block;
    padding: 0.625rem 0.875rem;
    color: #1e293b;
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    cursor: pointer;
}

.list-group-item:first-child {
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

.list-group-item:last-child {
    border-bottom-right-radius: inherit;
    border-bottom-left-radius: inherit;
}

.list-group-item+.list-group-item {
    border-top-width: 0;
}

.list-group-item:hover {
    background-color: #f8fafc;
}

/* ========== Bootstrap Replacement: Spinner ========== */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: -0.125em;
    border: 0.25em solid currentcolor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* ========== Bootstrap Replacement: Offcanvas ========== */
.offcanvas-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.offcanvas-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.offcanvas {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 1045;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    visibility: hidden;
    background-color: #fff;
    background-clip: padding-box;
    outline: 0;
    transition: transform 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.offcanvas-start {
    left: 0;
    width: 380px;
    max-width: 90vw;
    transform: translateX(-100%);
}

.offcanvas.show {
    visibility: visible;
    transform: translateX(0);
}

.offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: #1e293b;
    color: white;
    border-bottom: 1px solid #334155;
}

.offcanvas-title {
    margin: 0;
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
}

.offcanvas-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.offcanvas-header .btn-close:hover {
    opacity: 1;
}

.offcanvas-body {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* ========== Layout General ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
}

/* Mapa a pantalla completa */
#map {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
}

/* ========== Botón flotante para abrir panel ========== */
.floating-menu-toggle {
    position: fixed;
    top: 20px;
    left: 60px;
    z-index: 1000;
    background: #1e293b;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 14px;
    color: white;
}

.floating-menu-toggle:hover {
    background: #334155;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ========== Floating Controls Panel ========== */
.floating-controls {
    position: fixed;
    top: 75px;
    left: 60px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.floating-controls .card-body {
    padding: 10px 14px;
}

.floating-controls .form-check.form-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 0;
    min-height: auto;
}

.floating-controls .form-check-input {
    cursor: pointer;
    width: 36px;
    height: 20px;
    margin: 0;
    flex-shrink: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #cbd5e1;
    border: none;
    border-radius: 20px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left center;
    background-size: contain;
    transition: background-position .15s ease-in-out, background-color .15s ease-in-out;
}

.floating-controls .form-check-input:checked {
    background-color: #1e293b;
    background-position: right center;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

.floating-controls .form-check-input:focus {
    box-shadow: 0 0 0 0.15rem rgba(30, 41, 59, 0.15);
    outline: 0;
}

.floating-controls .form-check-label {
    cursor: pointer;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    font-size: 13px;
}

.floating-controls .form-check-label svg {
    color: #64748b;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .floating-controls {
        top: 65px;
        left: 50px;
    }

    .floating-controls .card-body {
        padding: 8px 10px;
    }
}

/* ========== Panel Lateral (Offcanvas) ========== */
.offcanvas {
    width: 380px !important;
    max-width: 90vw;
}

.offcanvas-header {
    background: #1e293b;
    color: white;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #334155;
}

.offcanvas-title {
    font-weight: 700;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
}

.offcanvas-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.offcanvas-header .btn-close:hover {
    opacity: 1;
}

.offcanvas-body {
    padding: 1.5rem;
}

/* ========== Bootstrap Overrides ========== */
/* Toggle switches */
.offcanvas .form-check-input:checked {
    background-color: #1e293b;
    border-color: #1e293b;
}

.offcanvas .form-check-input:focus {
    border-color: #475569;
    box-shadow: 0 0 0 0.2rem rgba(30, 41, 59, 0.15);
}

.offcanvas .form-switch .form-check-input:checked {
    background-color: #1e293b;
}

/* Buttons */
.offcanvas .btn-outline-primary {
    color: #1e293b;
    border-color: #cbd5e1;
}

.offcanvas .btn-outline-primary:hover {
    background-color: #1e293b;
    border-color: #1e293b;
    color: white;
}

.offcanvas .btn-outline-primary:focus {
    box-shadow: 0 0 0 0.2rem rgba(30, 41, 59, 0.15);
}

.offcanvas .btn-outline-secondary {
    color: #64748b;
    border-color: #cbd5e1;
}

.offcanvas .btn-outline-secondary:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}

.offcanvas .btn-sm {
    font-size: 13px;
    padding: 8px 12px;
}

/* Search button */
.btn-search {
    background-color: #1e293b;
    border-color: #1e293b;
    color: white;
}

.btn-search:hover {
    background-color: #334155;
    border-color: #334155;
    color: white;
}

.btn-search:focus {
    box-shadow: 0 0 0 0.2rem rgba(30, 41, 59, 0.25);
}

/* Input styling */
.offcanvas .form-control {
    border-color: #e2e8f0;
    font-size: 13px;
}

.offcanvas .form-control:focus {
    border-color: #475569;
    box-shadow: 0 0 0 0.2rem rgba(30, 41, 59, 0.1);
}

.offcanvas .input-group-text {
    background-color: #f8fafc;
    border-color: #e2e8f0;
    color: #64748b;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 50rem;
    /* Pill shape */
}

.rounded-pill {
    border-radius: 50rem !important;
}

.offcanvas .badge {
    font-weight: 500;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 50rem;
}

.offcanvas .badge.bg-secondary {
    background-color: #e2e8f0 !important;
    color: #475569;
}

.offcanvas .badge.bg-light {
    background-color: #f1f5f9 !important;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* Section headers */
.offcanvas h6.text-muted {
    color: #94a3b8 !important;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Dividers */
.offcanvas hr {
    border-color: #f1f5f9;
    opacity: 0.6;
    margin: 1.25rem 0;
}

/* Panel footer link */
.offcanvas .border-top a {
    color: #64748b;
}

.offcanvas .border-top a:hover {
    color: #1e293b;
}

/* ========== Year Groups ========== */
.year-group {
    margin-bottom: 12px;
    background: #fff;
    overflow: hidden;
}

.year-group.year-future {
    border-left: 3px solid #94a3b8;
    background: #f8fafc;
}

.year-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: #e2e8f0;
    border-bottom: 1px solid #cbd5e1;
}

.year-future .year-header {
    background: #f1f5f9;
}

.year-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.year-header .year-checkbox {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.year-header .year-checkbox:checked {
    background-color: #1e293b;
    border-color: #1e293b;
}

.year-header .year-checkbox:indeterminate {
    background-color: #64748b;
    border-color: #64748b;
}

.year-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.year-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.year-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    color: #475569;
    transition: transform 0.2s ease;
}

.year-label {
    display: flex;
    align-items: center;
    gap: 4px;
}

.year-label svg {
    color: #64748b;
}

.year-count {
    font-size: 10px;
    font-weight: 500;
    background: #475569;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
}

.year-future .year-count {
    background: #64748b;
}

.year-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: #64748b;
}

.year-stats span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.year-stats svg {
    opacity: 0.7;
}

.year-trips {
    padding: 6px;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
    opacity: 1;
}

.year-trips.collapsed {
    max-height: 0;
    padding: 0 6px;
    opacity: 0;
}

/* ========== Items de viajes ========== */
.trip-filter-item {
    background: #f8fafc;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    transition: background 0.15s ease;
    border: 1px solid #e2e8f0;
}

.trip-filter-item:hover {
    background: #f1f5f9;
}

.trip-filter-item .form-check {
    margin-bottom: 0;
    padding-left: 0;
}

.trip-filter-item .form-check-input {
    margin: 0;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.trip-filter-item .form-check-input:checked {
    background-color: #1e293b;
    border-color: #1e293b;
}

.trip-filter-item .form-check-label {
    cursor: pointer;
    margin: 0;
    line-height: 1.3;
}

.trip-color-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 50%;
}

.trip-title {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    display: block;
    line-height: 1.3;
}

.trip-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.trip-counts {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #94a3b8;
    white-space: nowrap;
    margin-left: 8px;
}

.trip-counts span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.trip-counts svg {
    opacity: 0.7;
}

/* Future trips styling */
.trip-filter-item.trip-future {
    background: #f1f5f9;
    border-left: 2px dotted #94a3b8;
}

.trip-filter-item.trip-future:hover {
    background: #e2e8f0;
}

.trip-filter-item.trip-future .trip-title {
    color: #64748b;
}

.trip-filter-item .badge {
    font-size: 9px;
    padding: 2px 5px;
    font-weight: 400;
}

/* Trips header with filters */
.trips-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.trips-filters {
    display: flex;
    gap: 4px;
}

.filter-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-btn:hover {
    background: #e2e8f0;
    color: #475569;
}

.filter-btn.active {
    background: #1e293b;
    border-color: #1e293b;
    color: white;
}

/* ========== Selector agrupar por ========== */
.group-by-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    margin-top: -4px;
    opacity: 0.75;
}

.group-by-selector:hover {
    opacity: 1;
}

.group-by-label {
    font-size: 10px;
    color: #94a3b8;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.group-by-selector .btn-group .btn {
    font-size: 10px;
    padding: 2px 8px;
    border-color: #e2e8f0;
    color: #94a3b8;
    background: transparent;
}

.group-by-selector .btn-group .btn:hover {
    background: #f1f5f9;
    color: #64748b;
}

.group-by-selector .btn-check:checked + .btn {
    background: #475569;
    border-color: #475569;
    color: white;
}

/* ========== Leyenda flotante ========== */
.legend-card {
    position: fixed;
    bottom: 50px;
    right: 20px;
    z-index: 999;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    border-radius: 6px;
    min-width: 170px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.legend-card .card-body {
    padding: 10px 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-line {
    width: 30px;
    height: 4px;
    border-radius: 2px;
    margin-right: 8px;
}

.legend-item small {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-item svg {
    flex-shrink: 0;
}

.legend-future-separator {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #ddd;
}

.legend-future {
    height: 3px !important;
    opacity: 0.6;
}

/* ========== Clusters personalizados ========== */
.custom-cluster-icon {
    background: transparent !important;
    border: none !important;
}

.marker-cluster-custom {
    background: #1e293b;
    border: 2px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 13px;
}

/* ========== Marcadores de puntos ========== */
.custom-point-marker {
    background: transparent !important;
    border: none !important;
}

.point-marker-inner {
    width: 34px;
    height: 34px;
    border-radius: 50% 50% 50% 0;
    border: 2px solid;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transform: rotate(-45deg);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.point-marker-inner span {
    transform: rotate(45deg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.point-marker-inner svg {
    width: 16px;
    height: 16px;
}

.point-marker-inner .point-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.point-marker-inner .point-icon svg {
    stroke: currentColor;
    fill: none;
}

.point-marker-inner.point-type-food .point-icon {
    color: #1e293b;
}

/* ========== MapLibre GL Popups ========== */
.maplibregl-popup-content {
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    padding: 0;
    overflow: hidden;
    min-width: 280px;
    max-width: 320px;
}

.maplibregl-popup-close-button {
    width: 28px;
    height: 28px;
    font-size: 20px;
    color: #666;
    right: 4px;
    top: 4px;
}

.maplibregl-popup-close-button:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* Leaflet popups: remove default padding so the image touches the card edges */
.leaflet-container .custom-popup .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 0.375rem;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    max-width: 320px;
}

.leaflet-container .custom-popup .leaflet-popup-content {
    margin: 0;
    padding: 0;
    width: 320px;
}

.leaflet-container .custom-popup .leaflet-popup-close-button {
    right: 8px;
    top: 8px;
    width: 30px;
    height: 30px;
    color: #1e293b;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    opacity: 0.95;
}

.leaflet-container .custom-popup .leaflet-popup-close-button:hover {
    color: #0f172a;
    background: #fff;
    border-color: rgba(15, 23, 42, 0.15);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    opacity: 1;
}

.point-popup {
    font-size: 14px;
    max-width: 90vw;
}

@media (min-width: 576px) {
    .point-popup {
        max-width: 320px;
    }
}

.popup-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.popup-content {
    padding: 16px;
}

.popup-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #2c3e50;
}

/* Point type badges - ensure icons are visible and rounded pill shape */
.popup-content .badge,
.maplibregl-popup-content .badge,
.leaflet-popup-content .badge,
.leaflet-popup-content .popup-content .badge,
.custom-popup .badge {
    color: white;
    border-radius: 0.375rem !important;
    padding: 0.35em 0.65em !important;
    font-size: 0.85em;
    font-weight: 600;
}

.popup-content .badge svg {
    stroke: currentColor;
    fill: none;
}

/* Visit badge uses fill for camera body */
.popup-content .badge svg path[fill="currentColor"] {
    fill: currentColor;
}

/* Yellow badge needs dark text */
.popup-content .badge[style*="FFE66D"],
.popup-content .badge[style*="ffe66d"] {
    color: #1e293b;
}

.badge svg {
    vertical-align: middle;
    margin-right: 4px;
}

.badge[style*="--bs-badge-color: #000"] svg {
    stroke: #000;
    color: #000;
}

.popup-trip {
    font-size: 13px;
    color: #555;
}

.popup-date {
    font-size: 12px;
    color: #777;
}

.popup-description {
    font-size: 13px;
    color: #555;
    margin-top: 8px;
    margin-bottom: 8px;
    line-height: 1.5;
    max-height: 120px;
    overflow-y: auto;
}

.popup-coords {
    font-size: 11px;
    color: #999;
    margin-bottom: 0;
    font-family: 'Courier New', monospace;
}

.route-popup {
    padding: 8px 12px;
}

/* ========== MapLibre GL Controls ========== */
.maplibregl-ctrl-group {
    border-radius: 6px !important;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e2e8f0 !important;
}

.maplibregl-ctrl-group button {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(8px);
    border: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
    width: 32px !important;
    height: 32px !important;
    transition: all 0.15s ease !important;
}

.maplibregl-ctrl-group button:last-child {
    border-bottom: none !important;
}

.maplibregl-ctrl-group button:hover {
    background-color: #f1f5f9 !important;
}

.maplibregl-ctrl-group button:active {
    background-color: #e2e8f0 !important;
}

.maplibregl-ctrl-group button .maplibregl-ctrl-icon {
    filter: brightness(0.4);
}

/* Attribution */
.maplibregl-ctrl-attrib {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(4px);
    font-size: 10px !important;
    color: #94a3b8 !important;
    padding: 2px 6px !important;
}

.maplibregl-ctrl-attrib a {
    color: #64748b !important;
}

.maplibregl-ctrl-attrib a:hover {
    color: #1e293b !important;
}

/* MapLibre popup tip */
.maplibregl-popup-tip {
    border-top-color: white !important;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .floating-menu-toggle {
        top: 16px;
        left: 50px;
        padding: 10px 14px;
        font-size: 13px;
    }

    .floating-menu-toggle span {
        display: none;
    }

    .legend-card {
        bottom: 45px;
        right: 10px;
        font-size: 11px;
    }

    .legend-card .card-body {
        padding: 8px 10px;
    }

    .legend-line {
        width: 20px;
    }

    .offcanvas {
        width: 300px !important;
    }

    .popup-image {
        height: 150px;
    }
}

/* ========== Animaciones ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ========== Estilos para búsqueda de lugares ========== */
#publicSearchResults {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    margin-top: 4px;
}

#publicSearchResults .list-group-item {
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    padding: 10px 12px;
}

#publicSearchResults .list-group-item:hover {
    background-color: #f1f5f9;
    border-left-color: #1e293b;
    transform: translateX(3px);
}

#publicSearchResults .list-group-item:active {
    background-color: #e0e0e0;
}

#publicPlaceSearch:focus {
    border-color: #475569;
    box-shadow: 0 0 0 0.2rem rgba(30, 41, 59, 0.15);
}

/* ========== Utilidades ========== */
.bg-success-subtle {
    background-color: #d1e7dd !important;
    transition: background-color 0.5s ease;
}

/* ========== Print styles ========== */
@media print {

    .floating-menu-toggle,
    .offcanvas,
    .legend-card,
    .leaflet-control-zoom {
        display: none !important;
    }

    #map {
        position: relative;
        height: 100vh;
    }
}

/* ========== Footer ========== */
.map-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    padding: 8px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
    z-index: 999;
}

.map-footer span {
    font-weight: 400;
}

.map-footer .github-link {
    display: flex;
    align-items: center;
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 4px;
}

.map-footer .github-link:hover {
    color: #1e293b;
}

@media print {
    .map-footer {
        display: none !important;
    }
}

/* ========== Lightbox para imágenes ========== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: fadeIn 0.3s ease;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10001;
    backdrop-filter: blur(4px);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.lightbox-close:active {
    transform: scale(0.95);
}

.lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 95vh;
    object-fit: contain;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    animation: zoomIn 0.3s ease;
}

.lightbox-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Estilo para imágenes clicables en popups */
.popup-image {
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.popup-image:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

@media print {
    .lightbox {
        display: none !important;
    }
}