/* ============================================
   Reset & Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: linear-gradient(135deg, #2d3548 0%, #1f2937 100%);
    min-height: 100vh;
    padding: 20px;
}

/* ============================================
   Container
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px;
}

/* ============================================
   Typography
   ============================================ */
h1 {
    text-align: center;
    color: #e8e8e8;
    margin-bottom: 10px;
    font-size: 32px;
}

.subtitle {
    text-align: center;
    color: #a0a0a0;
    margin-bottom: 40px;
    font-size: 16px;
}

/* ============================================
   Tabs Container
   ============================================ */
.tabs-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
    background: #1a1f2e;
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tabs-list {
    display: flex;
    gap: 8px;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #444 #1a1f2e;
    padding: 4px 0;
}

.tabs-list::-webkit-scrollbar {
    height: 6px;
}

.tabs-list::-webkit-scrollbar-track {
    background: #1a1f2e;
}

.tabs-list::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.tabs-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #2a3548;
    color: #a0a0a0;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 500;
}

.tab:hover {
    background: #3a4558;
    color: #e8e8e8;
}

.tab.active {
    background: #FC4C02;
    color: white;
    border-color: #FC4C02;
    box-shadow: 0 2px 8px rgba(252, 76, 2, 0.3);
}

.tab-date {
    display: flex;
    align-items: center;
}

.tab-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    padding: 0;
}

.tab-close:hover {
    background: rgba(0, 0, 0, 0.4);
    transform: scale(1.1);
}

.tab.active .tab-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.tab-new-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #2a3548;
    color: #e8e8e8;
    border: 2px solid #444;
    border-radius: 8px;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tab-new-btn:hover {
    background: #FC4C02;
    border-color: #FC4C02;
    transform: scale(1.05);
}

.tab-new-btn:active {
    transform: scale(0.95);
}

/* ============================================
   Drop Zone
   ============================================ */
#dropZone {
    border: 3px dashed #444;
    border-radius: 15px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #1a1f2e;
    position: relative;
}

#dropZone:hover {
    border-color: #FC4C02;
    background: #2a1f1a;
    transform: translateY(-2px);
}

#dropZone.drag-over {
    border-color: #FC4C02;
    background: #2a1f1a;
    border-width: 4px;
    transform: scale(1.02);
}

#dropZone .icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

#dropZone h2 {
    color: #e8e8e8;
    margin-bottom: 15px;
    font-size: 24px;
}

#dropZone p {
    color: #a0a0a0;
    font-size: 16px;
    margin-bottom: 20px;
}

/* ============================================
   File Input
   ============================================ */
#fileInput {
    display: none;
}

/* ============================================
   Button
   ============================================ */
.button-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    background: #FC4C02;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    background: #e63d00;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(252, 76, 2, 0.3);
}

.btn-secondary {
    background: #2a3548;
    color: #e8e8e8;
}

.btn-secondary:hover {
    background: #3a4558;
    box-shadow: 0 5px 15px rgba(42, 53, 72, 0.3);
}

/* ============================================
   Status Messages
   ============================================ */
#status {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-weight: 500;
    display: none;
}

#status.success {
    background: #1e3a28;
    color: #7dcea0;
    border: 1px solid #2d5a3d;
}

#status.error {
    background: #3a1e1e;
    color: #e79a9a;
    border: 1px solid #5a2d2d;
}

#status.info {
    background: #1e2d3a;
    color: #7db3ce;
    border: 1px solid #2d435a;
}

/* ============================================
   Chart Container
   ============================================ */
#chartContainer {
    margin-top: 40px;
    padding: 20px;
    background: #1a1f2e;
    border-radius: 10px;
    display: none;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#powerCurveChart {
    max-height: 400px;
}

/* ============================================
   Chart Header with Toggle Button
   ============================================ */
.chart-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.btn-toggle {
    padding: 8px 16px;
    background: #2a3548;
    color: #e8e8e8;
    border: 2px solid #444;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-toggle:hover {
    background: #3a4558;
    border-color: #667eea;
    transform: translateY(-1px);
}

.btn-toggle.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.btn-toggle:active {
    transform: scale(0.98);
}

/* ============================================
   Distribution Chart Container
   ============================================ */
