/* ABOUTME: Main stylesheet for virtual journey sports tracker */
/* ABOUTME: Provides responsive layout and styling for all components */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}





.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

button {
    background: #667eea;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background: #5a67d8;
}

button:active {
    background: #4c51bf;
}





.activities-container {
    max-height: 120px;
    overflow-y: auto;
    background: transparent;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: transparent;
    margin: 0;
    font-size: 14px;
}


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

/* Remove bottom border from activities container */
.activities-container {
    border-bottom: none;
}


.activity-distance {
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.activity-number {
    display: inline-block;
    background: #667eea;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    margin-right: 8px;
    min-width: 20px;
    text-align: center;
}

.activity-date {
    color: #666;
    font-size: 14px;
}

.no-activities {
    padding: 40px;
    text-align: center;
    color: #666;
    font-style: italic;
}

#map {
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
    /* Performance optimizations */
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    display: none; /* Hidden by default until auth loads */
}

/* Responsive Design */
@media (max-width: 768px) {
    .floating-header {
        left: 10px;
        right: 80px; /* Leave space for zoom controls */
        top: 10px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 8px 12px;
        min-height: 40px;
    }

    .floating-header h1 {
        font-size: 1.1em;
        margin: 0;
        flex: 1;
    }

    .logout-btn {
        font-size: 10px;
        padding: 4px 6px;
        flex-shrink: 0;
        margin-left: 10px;
    }


    .floating-panel {
        left: 10px !important;
        right: 10px !important;
        min-width: auto;
        max-width: none;
    }


    .activity-table {
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        max-width: calc(100% - 20px);
        width: calc(100% - 20px);
    }

    .activities-container {
        max-height: 100px;
    }

    .panel-content {
        padding: 15px;
    }

}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #667eea;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pulsing dot animation for progress marker */
.progress-pulse {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    background: #00ff00 !important;
    position: relative !important;
    animation: pulse 1.5s ease-in-out infinite !important;
    box-shadow: 0 0 0 0 rgba(0, 255, 0, 0.7) !important;
    border: 2px solid #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

.progress-pulse::before {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 6px !important;
    height: 6px !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    transform: translate(-50%, -50%) !important;
}

@keyframes pulse {
    0% {
        transform: scale(1) !important;
        box-shadow: 0 0 0 0 rgba(0, 255, 0, 0.7) !important;
    }
    50% {
        transform: scale(1.2) !important;
        box-shadow: 0 0 0 15px rgba(0, 255, 0, 0) !important;
    }
    100% {
        transform: scale(1) !important;
        box-shadow: 0 0 0 0 rgba(0, 255, 0, 0) !important;
    }
}


/* Activity markers on the map */
.activity-marker {
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    background: #667eea !important;
    color: white !important;
    border: 2px solid #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
}

.user-marker {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    border: 3px solid #fff !important;
    box-shadow: 0 3px 6px rgba(0,0,0,0.3) !important;
    cursor: pointer !important;
    position: relative !important;
}

.user-marker-text {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    color: white !important;
    font-size: 24px !important;
    font-weight: bold !important;
    line-height: 1 !important;
    pointer-events: none !important;
}

.other-user-marker {
    background: #10b981 !important;
}

.current-user-marker {
    background: #ffffff !important;
}


/* Floating Layout Styles */
.floating-header {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 80px; /* Leave space for zoom controls */
    z-index: 999;
    text-align: left;
}

.floating-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.floating-header h1 {
    color: #333;
    font-size: 1.2em;
    margin: 0;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
}

.logout-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border: 1px solid #667eea;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: none; /* Hidden for now */
}

.logout-btn:hover {
    background: #667eea;
    color: white;
}

/* Ensure map controls are above other elements and work properly */
.leaflet-control-zoom {
    z-index: 9999 !important;
    position: relative !important;
}

