/* Estilos para el componente de running GPS */

.running-container {
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

/* ===================================
   SELECCIÓN DE RUNNING
   =================================== */

.running-selection {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.running-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #667eea; /* Fallback */
}

.page-subtitle {
    font-size: 1.125rem;
    opacity: 0.8;
}

/* Carrera libre - opciones rápidas */
.quick-start {
    padding: 1.5rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
}

.quick-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    border-radius: 12px;
    min-height: 80px;
}

.option-btn:hover {
    transform: translateY(-2px);
}

.option-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.option-text {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Planes de entrenamiento */
.running-plans {
    padding: 1.5rem;
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.plan-card {
    padding: 1rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.plan-card:hover {
    transform: translateY(-2px);
    border-color: #667eea;
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.plan-title {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.plan-level {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
}

.plan-level.beginner {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.plan-level.intermediate {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.plan-level.advanced {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.plan-description {
    font-size: 0.875rem;
    opacity: 0.8;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.plan-stats {
    display: flex;
    gap: 1rem;
}

.stat {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Estado GPS */
.gps-status {
    padding: 1.5rem;
}

.gps-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.gps-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.gps-indicator.gps-searching {
    background: #6b7280;
}

.gps-indicator.gps-excellent {
    background: #22c55e;
}

.gps-indicator.gps-good {
    background: #3b82f6;
}

.gps-indicator.gps-fair {
    background: #f59e0b;
}

.gps-indicator.gps-poor {
    background: #ef4444;
}

.gps-text {
    font-size: 0.875rem;
    font-weight: 500;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===================================
   CARRERA ACTIVA
   =================================== */

.active-run {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Controles de carrera */
.run-header {
    padding: 1rem;
}

.run-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.control-btn:hover {
    transform: scale(1.1);
}

.control-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.control-icon {
    font-size: 1.5rem;
}

/* Métricas principales */
.main-metrics {
    padding: 1.5rem;
}

.metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.metric-item {
    text-align: center;
}

.main-metric .metric-label {
    font-size: 0.875rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.main-metric .metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #667eea; /* Fallback */
}

.pace-display {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pace-label {
    font-size: 0.875rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.pace-value {
    font-size: 2rem;
    font-weight: 600;
    color: #667eea;
}

/* Métricas secundarias */
.secondary-metrics {
    padding: 1rem;
}

.metric-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.metric-item .metric-label {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

.metric-item .metric-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

/* Mapa */
.map-container {
    padding: 0;
    overflow: hidden;
    position: relative;
}

.run-map {
    width: 100%;
    height: 300px;
    border-radius: 16px;
}

.map-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 1000;
    pointer-events: none;
}

.map-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.map-stat {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.map-stat-icon {
    margin-right: 0.25rem;
}

/* Splits */
.splits-container {
    padding: 1rem;
}

.splits-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.splits-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.split-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    align-items: center;
}

.split-item:last-child {
    border-bottom: none;
}

.split-km {
    font-weight: 600;
    color: #667eea;
    font-size: 0.875rem;
}

.split-time {
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
}

.split-duration {
    font-size: 0.875rem;
    opacity: 0.8;
    text-align: right;
}

/* ===================================
   CARRERA FINALIZADA
   =================================== */

.finished-run {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.finish-header {
    text-align: center;
    padding: 2rem 1rem;
}

.finish-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.finish-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #667eea; /* Fallback */
}

.finish-subtitle {
    font-size: 1.125rem;
    opacity: 0.8;
}

/* Resumen de la carrera */
.run-summary {
    padding: 1.5rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.summary-stat {
    text-align: center;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.stat-value.large {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #667eea; /* Fallback */
}

/* Mapa de resultados */
.results-map {
    padding: 0;
    overflow: hidden;
}

.results-map #results-map {
    width: 100%;
    height: 250px;
    border-radius: 16px;
}

/* Marcadores del mapa */
.start-marker,
.end-marker {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.marker-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.user-marker {
    background: transparent;
    border: none;
    box-shadow: none;
}

.user-dot {
    width: 16px;
    height: 16px;
    background: #667eea;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: pulse 2s infinite;
}

.split-marker {
    background: transparent;
    border: none;
}

.split-marker-inner {
    background: #f59e0b;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Popup de splits */
.split-popup {
    font-size: 0.875rem;
    line-height: 1.4;
}

.split-popup strong {
    color: #667eea;
}

/* Error de mapa */
.map-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
}

.map-error p {
    margin: 0.25rem 0;
}

/* Acciones finales */
.finish-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 1rem;
}

.finish-actions .glass-button {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 768px) {
    .running-container {
        padding: 0.5rem;
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    .quick-options {
        grid-template-columns: 1fr;
    }
    
    .plans-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-grid {
        gap: 1rem;
    }
    
    .main-metric .metric-value {
        font-size: 2rem;
    }
    
    .metric-grid-2 {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-value.large {
        font-size: 1.75rem;
    }
    
    .run-map {
        height: 250px;
    }
    
    .results-map #results-map {
        height: 200px;
    }
    
    .map-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .map-stat {
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    .run-controls {
        gap: 0.5rem;
    }
    
    .control-btn {
        width: 50px;
        height: 50px;
    }
    
    .control-icon {
        font-size: 1.25rem;
    }
    
    .main-metric .metric-value {
        font-size: 1.75rem;
    }
    
    .pace-value {
        font-size: 1.5rem;
    }
    
    .finish-icon {
        font-size: 3rem;
    }
    
    .finish-title {
        font-size: 1.5rem;
    }
}

/* ===================================
   ANIMACIONES
   =================================== */

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.glass-fade-in {
    animation: slideInUp 0.6s ease-out;
}

/* Estados de botones */
.glass-button:active {
    transform: scale(0.98);
}

.option-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .option-btn,
    .plan-card,
    .control-btn,
    .glass-fade-in {
        transition: none;
        animation: none;
    }
    
    .gps-indicator,
    .user-dot {
        animation: none;
    }
}

/* Alto contraste */
@media (prefers-contrast: high) {
    .plan-card {
        border-color: rgba(255, 255, 255, 0.3);
    }
    
    .plan-card:hover {
        border-color: #ffffff;
    }
    
    .page-title,
    .finish-title,
    .main-metric .metric-value,
    .stat-value.large {
        color: #ffffff;
    }
}