/* ============================================
   mGeo Sports - Custom Styles
   ============================================ */

:root {
    --primary-color: #4A6670;
    --primary-dark: #3a535c;
    --primary-light: #5a7680;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --bg-dark: #1a1a2e;
    --bg-card: #16213e;
    --bg-sidebar: #0f0f1a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: #2a2a4a;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    height: 100vh;
}

/* Navbar - mismo color que el fondo */
.navbar {
    background-color: var(--bg-dark) !important;
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 1px;
}

/* Sin efectos en el icono */
.navbar-brand img {
    /* Sin filter ni efectos */
}

/* Main Content */
.main-content {
    height: calc(100vh - 57px);
    padding: 0;
}

.main-content > .row {
    margin: 0;
    height: 100%;
}

.main-content > .row > [class*="col-"] {
    padding: 0;
}

/* Map Section - Left/Center area */
.map-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0 !important;
}

#map {
    flex: 1;
    min-height: 200px;
    background-color: #1a1a2e;
    z-index: 1;
}

/* Resize Handle */
.resize-handle {
    height: 8px;
    background-color: var(--bg-card);
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    border-top: 1px solid var(--border-color);
}

.resize-handle:hover {
    background-color: var(--primary-color);
}

.resize-handle-bar {
    width: 50px;
    height: 3px;
    background-color: var(--text-secondary);
    border-radius: 2px;
    transition: background-color 0.2s;
}

.resize-handle:hover .resize-handle-bar {
    background-color: white;
}

.resize-handle.dragging {
    background-color: var(--primary-color);
}

/* Elevation Profile - Below map */
.elevation-container {
    background-color: var(--bg-card);
    padding: 0.75rem 1rem;
    height: 120px;
    min-height: 80px;
    max-height: 400px;
}

.elevation-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Playback Controls */
.playback-controls {
    background: linear-gradient(180deg, rgba(15, 15, 26, 0.95) 0%, rgba(22, 33, 62, 0.98) 100%);
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
}

.controls-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.btn-control {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 2px solid var(--primary-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.btn-control:hover {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.btn-control.btn-play {
    width: 50px;
    height: 50px;
    font-size: 1.4rem;
    background-color: var(--primary-color);
    color: white;
}

.btn-control.btn-play:hover {
    background-color: var(--primary-dark);
}

.btn-control.btn-play.playing {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

/* Timeline */
.timeline-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.time-display {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    min-width: 65px;
}

.timeline-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--primary-color) 0%, var(--bg-card) 0%);
    border-radius: 3px;
    cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(74, 102, 112, 0.5);
    transition: transform 0.2s;
}

.timeline-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Speed Control */
.speed-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.8rem;
}

.speed-control label {
    color: var(--text-secondary);
    margin: 0;
}

.speed-slider {
    width: 100px;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-card);
    border-radius: 3px;
    cursor: pointer;
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--warning-color);
    border-radius: 50%;
    cursor: pointer;
}

#speedValue {
    min-width: 35px;
    color: var(--warning-color);
    font-weight: 600;
}

/* Stats Panel - Right side */
.stats-panel {
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

.stats-panel h6 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

/* Runners Section */
.runners-section {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.section-header h6 {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 0.85rem;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    padding: 1rem 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: rgba(74, 102, 112, 0.1);
    margin-bottom: 0.75rem;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--success-color);
    background-color: rgba(39, 174, 96, 0.1);
}

.drop-zone i {
    font-size: 1.5rem;
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.25rem;
}

.drop-zone p {
    margin: 0;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.drop-zone span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Runners List */
.runners-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 0.5rem;
}

.runner-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    margin-bottom: 0.4rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.runner-item:hover {
    background-color: rgba(74, 102, 112, 0.3);
}

.runner-item.leader {
    border-left-color: gold;
    background-color: rgba(255, 215, 0, 0.1);
}

.runner-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.runner-info {
    flex: 1;
    min-width: 0;
}

.runner-name {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.runner-stats {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.runner-actions {
    display: flex;
    gap: 0.2rem;
}

.runner-actions .btn {
    padding: 0.1rem 0.3rem;
    font-size: 0.7rem;
}

.runner-visibility {
    opacity: 0.5;
}

.runner-visibility.visible {
    opacity: 1;
    color: var(--success-color);
}

/* Stats Container */
.stats-container {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--primary-color);
}

/* Leaderboard */
.leaderboard-container {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.leaderboard {
    flex: 1;
    overflow-y: auto;
}

.leaderboard-empty {
    text-align: center;
    padding: 1.5rem 0.75rem;
    color: var(--text-secondary);
}

.leaderboard-empty i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.leaderboard-empty p {
    font-size: 0.75rem;
    margin: 0;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 0.4rem;
    margin-bottom: 0.3rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.leaderboard-entry.position-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 215, 0, 0.05) 100%);
    border-left: 3px solid gold;
}

.leaderboard-entry.position-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2) 0%, rgba(192, 192, 192, 0.05) 100%);
    border-left: 3px solid silver;
}

.leaderboard-entry.position-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2) 0%, rgba(205, 127, 50, 0.05) 100%);
    border-left: 3px solid #cd7f32;
}

.leaderboard-position {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.65rem;
    border-radius: 50%;
    background-color: var(--primary-color);
    margin-right: 0.4rem;
}

.leaderboard-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.4rem;
}

.leaderboard-name {
    flex: 1;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-distance {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-left: 0.4rem;
}

.leaderboard-speed {
    font-size: 0.6rem;
    color: var(--warning-color);
    margin-left: 0.4rem;
    min-width: 50px;
    text-align: right;
}

/* Modal customization */
.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
}

.modal-header {
    border-bottom-color: var(--border-color);
}

.modal-footer {
    border-top-color: var(--border-color);
}

.form-control {
    background-color: var(--bg-dark);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.form-control:focus {
    background-color: var(--bg-dark);
    border-color: var(--primary-color);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.2rem rgba(74, 102, 112, 0.25);
}

.form-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* Leaflet Custom Styles */
.leaflet-container {
    background-color: var(--bg-dark);
}

.runner-marker {
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease;
}

.runner-marker.leader {
    transform: scale(1.3);
    box-shadow: 0 0 15px gold;
}

.runner-popup {
    text-align: center;
}

.runner-popup h6 {
    margin: 0 0 5px 0;
    font-weight: 700;
}

.runner-popup p {
    margin: 0;
    font-size: 0.8rem;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .main-content {
        height: auto;
        overflow-y: auto;
    }

    .main-content > .row {
        height: auto;
        flex-direction: column;
    }

    .map-section {
        height: 60vh;
        min-height: 400px;
    }

    .stats-panel {
        height: auto;
        max-height: none;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .runners-list {
        max-height: 150px;
    }
}

@media (max-width: 767px) {
    .controls-row {
        gap: 0.3rem;
    }

    .btn-control {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }

    .btn-control.btn-play {
        width: 45px;
        height: 45px;
    }

    .elevation-container {
        height: 100px;
    }
}

/* Animation for loading */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s infinite;
}

/* Trail style for runners */
.runner-trail {
    stroke-linecap: round;
    stroke-linejoin: round;
}