.leaflet-control-zoom a {
    background-color: white !important;
    color: black !important;
    text-decoration: none !important;
    display: block !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

.leaflet-control-zoom a:hover {
    background-color: #f4f4f4 !important;
}

.floating-panel {
    position: fixed;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 300px;
    max-width: 400px;
    transition: all 0.3s ease;
}


/* Minimalistic Activity Table */
.activity-table {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(calc(100% - 95px)); /* Slide out, show only input */
    max-width: 350px;
    width: calc(100% - 40px);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
    padding: 12px;
    transition: transform 0.3s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.activity-table.expanded {
    transform: translateX(-50%) translateY(0);
}

/* Panel Chevron */
.panel-chevron {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border-radius: 2px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.chevron-icon {
    font-size: 14px;
    font-weight: bold;
    color: #999;
    transition: transform 0.3s ease;
    line-height: 1;
}

.activity-table:not(.expanded) .chevron-icon {
    transform: rotate(0deg);
}

.activity-table.expanded .chevron-icon {
    transform: rotate(180deg);
}

/* Compact Activity Input */
.activity-input {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.activity-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.8);
    outline: none;
}

.activity-input input:focus {
    border-color: #667eea;
    background: white;
}

.activity-input button {
    padding: 8px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    min-width: 40px;
}

.activity-input button:hover {
    background: #5a67d8;
}

.activity-input button:active {
    background: #4c51bf;
}

/* Distance Summary */
.distance-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    gap: 12px;
}

.distance-info {
    display: flex;
    flex-direction: column;
}

.distance-info:last-child {
    align-items: flex-end;
}

.distance-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.distance-value {
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.distance-info:first-child .distance-value {
    color: #667eea;
}

.distance-info:last-child .distance-value {
    color: #333;
}

/* Progress Bar */
.progress-bar-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-bar {
    width: calc(100% - 20px);
    height: 7px;
    background-color: #ddd;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: #667eea;
    width: 0%;
    transition: width 0.3s ease;
}



/* Auth Modal Styles */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    z-index: 10000;
    display: none; /* Hidden by default until auth loads */
}

.auth-container {
    background: white;
    border-radius: 16px;
    padding: 32px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-header h2 {
    color: #333;
    margin: 0 0 8px 0;
    font-size: 1.8em;
    font-weight: 600;
}

.auth-header p {
    color: #666;
    margin: 0;
    font-size: 0.9em;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    margin-bottom: 0;
    gap: 16px;
    justify-content: center;
}

.auth-tab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    position: relative;
    border-radius: 4px 4px 0 0;
}

.auth-tab.active {
    background: transparent;
    color: #495057;
    border-bottom-color: #667eea;
}

.auth-tab:hover:not(.active) {
    color: #495057;
    background: rgba(102, 126, 234, 0.05);
}

.auth-form {
    display: none;
    padding-top: 24px;
}

.auth-form.active {
    display: block;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.auth-form input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-btn {
    width: 100%;
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-bottom: 16px;
}

.auth-btn:hover {
    background: #5a67d8;
}

.auth-btn:active {
    background: #4c51bf;
}

.auth-error {
    color: #e53e3e;
    font-size: 14px;
    text-align: center;
    display: none;
}

.auth-success {
    color: #38a169;
    font-size: 14px;
    text-align: center;
    display: none;
}

/* Hide main app when not authenticated */
.auth-required {
    display: none;
}

/* Map Attribution */
.map-attribution {
    text-align: center;
    padding-top: 12px;
    color: #666;
    border-top: 1px solid #e5e5e5;
}

.map-attribution a {
    color: #666;
    text-decoration: underline;
}

.map-attribution a:hover {
    color: #333;
    text-decoration: underline;
}

/* Player tooltip/HUD styles */
.player-tooltip-name-above {
    position: absolute;
    color: black;
    font-size: 16px;
    line-height: 1.4;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    left: 50%;
    top: -3px;
    transform: translateX(-50%) translateY(-100%);
    display: none;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 
        0px 0px 3px rgba(255, 255, 255, 1),
        0px 0px 6px rgba(255, 255, 255, 0.9),
        0px 0px 10px rgba(255, 255, 255, 0.7),
        0px 0px 16px rgba(255, 255, 255, 0.5);
    text-align: center;
}

.player-tooltip-stats-below {
    position: absolute;
    color: black;
    font-size: 13px;
    line-height: 1.4;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    left: 50%;
    bottom: -3px;
    transform: translateX(-50%) translateY(100%);
    display: none;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-shadow: 
        0px 0px 3px rgba(255, 255, 255, 1),
        0px 0px 6px rgba(255, 255, 255, 0.9),
        0px 0px 10px rgba(255, 255, 255, 0.7),
        0px 0px 16px rgba(255, 255, 255, 0.5);
    text-align: center;
    color: #222;
}

.player-tooltip-name-above.visible,
.player-tooltip-stats-below.visible {
    opacity: 1;
    display: block;
}

.user-marker-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}


