/* 運動トラッキング画面のスタイル */

/* ヘッダーのカスタマイズ */
.tracking-header {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.pause-btn,
.stop-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.pause-btn:hover,
.stop-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ヘッダータイトルセクション */
.header-title-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.exercise-type-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.exercise-icon-small {
    font-size: 16px;
}

.exercise-name-header {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.tracking-header .app-title {
    font-size: 18px;
    margin: 0;
}

/* メインコンテンツ */
.tracking-main {
    padding: 20px 16px;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    min-height: calc(100vh - 60px);
}

/* 心拍数ゾーンインジケーター */
.heart-rate-zone-bar {
    position: sticky;
    top: -10px; /* 上に10pxずらす */
    z-index: 10;
    height: 40px;
    background-color: #f0f0f0;
    margin: -30px -16px 0 -16px; /* 上のマージンを増やす */
    margin-bottom: 26px; /* 下部の余白を増やす */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.5s ease;
    display: none; /* デフォルトは非表示 */
}

.heart-rate-zone-bar.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.zone-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transition: background-color 0.5s ease;
}

/* 心拍数ゾーンの色 */
.zone-indicator.zone-rest {
    background-color: #1a1a1a; /* 黒: 90 bpm以下 */
}

.zone-indicator.zone-warmup {
    background-color: #2196F3; /* 青: 91-110 bpm */
}

.zone-indicator.zone-fatburn {
    background-color: #4CAF50; /* 緑: 111-130 bpm */
}

.zone-indicator.zone-fitness {
    background-color: #FF9800; /* オレンジ: 131-140 bpm */
}

.zone-indicator.zone-endurance {
    background-color: #E91E63; /* ピンク: 141-180 bpm */
}

.zone-indicator.zone-maxintensity {
    background-color: #F44336; /* 赤: 181 bpm以上 */
}

.zone-label {
    position: relative;
    z-index: 1;
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    padding: 0 12px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    line-height: 28px;
}

/* 高強度ゾーンのパルスアニメーション */
.zone-indicator.zone-endurance,
.zone-indicator.zone-maxintensity {
    animation: zonePulse 2s ease-in-out infinite;
}

@keyframes zonePulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

/* 運動タイプ表示 */
.exercise-type-display {
    display: none;
}

/* メイン統計 */
.main-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.main-stat-card {
    background-color: white;
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.main-stat-card:hover {
    transform: translateY(-2px);
}

.time-card {
    border-left: 4px solid #4caf50;
}

.heart-rate-card {
    border-left: 4px solid #f44336;
}

.main-stat-card .stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.heart-icon {
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.stat-value-large {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
    font-family: 'Courier New', monospace;
}

.heart-rate-value {
    color: #f44336;
}

.main-stat-card .stat-unit {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* 詳細統計 */
.detail-stats {
    background-color: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.stat-row:last-child {
    margin-bottom: 0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background-color: #e9ecef;
}

.stat-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border-radius: 50%;
    flex-shrink: 0;
}

.stat-info {
    flex: 1;
    text-align: left;
}

.stat-item .stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
    font-weight: 500;
}

.stat-item .stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    line-height: 1;
    font-family: 'Courier New', monospace;
}

.stat-item .stat-unit {
    font-size: 10px;
    color: #999;
    margin-top: 2px;
}

/* 動画プレイヤー */
.video-player {
    background-color: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

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

.video-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-title::before {
    content: "📺";
    font-size: 20px;
}

.video-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.video-close-btn:hover {
    background-color: #f5f5f5;
    color: #333;
}

.video-container {
    position: relative;
}

.video-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    height: 200px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.video-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 20px;
}

.video-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.9;
}

.video-description {
    font-size: 16px;
    margin: 0;
    font-weight: 500;
    opacity: 0.9;
}

.video-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.video-control-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.video-control-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.video-progress {
    flex: 1;
}

.progress-bar {
    height: 4px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: white;
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

/* 心拍数グラフ */
.heart-rate-chart {
    background-color: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-title::before {
    content: "📈";
    font-size: 20px;
}

.chart-container {
    height: 120px;
    position: relative;
    background: linear-gradient(180deg, #fafafa 0%, #f5f5f5 100%);
    border-radius: 8px;
    overflow: hidden;
}

.chart-grid {
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 8px;
    gap: 1px;
    position: relative;
}

.chart-bar {
    background: linear-gradient(180deg, #ff6b6b 0%, #f44336 100%);
    border-radius: 2px 2px 0 0;
    width: 3px;
    min-height: 4px;
    transition: height 0.3s ease;
    opacity: 0.8;
}

.chart-bar:hover {
    opacity: 1;
}

/* 制御ボタン */
.control-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-top: auto;
}

.control-buttons:has(.video-btn[style*="display: none"]) {
    grid-template-columns: 1fr 1fr;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.pause-resume-btn {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
}

.pause-resume-btn:hover {
    background: linear-gradient(135deg, #f57c00 0%, #ef6c00 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.3);
}

.pause-resume-btn.paused {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
}

.pause-resume-btn.paused:hover {
    background: linear-gradient(135deg, #388e3c 0%, #2e7d32 100%);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}

.finish-btn {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
}

.video-btn {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    color: white;
}

.video-btn:hover {
    background: linear-gradient(135deg, #7b1fa2 0%, #6a1b9a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.3);
}

.finish-btn {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
}

.finish-btn:hover {
    background: linear-gradient(135deg, #d32f2f 0%, #c62828 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.3);
}

.btn-icon {
    font-size: 24px;
}

.btn-text {
    font-size: 14px;
    font-weight: 600;
}

/* 一時停止状態 */
.tracking-main.paused {
    opacity: 0.8;
}

.tracking-main.paused .exercise-status {
    color: #ff9800;
}

.tracking-main.paused .exercise-status::after {
    content: " (一時停止中)";
}

/* レスポンシブ対応 */
@media (max-width: 430px) {
    .main-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-row {
        grid-template-columns: 1fr;
    }
    
    .control-buttons {
        grid-template-columns: 1fr;
    }
    
    .stat-value-large {
        font-size: 28px;
    }
    
    .tracking-main {
        padding: 16px 12px;
    }
    
    .exercise-name-header {
        font-size: 12px;
    }
    
    .tracking-header .app-title {
        font-size: 16px;
    }
    
    .heart-rate-zone-bar {
        margin: -16px -12px 16px -12px;
        height: 35px;
    }
    
    .zone-label {
        font-size: 12px;
        padding: 0 10px;
        line-height: 24px;
    }
}

/* アニメーション */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.recording .heart-rate-card {
    animation: pulse 2s ease-in-out infinite;
}

/* 数値の更新アニメーション */
.stat-value-updating {
    animation: valueUpdate 0.3s ease-in-out;
}

@keyframes valueUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}