/* ==========================================
   UMSS Campus Map - Frontend Styles
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

.umss-map-container {
    width: 100%;
    margin: 20px 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ==========================================
   Buscador
   ========================================== */
.umss-search-bar {
    background: #fff;
    padding: 20px;
    border:none;

    position: relative;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper .dashicons {
    position: absolute;
    left: 15px;
    color: #666;
    pointer-events: none;
    width: 20px;
    height: 20px;
    font-size: 20px;
}

#umss-location-search {
    width: 100%;
    padding: 12px 45px 12px 45px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

#umss-location-search:focus {
    outline: none;
    border-color: #021521;
    box-shadow: 0 0 0 3px rgba(2,21,33,0.1);
}

#clear-search {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

#clear-search:hover {
    color: #333;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 20px;
    right: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
}

.search-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f5f5f5;
}

.search-result-item h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 300;
    color: #333;
}

.search-result-item p {
    margin: 0;
    font-size: 12px;
    color: #666;
}

.search-result-category {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 5px;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* ==========================================
   Filtros
   ========================================== */
.umss-filters {
    background: #f2f2f2;
    padding: 25px;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.umss-filters h3 {
    margin: 0;
    color: #021521;
    font-size: 18px;
    font-weight: 600;
}

.map-layer-selector {
    position: relative;
}

.layer-btn {
    background: rgba(255,255,255,0.9);
    border: 2px solid #021521;
    color: #021521;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.layer-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.layer-btn .layer-current-name {
    font-weight: 400;
    color: #666;
}

.layer-btn .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.layer-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.layer-option {
    width: 100%;
    padding: 12px 15px;
    border: none;
    background: #fff;
    color: #333;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.layer-option:last-child {
    border-bottom: none;
}

.layer-option:hover {
    background: #f5f5f5;
}

.layer-option.active {
    background: #e3f2fd;
    color: #0073aa;
    font-weight: 600;
}

.layer-option .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s;
}

.layer-option.active .dashicons {
    opacity: 1;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid #021521;
    color: #021521;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
}

.filter-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.filter-btn.active {
    background: #fff;
    color: #fe2860;
    border-color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.filter-btn .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

/* ==========================================
   Mapa
   ========================================== */
#umss-map {
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: relative;
    z-index: 1;
}

/* Estilos de marcadores personalizados */
.custom-marker {
    background: transparent;
    border: none;
}

.marker-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border: 3px solid #fff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: markerBounce 0.6s ease;
}

.marker-icon::before {
    content: '';
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    transform: rotate(45deg);
}

@keyframes markerBounce {
    0%, 100% { transform: rotate(-45deg) translateY(0); }
    50% { transform: rotate(-45deg) translateY(-10px); }
}

/* Marcadores por categoría */
.marker-facultades .marker-icon {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
}

.marker-salud .marker-icon {
    background: linear-gradient(135deg, #E91E63 0%, #C2185B 100%);
}

.marker-investigacion .marker-icon {
    background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
}

.marker-provincias .marker-icon {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
}

.marker-general .marker-icon {
    background: linear-gradient(135deg, #607D8B 0%, #455A64 100%);
}

/* ==========================================
   Popup del marcador
   ========================================== */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    overflow: hidden;
    padding: 0;
}

.leaflet-popup-content {
    margin: 0;
    width: 320px !important;
}

.location-popup {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.popup-header {
    background: #f2f2f2;
    color: #021521;
    padding: 20px;
}

.popup-header h3 {
    margin: 0 0 5px 0;
    font-size: 20px;
    font-weight: 300;
}

.popup-header .subtitle {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.popup-image {
    position: relative;
    width: 100%;
    height: 180px;
    background: #f0f0f0;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.popup-image:hover {
    transform: scale(1.02);
}

.popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-image .gallery-indicator {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    backdrop-filter: blur(10px);
}

.popup-image .gallery-indicator .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.popup-body {
    padding: 20px;
}

.popup-description {
    margin: 0 0 20px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.popup-actions {
    display: flex;
    gap: 10px;
}

.popup-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: #fff;
}

.popup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-contact {
    background: #fe2860;
    color: #fff !important;
}

.btn-contact:hover {
    background: #fff;
    color: #fe2860 !important;
}

.btn-directions {
    background: #fff;
    border: 1px solid #021521;
    color:#021521 !important;
}

.btn-directions:hover {
    border: none;
    color: #fe2860 !important;
}

.popup-btn .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

/* ==========================================
   Modal de galería
   ========================================== */
.gallery-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.gallery-modal-content {
    position: relative;
    margin: auto;
    padding: 40px;
    width: 90%;
    max-width: 1200px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#gallery-modal-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.gallery-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #fff;
    font-size: 48px;
    font-weight: 300;
    cursor: pointer;
    z-index: 10001;
    transition: transform 0.3s ease;
}

.gallery-close:hover {
    transform: rotate(90deg);
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 10001;
}

.gallery-nav:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-50%) scale(1.1);
}

.gallery-prev {
    left: 40px;
}

.gallery-next {
    right: 40px;
}

.gallery-nav .dashicons {
    width: 24px;
    height: 24px;
    font-size: 24px;
}

.gallery-counter {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    z-index: 10001;
}

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 768px) {
    .umss-filters {
        padding: 20px;
    }
    
    .filters-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .map-layer-selector {
        width: 100%;
    }
    
    .layer-btn {
        width: 100%;
        justify-content: center;
    }
    
    .layer-dropdown {
        left: 0;
        right: 0;
    }
    
    .filter-buttons {
        gap: 8px;
    }
    
    .filter-btn {
        padding: 8px 15px;
        font-size: 13px;
    }
    
    .leaflet-popup-content {
        width: 280px !important;
    }
    
    .popup-actions {
        flex-direction: column;
    }
    
    .gallery-modal-content {
        padding: 20px;
    }
    
    .gallery-close {
        right: 20px;
        font-size: 36px;
    }
    
    .gallery-nav {
        padding: 10px 15px;
    }
    
    .gallery-prev {
        left: 20px;
    }
    
    .gallery-next {
        right: 20px;
    }
}

@media (max-width: 480px) {
    .filter-btn span {
        display: none;
    }
    
    .popup-header h3 {
        font-size: 18px;
    }
    
    .popup-btn {
        font-size: 13px;
        padding: 10px 15px;
    }
}

/* ==========================================
   Loading state
   ========================================== */
.umss-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.umss-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #021521;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================
   Notificaciones
   ========================================== */
.umss-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 10000;
    max-width: 400px;
    animation: slideInRight 0.3s ease;
    display: none;
    font-family: 'Inter', sans-serif;
}

.umss-notification.error {
    background: #ff4444;
    color: #fff;
}

.umss-notification.success {
    background: #4CAF50;
    color: #fff;
}

.umss-notification.warning {
    background: #FF9800;
    color: #fff;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .umss-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}
