/* Trail Predict - Clean, minimal trail running aesthetic */

:root {
    --primary: #d35400;
    --primary-light: #e67e22;
    --accent: #2c3e50;
    --accent-light: #34495e;
    --bg: #fafafa;
    --bg-card: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --border: #e0e0e0;
    --border-light: #f0f0f0;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
    --radius: 6px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); text-decoration: underline; }

/* Nav */
nav {
    background: var(--primary);
    color: white;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

nav .brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    letter-spacing: -0.5px;
}

nav .nav-container { display: flex; align-items: center; gap: 1rem; width: 100%; }
nav .nav-links { display: flex; gap: 0.25rem; align-items: center; list-style: none; flex: 1; }
nav .nav-links li { list-style: none; }
nav .nav-links .nav-spacer { flex: 1; }
nav .nav-links a { color: rgba(255,255,255,0.85); font-size: 0.85rem; text-decoration: none; padding: 0.45rem 0.9rem; border: 1px solid rgba(255,255,255,0.25); border-radius: var(--radius); transition: background 0.15s, border-color 0.15s; }
nav .nav-links a:hover { color: white; text-decoration: none; background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.5); }

/* Main content */
main {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2, .card h3 {
    margin-bottom: 1rem;
    color: var(--primary);
}

/* Grid */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Stats */
.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    text-align: center;
}
.stat-box .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.stat-box .stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Big time triptych */
.time-triptych {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr;
    gap: 1rem;
    margin: 2rem 0;
}
.time-block {
    text-align: center;
    padding: 1.5rem 1rem;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: var(--bg-card);
}
.time-block .time-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.time-block .time-value {
    display: block;
    font-weight: 800;
    letter-spacing: -1px;
}
.time-block.time-optimistic {
    border-color: #27ae60;
    background: #f0faf4;
}
.time-block.time-optimistic .time-value { font-size: 2rem; color: #1e8449; }
.time-block.time-central {
    border-color: var(--primary);
    background: linear-gradient(135deg, #fff5ee, #fff0e0);
    box-shadow: 0 4px 16px rgba(211,84,0,0.12);
}
.time-block.time-central .time-value { font-size: 3.2rem; color: var(--primary); }
.time-block.time-central .time-label { color: var(--primary); }
.time-block.time-conservative {
    border-color: #e74c3c;
    background: #fdf2f0;
}
.time-block.time-conservative .time-value { font-size: 2rem; color: #c0392b; }
@media (max-width: 768px) {
    .time-triptych { grid-template-columns: 1fr; }
    .time-block.time-central .time-value { font-size: 2.5rem; }
}

/* Progress bars */
.progress-bar {
    background: var(--border-light);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    margin: 0.3rem 0 0.8rem;
}
.progress-bar .fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
    /* Color set via inline style using --score variable */
    background: var(--bar-color, var(--primary));
}
.progress-bar .fill.accent { background: var(--accent); }
.progress-bar .fill.gradient { background: linear-gradient(90deg, #e67e22, #d35400, #27ae60); }

.score-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}
.score-label .score-name { font-weight: 500; }
.score-label .score-value { color: var(--text-muted); }

/* Confidence */
.confidence { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 12px; font-size: 0.85rem; font-weight: 600; }
.confidence.high { background: #d5f5e3; color: #1e8449; }
.confidence.medium { background: #fef9e7; color: #b7950b; }
.confidence.low { background: #fadbd8; color: #c0392b; }
.confidence-cards { display: flex; gap: 1rem; }
.confidence-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.confidence-label { font-size: 0.85rem; color: var(--text-muted); }

/* Freshness */
.freshness { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 12px; font-size: 0.85rem; font-weight: 600; }
.freshness.rested { background: #d5f5e3; color: #1e8449; }
.freshness.neutral { background: #fef9e7; color: #b7950b; }
.freshness.fatigued { background: #fadbd8; color: #c0392b; }

/* Impact indicators */
.impact { font-weight: 600; }
.impact.positive { color: var(--success); }
.impact.negative { color: var(--danger); }
.impact.neutral { color: var(--text-muted); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { background: var(--bg); text-align: left; padding: 0.6rem 0.8rem; font-weight: 600; color: var(--text-light); border-bottom: 2px solid var(--border); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.3px; }
td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border-light); }
tr:hover td { background: var(--border-light); }

/* Segment type badges */
.seg-type {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
}
.seg-type.climb { background: #fadbd8; color: #c0392b; }
.seg-type.steep_climb { background: #e74c3c; color: white; }
.seg-type.rolling { background: #d5f5e3; color: #1e8449; }
.seg-type.false_flat { background: #fef9e7; color: #b7950b; }
.seg-type.descent { background: #d4efdf; color: #1e8449; }
.seg-type.steep_descent { background: #2ecc71; color: white; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-weight: 500; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(230,126,34,0.2);
}
.form-group .hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-fieldset { flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 1rem; margin: 0; }
.form-fieldset legend { font-size: 0.85rem; font-weight: 600; padding: 0 0.4rem; }
.form-fieldset--sv1 { background: rgba(52, 152, 219, 0.08); border-color: rgba(52, 152, 219, 0.3); }
.form-fieldset--sv1 legend { color: #2980b9; }
.form-fieldset--sv2 { background: rgba(230, 126, 34, 0.08); border-color: rgba(230, 126, 34, 0.3); }
.form-fieldset--sv2 legend { color: #d35400; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); color: white; text-decoration: none; }
.btn-accent { background: var(--primary); color: white; }
.btn-accent:hover { background: var(--primary-light); color: white; text-decoration: none; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; text-decoration: none; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; color: white; text-decoration: none; }
.btn-icon { background: none; border: none; cursor: pointer; padding: 0.3rem; border-radius: 4px; color: var(--text-muted); transition: color 0.2s, background 0.2s; }
.btn-icon:hover { color: var(--danger); background: rgba(231, 76, 60, 0.1); }
.inline-form { display: inline; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-strava { background: #fc4c02; color: white; }
.btn-strava:hover { background: #e04400; color: white; text-decoration: none; }

/* Flash messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
.flash.success { background: #d5f5e3; color: #1e8449; border: 1px solid #a9dfbf; }
.flash.error { background: #fadbd8; color: #c0392b; border: 1px solid #f5b7b1; }
.flash.info { background: #d6eaf8; color: #2471a3; border: 1px solid #aed6f1; }

/* Hero */
.hero {
    text-align: center;
    padding: 4rem 2rem;
}
.hero-logo { width: 120px; height: 120px; margin-bottom: 1rem; border-radius: 20px; }
.hero h1, .hero .hero-title { font-size: 3.5rem; color: var(--primary); margin-bottom: 0.75rem; letter-spacing: -2px; }
.hero p { font-size: 1.1rem; color: var(--text-light); max-width: 600px; margin: 0 auto 2rem; }
.hero .hero-description { font-size: 0.95rem; font-style: italic; margin-top: -1rem; }

.steps-list { display: flex; flex-direction: column; gap: 1rem; max-width: 700px; margin: 2rem auto; }
.step { display: flex; align-items: center; gap: 1.5rem; padding: 1.2rem 1.5rem; border-radius: var(--radius); transition: transform 0.15s; }
.step:hover { transform: translateX(4px); }
.step-left { display: flex; align-items: center; gap: 0.75rem; min-width: 220px; flex-shrink: 0; }
.step .step-num { display: inline-flex; width: 36px; height: 36px; border-radius: 50%; color: white; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; flex-shrink: 0; }
.step h3 { font-size: 1rem; margin: 0; white-space: nowrap; }
.step p { font-size: 0.9rem; color: var(--text-light); margin: 0; }
.step-optional { display: inline-block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; background: var(--text-muted); color: white; padding: 0.1rem 0.5rem; border-radius: 3px; margin-left: 0.4rem; vertical-align: middle; }

/* Dégradé orange → vert par étape */
.step-1 { background: rgba(211, 84, 0, 0.12); }
.step-1 .step-num { background: #d35400; }
.step-2 { background: rgba(192, 108, 0, 0.12); }
.step-2 .step-num { background: #c06c00; }
.step-3 { background: rgba(160, 140, 20, 0.12); }
.step-3 .step-num { background: #a08c14; }
.step-4 { background: rgba(100, 160, 50, 0.12); }
.step-4 .step-num { background: #64a032; }
.step-5 { background: rgba(39, 174, 96, 0.12); }
.step-5 .step-num { background: #27ae60; }

@media (max-width: 600px) {
    .step { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .step-left { min-width: auto; }
}

/* Section headers */
h1 { font-size: 1.6rem; margin-bottom: 1.5rem; color: var(--text); }
h2 { font-size: 1.3rem; margin-bottom: 1rem; }

/* Comparison table */
.comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 1.5rem 0; }
.comparison .col { text-align: center; padding: 1.5rem; border-radius: var(--radius); }
.comparison .col-strava { background: #eaf7ea; border: 2px solid var(--primary); }
.comparison .col-lab { background: #fef9e7; border: 2px solid var(--accent); }
.comparison .col h3 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.5rem; }
.comparison .col .time { font-size: 2rem; font-weight: 700; }

/* HTMX indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.sync-progress p { margin: 0.3rem 0; font-size: 0.9rem; }

/* Factors list */
.factors { list-style: none; }
.factors li { padding: 0.6rem 0; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; }
.factors .factor-name { font-weight: 500; display: flex; align-items: center; gap: 0.4rem; }
.factors .factor-value { font-size: 0.9rem; color: var(--text-light); font-weight: 600; white-space: nowrap; }

/* Info bubble tooltip */
.info-bubble { position: relative; display: inline-flex; cursor: help; }
.info-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--border); color: var(--text-light);
    font-size: 0.65rem; font-weight: 700; font-style: italic;
    line-height: 1; transition: background 0.15s;
}
.info-bubble:hover .info-icon,
.info-bubble:focus .info-icon { background: var(--primary); color: white; }
.info-tooltip {
    display: none; position: absolute; left: 50%; bottom: calc(100% + 8px);
    transform: translateX(-50%); z-index: 10;
    background: #f5f5f5; color: #222;
    padding: 0.5rem 0.75rem; border-radius: var(--radius);
    font-size: 0.8rem; font-weight: 400; font-style: normal;
    line-height: 1.4; white-space: normal; width: max-content; max-width: 280px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: none;
}
.info-tooltip::after {
    content: ''; position: absolute; top: 100%; left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent; border-top-color: #f5f5f5;
}
.info-bubble:hover .info-tooltip,
.info-bubble:focus .info-tooltip { display: block; }

/* Elevation profile */
.elevation-profile {
    display: block;
    width: 100%;
    height: auto;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    margin-top: auto;
}

/* Utility */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.flex { display: flex; align-items: center; gap: 1rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* About page */
.about-page { max-width: 650px; margin: 2rem auto; }
.about-page h1 { color: var(--primary); margin-bottom: 2rem; }
.about-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem; }
.about-card h2 { color: var(--accent); margin-bottom: 0.75rem; font-size: 1.15rem; }
.about-card p { margin-bottom: 0.75rem; line-height: 1.7; }
.about-card p:last-child { margin-bottom: 0; }
.about-footer { text-align: center; color: var(--text-muted); background: var(--bg); }

/* Responsive */
@media (max-width: 768px) {
    main { padding: 1rem; }
    nav { padding: 0 1rem; }
    .form-row { flex-direction: column; gap: 0; }
    .comparison { grid-template-columns: 1fr; }
    .hero h1, .hero .hero-title { font-size: 2.2rem; }
    .hero-logo { width: 80px; height: 80px; }
    .time-display .time-central { font-size: 2.5rem; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
