/*
 * Strava Dashboard Stylesheet
 * Theme: Dash-style Flexbox Layout with Strava Orange Highlights
 */

/* ----------------------------------------------------
 * 1. Global Reset & Typography 
 * ---------------------------------------------------- */
:root {
    --strava-orange: #FC4C02;
    --strava-light-orange: #ff6e30; /* Light background for highlights */
    --background-light: #f9f9f9;
    --card-background: #FFFFFF;
    --text-color-primary: #333;
    --border-color: #f0f0f0;
}

body {
    font-family: 'Roboto', sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI";
    background-color: var(--background-light); 
    color: var(--text-color-primary);
    padding: 0;
    line-height: 1.6;
}

body.banner-active {
    padding-top: 90px;  /* adjust to banner height */
}

body.footer-active {
    padding-bottom: 70px; /* match footer height */
}


h1, h2, h3 {
    margin: 0;
    font-weight: 600;
}

h3 { 
    font-size: 1.2em;
    color: var(--text-color-primary); 
    margin-bottom: 8px;
}

/* ----------------------------------------------------
 * 2. Banner & Header Controls (#topBanner)
 * ---------------------------------------------------- */
#topBanner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--strava-orange);
    color: white;
    padding: 15px 20px; 
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    flex-wrap: wrap;
}

#topBanner.fixed-banner {
    position: fixed;
    top: 3px;          /* match body padding */
    left: 9px;         /* match body padding */
    right: 9px;        /* match body padding */
    width: auto;
    z-index: 3000;
}

#topBanner .title {
    font-size: 25px;
    font-weight: 700;
    flex-grow: 1;
    margin-left: 10px;
}

.avatar {
    height: 40px; 
    width: 40px;

    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 18px;
    margin-left: 10px;
}

#topBanner .strava-logo {
  margin-left: 29px;
  order: 3; 
}

/* Header Filter Styling */
.filters {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.96em;
}

.filter-group.date-filters {
    order: 1; 
}

.filter-group select, 
.filter-group input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1.0em;
    background-color: white;
    color: var(--text-color-primary);
    outline: none;
}

.filter-group span {
    color: white; 
    font-weight: 700;
}

/* ----------------------------------------------------
 * 3. KPI Card Style (Pills)
 * ---------------------------------------------------- */
.kpi-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0;
}

.pill {
    flex: 1 1 120px;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    background-color: var(--card-background);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    
}

.pill div:first-child { 
    font-size: 11px;
    margin: 1px 0 3px 0;
    font-weight: 500;
    text-transform: uppercase;
    color: #666;   
    font-weight: bold; 
}

.pill .k { 
    font-size: 18px;
    margin: 2px 0;
    font-weight: bold;
    color: #FC4C02; 
    display: block;
}

/* ----------------------------------------------------
 * 4. Main Content Layout (Flexbox)
 * ---------------------------------------------------- */
#main-dashboard-content {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

#left-column {
    flex: 1 1 400px; 
    min-width: 350px;
    display: flex;
    flex-direction: column;
    gap: 15px; 
}

#right-column {
    flex: 2 1 700px; 
    min-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 15px; 
}

/* ----------------------------------------------------
 * 5. Card & Container Styles
 * ---------------------------------------------------- */
.card {
    background-color: var(--card-background);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%; 
    box-sizing: border-box;
}

.card h3 {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-color-primary);
    padding-bottom: 5px;
    margin-bottom: 5px;
}

.chart-card {
    flex-grow: 1;
}

.table-card {
    flex-grow: 0.5;
}

.map-card {
    flex-grow: 1;
}

/* Performance Summary Card */
#performance-summary-card .kpi-group {
    justify-content: space-around;
    gap: 20px; 
}

#performance-summary-card .pill {
    flex: 1 1 40%; 
    max-width: 50%;
}

/* ----------------------------------------------------
 * 6. Map
 * ---------------------------------------------------- */
#map {
    width: 100%;
    height: 600px; /* Desktop Height */
    border-radius: 6px;
    border: 1px solid var(--border-color); 
}


/* ----------------------------------------------------
 * 6.1. Legend
 * ---------------------------------------------------- */
.leaflet-control-legend {
    background: white;
    padding: 5px 15px;
    border: grey;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    font-family: Arial, sans-serif;
    font-size: 12px;
    line-height: 1.3;
}
.leaflet-control-legend .gradient {
    width: 100px;
    height: 20px;
    margin: 5px 0;
    background: linear-gradient(to right, blue, green, yellow, red);
    display: block;
}
.leaflet-control-legend .labels {
    display: flex;
    justify-content: space-between;
    width: 100px;
}

/* ----------------------------------------------------
 * 7. Personal Bests Table
 * ---------------------------------------------------- */
#personal-bests-table-container {
    max-height: 250px; 
    overflow-y: auto;
}

#personal-bests-table {
    width: 100%;
    border-collapse: collapse; 
    font-size: 13px; 
    text-align: left;
}

#personal-bests-table th,
#personal-bests-table td {
    padding: 6px 10px; 
    border-bottom: 1px solid var(--border-color);
}

#personal-bests-table th {
    background-color: #eee;
    color: #555; 
    font-weight: 600;
    text-transform: none;
}

