:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-up: 0 -4px 20px rgba(0, 0, 0, 0.15);
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #f3f4f6;
    color: var(--text-main);
    overflow: hidden;
    /* Evita el scroll global por el mapa */
}

/* ---------------- HEADER LIGERO ---------------- */
.glass-header {
    position: absolute;
    top: 35px;
    left: 16px;
    right: 64px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.3);
    pointer-events: auto;
    /* Permitir interacción si se necesita */
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.header-text {
    display: flex;
    flex-direction: column;
}

.glass-header h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.glass-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ---------------- MAPA ---------------- */
#map {
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* ---------------- LOADER ---------------- */
.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.9);
    z-index: 50;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.loader-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ---------------- DRAWER / BOTTOM SHEET ---------------- */
.drawer-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.bottom-drawer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 85vh;
    /* No ocupar toda la pantalla */
    background: var(--bg-color);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 30;
    transform: translateY(100%);
    /* Oculto inicialmente */
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: var(--shadow-up);
    display: flex;
    flex-direction: column;
}

/* Centrado automático en web desktop */
@media (min-width: 768px) {
    .bottom-drawer {
        width: 400px;
        left: 50%;
        margin-left: -200px;
        bottom: 24px;
        border-radius: var(--radius-xl);
        transform: translateY(150%);
    }
}

.bottom-drawer.open {
    transform: translateY(0);
}

.drawer-handler {
    display: flex;
    justify-content: center;
    padding: 12px 0;
    cursor: grab;
}

.grabber {
    width: 40px;
    height: 5px;
    background-color: #d1d5db;
    border-radius: 10px;
}

.close-button {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s;
}

.close-button:hover {
    background: #e5e7eb;
    color: var(--text-main);
}

.drawer-content {
    padding: 0 24px 24px 24px;
    overflow-y: auto;
}

.chip {
    display: inline-block;
    padding: 4px 12px;
    background-color: #eff6ff;
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.drawer-content h2 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 24px;
    line-height: 1.3;
}

.info-list {
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
    border-bottom: none;
}

.info-icon {
    font-size: 1.25rem;
    background: #f9fafb;
    padding: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px var(--border-color);
}

.info-text {
    flex: 1;
}

.info-text small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-text p {
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.4;
}

.contact-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.contact-link:hover {
    text-decoration: underline;
}

.primary-btn {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
    transition: transform 0.1s, background-color 0.2s;
}

.primary-btn:active {
    transform: scale(0.98);
}

.primary-btn:hover {
    background-color: var(--primary-hover);
}

/* Custom styles for map markers (Opcional, si usamos AdvancedMarkers en JS) */
.custom-marker {
    background-color: var(--primary-color);
    color: white;
    padding: 8px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Estilo para las etiquetas de los nombres sobre los pines */
.map-label {
    text-shadow: 
        -1px -1px 0 #fff,  
         1px -1px 0 #fff,
        -1px  1px 0 #fff,
         1px  1px 0 #fff,
        -2px -2px 2px rgba(255,255,255,0.8),
         2px 2px 2px rgba(255,255,255,0.8);
    white-space: nowrap;
    pointer-events: none; /* Que no interfiera con el click en el pin */
}
.search-container {
    position: absolute;
    top: 105px;
    /* Debajo del header */
    left: 16px;
    right: 16px;
    z-index: 15;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    /* Dejar pasar clicks al mapa si no hay resultados */
}

@media (min-width: 768px) {
    .search-container {
        width: 450px;
        left: 16px;
        right: auto;
    }
}

.search-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-box:focus-within {
    box-shadow: var(--shadow-lg), 0 0 0 2px var(--primary-color);
}

.search-icon {
    font-size: 1.2rem;
    color: var(--text-muted);
}

#search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text-main);
    outline: none;
}

#search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.search-results {
    margin-top: 8px;
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 60vh;
    overflow-y: auto;
    pointer-events: auto;
    transition: opacity 0.2s, transform 0.2s;
    border: 1px solid var(--border-color);
}

.search-results.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.search-category {
    padding: 12px 16px 4px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    background: #f9fafb;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
}

