/* ==========================================================================
   ViaComodoro - Rutas Geolocalizadas — Frontend CSS
   ========================================================================== */

/* Widget Container */
.vcrg-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
    background: #fff;
    margin: 24px 0;
}

/* Header */
.vcrg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563EB 100%);
    color: #fff;
    gap: 12px;
}

.vcrg-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.vcrg-pulse-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4ADE80;
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4);
    animation: vcrgPulse 2s infinite;
    flex-shrink: 0;
}

@keyframes vcrgPulse {
    0%   { box-shadow: 0 0 0 0 rgba(74,222,128,0.4); }
    70%  { box-shadow: 0 0 0 10px rgba(74,222,128,0); }
    100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}

.vcrg-titulo {
    margin: 0 0 2px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.vcrg-subtitulo {
    margin: 0;
    font-size: 13px;
    color: rgba(255,255,255,0.82);
    line-height: 1.4;
}

.vcrg-btn-gps {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.vcrg-btn-gps:hover {
    background: rgba(255,255,255,0.25);
}

/* Status badge */
.vcrg-status { display: inline-block; }
.vcrg-status-ok   strong { font-weight: 700; }
.vcrg-status-warn { color: #FCD34D; }
.vcrg-status-info { color: rgba(255,255,255,0.75); }

/* Loading dots animation */
.vcrg-loading-dots span {
    animation: vcrgBlink 1.4s infinite;
}
.vcrg-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.vcrg-loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes vcrgBlink {
    0%, 80%, 100% { opacity: 0; }
    40%           { opacity: 1; }
}

/* Map container */
.vcrg-map-container {
    position: relative;
}

.vcrg-map {
    width: 100%;
    min-height: 300px;
    background: #e8f0f7;
}

/* Map overlay (loading state) */
.vcrg-map-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.4s;
}

.vcrg-overlay-spinner {
    text-align: center;
    color: #2563EB;
}

.vcrg-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563EB;
    border-radius: 50%;
    animation: vcrgSpin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes vcrgSpin {
    to { transform: rotate(360deg); }
}

/* Markers */
.vcrg-marker-origen {
    position: relative;
    width: 40px;
    height: 40px;
}

.vcrg-marker-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(37,99,235,0.3);
    animation: vcrgPulse 2s infinite;
}

.vcrg-marker-dot {
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: #2563EB;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,0.5);
}

.vcrg-marker-destino {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color, #3B82F6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    border: 2.5px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.15s;
}
.vcrg-marker-destino:hover { transform: scale(1.15); }

/* Leaflet popup */
.vcrg-popup {
    font-family: inherit;
    font-size: 13px;
    line-height: 1.6;
    min-width: 160px;
}
.vcrg-popup strong { display: block; margin-bottom: 3px; font-size: 14px; }
.vcrg-popup-link {
    display: inline-block;
    margin-top: 8px;
    color: #2563EB;
    font-weight: 600;
    text-decoration: none;
}
.vcrg-popup-link:hover { text-decoration: underline; }

/* Rutas list */
.vcrg-rutas-list {
    padding: 20px;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
}

.vcrg-rutas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.vcrg-ruta-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border-radius: 12px;
    border: 1.5px solid #e5e7eb;
    border-left: 4px solid var(--card-color, #3B82F6);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    cursor: pointer;
}
.vcrg-ruta-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.09);
    border-color: var(--card-color, #3B82F6);
}

.vcrg-card-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.vcrg-card-body {
    flex: 1;
    min-width: 0;
}

.vcrg-card-ruta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    flex-wrap: wrap;
}

.vcrg-origen { color: #1e293b; }
.vcrg-arrow  { color: #94a3b8; font-size: 12px; }
.vcrg-destino { color: #2563EB; }

.vcrg-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 5px;
}

.vcrg-tag {
    font-size: 11px;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 7px;
    border-radius: 4px;
}

.vcrg-precio {
    font-size: 12px;
    font-weight: 700;
    color: #16a34a;
}

.vcrg-card-cta {
    font-size: 12px;
    font-weight: 700;
    color: var(--card-color, #3B82F6);
    flex-shrink: 0;
}

/* Placeholder cards */
.vcrg-list-placeholder {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.vcrg-placeholder-item {
    height: 68px;
    border-radius: 12px;
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 400% 100%;
    animation: vcrgShimmer 1.4s ease infinite;
}

@keyframes vcrgShimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.vcrg-no-rutas {
    text-align: center;
    color: #94a3b8;
    padding: 24px;
    font-size: 14px;
}

/* Solo lista */
.vcrg-solo-lista {
    box-shadow: none;
    border-radius: 0;
    background: transparent;
}
.vcrg-solo-lista .vcrg-rutas-list {
    background: transparent;
    border: none;
    padding: 0;
}

/* Responsive */
@media (max-width: 600px) {
    .vcrg-header { padding: 14px 16px; }
    .vcrg-titulo { font-size: 14px; }
    .vcrg-rutas-grid { grid-template-columns: 1fr; }
    .vcrg-btn-gps { display: none; }
}

/* ==========================================================================
   Geo-Rows: filas integradas en la tabla de rutas populares
   ========================================================================== */

.ruta-row.geo-row {
    /* hereda todos los estilos de .ruta-row del HTML */
    border-left: 3px solid #f97316; /* naranja = geo-localizada */
}

.vcrg-geo-label {
    animation: vcrgFadeIn 0.4s ease;
}

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

.geo-row {
    animation: vcrgFadeIn 0.35s ease both;
}
.geo-row:nth-child(2) { animation-delay: 0.05s; }
.geo-row:nth-child(3) { animation-delay: 0.10s; }
.geo-row:nth-child(4) { animation-delay: 0.15s; }
.geo-row:nth-child(5) { animation-delay: 0.20s; }
.geo-row:nth-child(6) { animation-delay: 0.25s; }
