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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

h1 {
    text-align: left;
    font-size: 2.2rem;
    margin-bottom: 5px;
    background: linear-gradient(90deg, #ff6b35, #f7931e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    text-align: left;
    color: #888;
    margin-bottom: 10px;
}

/* Activity Input Section */
.activity-section {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.activity-section label {
    font-weight: 600;
    color: #f7931e;
}

.activity-section input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #333;
    border-radius: 8px;
    background: #1a1a2e;
    color: #fff;
    font-size: 1rem;
}

.activity-section input:focus {
    outline: none;
    border-color: #f7931e;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(90deg, #ff6b35, #f7931e);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(247, 147, 30, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.fit-upload-label {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(90deg, #1976d2, #1565c0);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
}
.fit-upload-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(79, 195, 247, 0.4);
}

.activity-info {
    color: #888;
    font-size: 0.9rem;
}

.activity-info.success {
    color: #4caf50;
}

/* Auth header */
.back-link {
    color: #4fc3f7;
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 8px;
}

.back-link:hover {
    text-decoration: underline;
}

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

.auth-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-status {
    font-size: 0.9rem;
    color: #888;
}

.auth-status.logged-in {
    color: #4caf50;
}

.btn-auth {
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: 6px;
    border: 2px solid #f7931e;
    background: transparent;
    color: #f7931e;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-auth:hover {
    background: #f7931e;
    color: #1a1a2e;
}

.btn-auth.logout {
    border-color: #666;
    color: #666;
}

.btn-auth.logout:hover {
    background: #666;
    color: #fff;
}

.activity-info.error {
    color: #f44336;
}

/* Time Range Slider */
.time-range-container {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 30px;
    display: none;
}

.time-range-container.visible {
    display: block;
}

.time-range-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.time-range-header label {
    font-weight: 600;
    color: #f7931e;
    font-size: 0.95rem;
}

.time-range-values {
    font-size: 0.9rem;
    color: #ccc;
}

.time-range-values span {
    color: #4fc3f7;
    font-weight: 600;
}

.dual-range {
    position: relative;
    height: 36px;
    margin: 0 8px;
}

.dual-range input[type="range"] {
    position: absolute;
    width: 100%;
    top: 0;
    height: 36px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
}

.dual-range input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: transparent;
}

.dual-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f7931e;
    border: 2px solid #fff;
    cursor: pointer;
    pointer-events: auto;
    margin-top: -7px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: transform 0.15s;
}

.dual-range input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.dual-range input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f7931e;
    border: 2px solid #fff;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.dual-range input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: transparent;
}

.range-track {
    position: absolute;
    top: 15px;
    left: 0;
    right: 0;
    height: 6px;
    border-radius: 3px;
    background: #333;
}

.range-track-fill {
    position: absolute;
    top: 15px;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, #ff6b35, #f7931e);
}

.time-range-points {
    font-size: 0.8rem;
    color: #888;
    text-align: right;
    margin-top: 4px;
}

/* Bike Panels */
.bike-panels {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1000px) {
    .bike-panels {
        grid-template-columns: 1fr;
    }
    .comparison-arrows {
        display: none;
    }
}

.bike-panel {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 24px;
}

.bike-panel h2 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bike-panel.actual h2 {
    color: #4fc3f7;
}

.bike-panel.alternative h2 {
    color: #ff6b35;
}

.bike-icon {
    font-size: 1.8rem;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 6px;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #333;
    border-radius: 6px;
    background: #1a1a2e;
    color: #fff;
    font-size: 0.95rem;
}

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

.stats-box {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.stats-row:last-child {
    border-bottom: none;
}

.stats-label {
    color: #888;
}

.stats-value {
    font-weight: 600;
    font-family: monospace;
    font-size: 1.1rem;
}

.stats-value.cd {
    color: #4fc3f7;
}

.stats-value.weight {
    color: #81c784;
}

/* Comparison Arrows */
.comparison-arrows {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-size: 2rem;
    color: #666;
}

/* Rider Section */
.rider-section {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.rider-section > h3 {
    color: #f7931e;
    margin-bottom: 16px;
}

.rider-panels {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
}

@media (max-width: 1000px) {
    .rider-panels {
        grid-template-columns: 1fr;
    }
    .rider-copy-arrows {
        flex-direction: row !important;
    }
}

.rider-copy-arrows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.rider-panel {
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 16px;
}

.rider-panel h4 {
    margin-bottom: 12px;
    font-size: 1rem;
}

.rider-panel.actual h4 {
    color: #4fc3f7;
}

.rider-panel.alternative h4 {
    color: #ff6b35;
}

.btn-use-my-stats {
    background: rgba(255,255,255,0.1);
    border: 1px solid #555;
    color: #aaa;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    margin-left: 8px;
    vertical-align: middle;
}

.btn-use-my-stats:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.btn-copy {
    background: rgba(255,255,255,0.08);
    border: 1px solid #444;
    color: #aaa;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-color: #888;
}

.btn-use-bike {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    border: none;
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
}

.btn-use-bike:hover {
    opacity: 0.85;
}

.rider-input {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.rider-input:last-child {
    margin-bottom: 0;
}

.rider-input label {
    color: #aaa;
    min-width: 55px;
}

.rider-input input {
    width: 80px;
    padding: 8px 12px;
    border: 2px solid #333;
    border-radius: 6px;
    background: #1a1a2e;
    color: #fff;
    text-align: center;
}

.rider-input span {
    color: #666;
}

.rider-input .frontal-area-value {
    color: #81c784;
    font-family: monospace;
    font-weight: 600;
}

/* Results Section */
.results-section {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
}

.results-section h2 {
    color: #f7931e;
    margin-bottom: 20px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.summary-card .value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.summary-card .label {
    color: #888;
    font-size: 0.9rem;
}

.summary-card.positive .value {
    color: #f44336;
}

.summary-card.negative .value {
    color: #4caf50;
}

.summary-card.neutral .value {
    color: #fff;
}

/* Charts */
.chart-container {
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.chart-container h3 {
    color: #aaa;
    font-size: 1rem;
    margin-bottom: 15px;
}

.chart-wrapper {
    position: relative;
    height: 300px;
}

/* Speed Comparison Table */
.speed-table-section {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
}

.speed-table-section h2 {
    color: #f7931e;
    margin-bottom: 10px;
}

.speed-table-section p {
    color: #888;
    margin-bottom: 20px;
}

.speed-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.speed-table th,
.speed-table td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.speed-table th {
    background: rgba(0,0,0,0.3);
    color: #f7931e;
    font-weight: 600;
}

.speed-table tr:hover {
    background: rgba(255,255,255,0.05);
}

.speed-table .faster {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
    font-weight: 600;
}

.speed-table .slower {
    background: rgba(244, 67, 54, 0.2);
    color: #ef5350;
}

.hidden {
    display: none;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #f7931e;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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