.search-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background-color: #f3f4f6;
}

.search-item .name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

.search-item .address {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.no-results {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---------------- SEARCH ITEM ENHANCEMENTS ---------------- */
.search-item {
    display: flex;
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
    gap: 12px;
}

.search-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.search-item-logo,
.search-item-logo-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: #e5e7eb;
    color: var(--text-muted);
    font-size: 14px;
}

.search-item-info {
    display: flex;
    flex-direction: column;
}

.chip-mini {
    padding: 2px 8px;
    background: #dbffe6;
    /* Verde suave */
    color: #065f46;
    font-size: 8px;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
}

/* ---------------- DRAWER LOGO ---------------- */
.drawer-header-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.drawer-logo {
    position: relative;
    top: 16px;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: var(--shadow-md);
    background: white;
    border: 2px solid white;
}

.drawer-logo.hidden {
    display: none;
}

.drawer-title-group {
    flex: 1;
}

.drawer-title-group h2 {
    margin-bottom: 4px !important;
}

/* ---------------- TABS SYSTEM ---------------- */
.tabs-container {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.tab-btn.active {
    background-color: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ---------------- TALLERES TABLE ---------------- */
.talleres-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px var(--border-color);
}

.talleres-table th,
.talleres-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.talleres-table th {
    background-color: #f9fafb;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.talleres-table tr:last-child td {
    border-bottom: none;
}

.talleres-table .taller-name {
    font-weight: 600;
    color: var(--text-main);
}

.talleres-table .taller-schedule {
    color: var(--text-muted);
}

.no-talleres-msg {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

/* ---------------- FLOATING TALLERES BTN ---------------- */
.floating-btn-bottom-left {
    position: absolute;
    bottom: 30px;
    left: 16px;
    z-index: 10;
    background-color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    border: 1px solid var(--border-color);
}

@media (min-width: 768px) {
    .floating-btn-bottom-left {
        bottom: 30px;
        left: 20px;
    }
}

.floating-btn-bottom-left:hover {
    background-color: #f9fafb;
    transform: translateY(-2px);
}

.emergencias-btn {
    bottom: 85px;
    /* Arriba del de talleres */
    background-color: #fee2e2;
    /* Rojo muy suave */
    border-color: #fca5a5;
}

.emergencias-btn:hover {
    background-color: #fecaca;
}

.emergencias-btn .btn-text {
    color: #991b1b;
}

@media (min-width: 768px) {
    .emergencias-btn {
        bottom: 85px;
    }
}

/* ---------------- SEARCH ROW ---------------- */
.search-row {
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

.help-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-md);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.help-btn:hover {
    background: white;
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

/* ---------------- HELP OVERLAY ---------------- */
.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(1px);
    z-index: 200;
    transition: opacity 0.3s ease;
}

.help-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.help-content {
    position: relative;
    width: 100%;
    height: 100%;
}

.close-help {
    position: absolute;
    top: 24px;
    right: 24px;
    background: red;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
}

.help-step {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: white;
    max-width: 200px;
    text-align: center;
}

.help-arrow {
    font-size: 2rem;
    animation: bounce 2s infinite;
}

.help-text {
    background: white;
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
}

.main-help {
    font-size: 1.1rem;
    padding: 8px;
    border: 2px solid var(--primary-color);
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* ---------------- GLOBAL TALLERES OVERLAY ---------------- */
.global-talleres-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.global-talleres-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.global-talleres-content {
    background: white;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.global-talleres-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.global-talleres-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.global-talleres-search {
    padding: 12px 24px;
    background-color: #f9fafb;
    border-bottom: 1px solid var(--border-color);
}

#global-talleres-search-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    outline: none;
    font-size: 0.95rem;
}

#global-talleres-search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.global-talleres-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.global-taller-item {
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.global-taller-item:last-child {
    border-bottom: none;
}

.global-taller-item:hover {
    background-color: #f3f4f6;
}

.global-taller-name {
    font-weight: 600;
    color: var(--text-main);
    display: block;
    margin-bottom: 2px;
}

.global-taller-inst {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}