/* ----------------------------------------------------
 * 8. Welcome Modal Styling
 * ---------------------------------------------------- */
#welcomeModal {
    display: flex;              /* show by default */
    position: fixed;
    inset: 0;                   /* top:0; left:0; right:0; bottom:0 */
    background: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

#welcomeModal .modal-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

#welcomeModal h2 {
    margin-bottom: 15px;
}

#welcomeModal p {
    margin-bottom: 25px;
}

#welcomeModal button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: #FC4C02;
    color: white;
    font-size: 16px;
    cursor: pointer;
}

#welcomeModal button:hover {
    opacity: 0.9;
}


.info-icon {
  font-size: 12px;
  cursor: pointer;
  color: #888;
  position: relative;
}

/* ----------------------------------------------------
 * 9. Refresh Button
 * ---------------------------------------------------- */

.icon-button {
  font-size: 20px;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background-color: #FC4C02;   /* Strava orange */
  color: white;
  transition: 0.2s ease;
}

.icon-button:hover {
  background-color: #e04300;
}

/* ----------------------------------------------------
 * 10. Info
 * ---------------------------------------------------- */

.info-icon:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 140%;
  left: 50%;
  transform: translateX(-50%);
  background: #222;
  color: white;
  padding: 8px 10px;
  font-size: 12px;
  border-radius: 6px;
  white-space: normal;
  width: 220px;
  line-height: 1.4;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ----------------------------------------------------
 * 11. Footer
 * ---------------------------------------------------- */
#footerBanner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--strava-orange);
    color: white;
    padding: 1px 20px; 
    border-radius: 8px;
    margin-top: 15px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    flex-wrap: wrap;
    font-weight: 400;
}

#footerBanner .footer-left {
    display: flex;
    gap: 12px;
    align-items: center;
}

#footerBanner .footer-center {
    font-size: 11px;      /* smaller */
    font-weight: 400;     /* normal weight */
    opacity: 0.5;        /* slightly softer */
    text-align: center;
}

#footerBanner .footer-right {
    display: flex;
    align-items: center;
}

#footerBanner .footer-right .logo {
    height: 30px;
    width: 65px;
    flex-shrink: 0;
    align-items: center;
    margin-top: 7px;
}

#footerBanner .footer-left .c {
    font-size: 8px;
    color: #fdfdfd;
    font-style: italic;
}

.footer-link {
    color: white;
    text-decoration: none;
    font-size: 12px;
    transition: opacity 0.2s ease;
}

.footer-link:hover {
    opacity: 0.8;
    cursor: pointer;
}

#footerBanner.fixed-footer {
    position: fixed;
    bottom: 0;
    left: 10px;     /* match body margin */
    right: 10px;    /* match body margin */
    width: auto;
    z-index: 2000;
    border-radius: 8px;
    box-shadow: 0 -3px 6px rgba(0, 0, 0, 0.2);
    margin-bottom: 5px;
}


/* Modal link styling */
.modal-link {
  display: inline-block;
  margin-top: 15px;
  font-style: italic;
  text-decoration: underline;
  color: #FC4C02; /* Strava orange */
  cursor: pointer;
  font-size: 14px;
}

.modal-link:hover {
  color: #e04300;
}

/* ----------------------------------------------------
 * 12. Responsiveness
 * ---------------------------------------------------- */

/* --- Tablet / Smaller Desktop (1200px and below) --- */
@media (max-width: 1200px) { 
    #main-dashboard-content {
        flex-direction: column;
        gap: 10px;
    }
    #left-column, #right-column {
        flex: 1 1 100%; 
        min-width: auto;
        gap: 10px;
    }
    
    #map {
        height: 500px; 
    }
    
    body {
        margin: 15px;
    }
}

/* --- iPad / Tablet Portrait (768px and below) --- */
@media (max-width: 768px) {
    /* Header Stacking and Padding adjustments (Good for iPad portrait) */
        body.banner-active {
        padding-top: 220px; /* increase because banner stacks */
    }
    #topBanner {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 15px;
        margin-bottom: 15px;
    }
    .filters {
        margin-top: 10px;
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap; 
        gap: 8px;
    }
    
    /* Ensure filter groups use available width */
    .filter-group {
        flex-basis: 48%; 
    }

    /* KPI Stacking (2 columns) */
    .kpi-group {
        gap: 8px;
        margin-bottom: 8px;
    }
    .pill {
        flex: 1 1 calc(50% - 8px); 
        padding: 8px;
    }
    .pill .k {
        font-size: 16px;
    }
    
    /* General Reductions */
    .card {
        padding: 10px;
    }

    #map {
        height: 400px;
    }
    
    h3 {
        font-size: 1.1em;
    }
}

@media (max-width: 576px) { 
    /* mobile phone optimizations here */ 
}
@media (max-width: 420px) { 
    /* extra-small phone optimizations here */ 
}

/* Modal link styling */
.modal-link {
  display: inline-block;
  margin-top: 15px;
  margin-bottom: 15px;
  font-style: italic;
  text-decoration: underline;
  color: #FC4C02; /* Strava orange */
  cursor: pointer;
  font-size: 12px;
}

.modal-link:hover {
  color: #e04300;
}