#distributionContainer {
    margin-top: 40px;
    padding: 20px;
    background: #1a1f2e;
    border-radius: 10px;
    display: none;
    animation: fadeIn 0.5s ease 0.2s;
    animation-fill-mode: backwards;
}

#powerDistributionChart {
    max-height: 400px;
}

/* ============================================
   Statistics
   ============================================ */
.stats {
    display: none;
    margin-top: 30px;
    padding: 20px;
    background: #1a1f2e;
    border-radius: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-item {
    background: #0f1419;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid #2a2f3a;
}

.stat-label {
    color: #a0a0a0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.stat-value {
    color: #FC4C02;
    font-size: 24px;
    font-weight: 700;
}

.stat-item-highlight {
    background: linear-gradient(135deg, #2a1f1a 0%, #3a2515 100%);
    border: 2px solid #FC4C02;
}

.stat-sublabel {
    display: block;
    font-size: 10px;
    color: #707070;
    font-weight: 400;
    text-transform: none;
    margin-top: 5px;
}

/* ============================================
   FTP Container
   ============================================ */
.ftp-container {
    display: none;
    margin-top: 40px;
    justify-content: center;
    align-items: center;
    gap: 12px;
    animation: fadeIn 0.5s ease 0.3s;
    animation-fill-mode: backwards;
}

.ftp-label {
    font-size: 18px;
    font-weight: 600;
    color: #e8e8e8;
}

.ftp-value {
    color: #FC4C02;
    font-size: 24px;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
}

.ftp-unit {
    font-size: 16px;
    font-weight: 600;
    color: #a0a0a0;
}

.btn-adjust {
    width: 36px;
    height: 36px;
    border: 2px solid #444;
    border-radius: 6px;
    background: #1a1f2e;
    color: #e8e8e8;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-adjust:hover {
    background: #FC4C02;
    border-color: #FC4C02;
    transform: scale(1.05);
}

.btn-adjust:active {
    transform: scale(0.95);
}

/* ============================================
   Training Zones Chart Container
   ============================================ */
#zonesContainer {
    margin-top: 20px;
    padding: 20px;
    background: #1a1f2e;
    border-radius: 10px;
    display: none;
    animation: fadeIn 0.5s ease 0.4s;
    animation-fill-mode: backwards;
}

#trainingZonesChart {
    max-height: 400px;
}

/* ============================================
   Max HR Container
   ============================================ */
.max-hr-container {
    display: none;
    margin-top: 40px;
    justify-content: center;
    align-items: center;
    gap: 12px;
    animation: fadeIn 0.5s ease 0.5s;
    animation-fill-mode: backwards;
}

.max-hr-label {
    font-size: 18px;
    font-weight: 600;
    color: #e8e8e8;
}

.max-hr-value {
    color: #667eea;
    font-size: 24px;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
}

.max-hr-unit {
    font-size: 16px;
    font-weight: 600;
    color: #a0a0a0;
}

/* ============================================
   Heart Rate Zones Chart Container
   ============================================ */
#hrZonesContainer {
    margin-top: 20px;
    padding: 20px;
    background: #1a1f2e;
    border-radius: 10px;
    display: none;
    animation: fadeIn 0.5s ease 0.6s;
    animation-fill-mode: backwards;
}

#hrZonesChart {
    max-height: 400px;
}

/* ============================================
   Footer
   ============================================ */
footer {
    margin-top: 40px;
    text-align: center;
    color: #707070;
    font-size: 14px;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        padding: 20px;
    }

    h1 {
        font-size: 24px;
    }

    .subtitle {
        font-size: 14px;
        margin-bottom: 30px;
    }

    /* Mobile Tabs Styles */
    .tabs-container {
        padding: 8px;
        gap: 8px;
    }

    .tab {
        padding: 8px 12px;
        font-size: 13px;
        gap: 8px;
    }

    .tab-close {
        width: 24px;
        height: 24px;
        font-size: 18px;
    }

    .tab-new-btn {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }

    #dropZone {
        padding: 40px 20px;
    }

    #dropZone h2 {
        font-size: 20px;
    }

    #dropZone .icon {
        font-size: 48px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-value {
        font-size: 20px;
    }

    .chart-header {
        justify-content: center;
        margin-bottom: 15px;
    }

    .btn-toggle {
        font-size: 13px;
        padding: 6px 12px;
    }

}
