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

body {
    display: flex;
    height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#sidebar {
    width: 300px;
    padding: 20px;
    background: #1a1a2e;
    color: #eee;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

#sidebar.collapsed {
    transform: translateX(-300px);
}

#toggle-sidebar {
    position: fixed;
    bottom: 12px;
    left: 300px;
    z-index: 1001;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 0 6px 6px 0;
    background: #1a1a2e;
    color: #eee;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left 0.3s ease;
}

#toggle-sidebar.collapsed {
    left: 0;
}

#toggle-sidebar:hover {
    background: #e94560;
}

#sidebar h1 {
    font-size: 1.5rem;
    color: #e94560;
}

#upload-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#drop-zone {
    border: 2px dashed #444;
    border-radius: 8px;
    padding: 20px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.2s, background 0.2s;
    color: #aaa;
    font-size: 0.85rem;
}

#drop-zone.dragover {
    border-color: #e94560;
    background: rgba(233, 69, 96, 0.1);
}

#drop-zone.uploading {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.drop-or {
    color: #555;
    font-size: 0.75rem;
}

#file-label {
    display: inline-block;
    padding: 8px 16px;
    background: #e94560;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
}

#file-label:hover {
    background: #c73650;
}

#upload-section input[type="file"] {
    display: none;
}

#workouts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

hr.sidebar-divider {
    border: none;
    border-top: 1px solid #2a2a4a;
    margin: 20px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.section-header h3 {
    font-size: 0.95rem;
    color: #aaa;
    margin: 0;
}

.section-header button {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 6px;
}

.segment-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

#workouts-section h2,
#segment-section h3 {
    margin-bottom: 10px;
}

#segment-btn {
    padding: 8px;
    background: #0f3460;
    color: #eee;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

#segment-btn:hover {
    background: #1a4a8a;
}

#segment-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
}

#clear-segment-btn {
    padding: 6px;
    background: transparent;
    color: #888;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

#clear-segment-btn:hover {
    color: #e94560;
    border-color: #e94560;
}

#workouts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.workout-card {
    background: #16213e;
    border-radius: 6px;
    overflow: hidden;
}

.workout-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
}

.workout-card-header:hover {
    background: rgba(233, 69, 96, 0.1);
}

.workout-card-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.workout-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.workout-card-toggle {
    color: #aaa;
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.workout-card-toggle.expanded {
    transform: rotate(180deg);
}

.workout-card-stats {
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.workout-card-stats.open {
    display: flex;
}

.workout-card-remove {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
    line-height: 1;
}

.workout-card-remove:hover {
    color: #e94560;
}

.workout-card-eye {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: #555;
    transition: color 0.2s;
}

.workout-card-eye:hover {
    color: #999;
}

.workout-card-eye.active {
    color: #eee;
}

.workout-card-eye.active:hover {
    color: #fff;
}

.workout-card-eye.loading {
    animation: pulse 0.8s infinite;
}

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

.workout-card.disabled .workout-card-name {
    opacity: 0.4;
}

.workout-card.disabled .workout-card-stats {
    opacity: 0.4;
}

.stat {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.stat-label {
    color: #aaa;
    font-size: 0.82rem;
}

.stat-value {
    color: #eee;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Segment comparison */
#segment-section {
    background: #16213e;
    border-radius: 6px;
    padding: 12px;
}

#segment-section h3 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: #3b82f6;
}

#segment-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

#segment-table th {
    color: #888;
    font-weight: 500;
    text-align: right;
    padding: 4px 6px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

#segment-table th:first-child {
    text-align: left;
}

#segment-table td {
    text-align: right;
    padding: 5px 6px;
    color: #ddd;
}

#segment-table td:first-child {
    text-align: left;
}

#segment-table tr:nth-child(even) td {
    background: rgba(255,255,255,0.03);
}

#segment-table .best {
    color: #16c784;
    font-weight: 700;
}

.segment-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.hidden {
    display: none !important;
}

#main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#map {
    flex: 1;
}

#map.segment-mode {
    cursor: crosshair !important;
}

#elevation-panel {
    position: fixed;
    bottom: 0;
    left: 300px;
    right: 0;
    height: 150px;
    min-height: 80px;
    max-height: 50vh;
    padding: 8px 12px;
    background: #1a1a2e;
    border-top: 2px solid #e94560;
    z-index: 999;
    resize: vertical;
    overflow: hidden;
    transition: left 0.3s ease;
}
