/* 記録画面専用スタイル */

/* 参加予約した運動 */
.reserved-exercises {
    padding: 16px 0;
    background-color: #f8f9fa;
    border-bottom: 8px solid #f5f5f5;
}

.reserved-exercises .section-title {
    margin: 0 16px 12px 16px;
}

.reserved-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 0 16px;
    scroll-behavior: smooth;
}

.reserved-list::-webkit-scrollbar {
    height: 0;
    background: transparent;
}

.reserved-item {
    background-color: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0;
    min-width: 240px;
    flex-shrink: 0;
}

.reserved-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reserved-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.reserved-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.reserved-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.reserved-info .type-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.reserved-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.type-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.host-name {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reserved-time {
    text-align: right;
    flex-shrink: 0;
}

.reserved-time .date {
    font-size: 12px;
    font-weight: 600;
    color: #2196F3;
    white-space: nowrap;
}

/* 統計サマリー */
.stats-summary {
    padding: 16px;
    background-color: #f8f9fa;
    border-bottom: 8px solid #f5f5f5;
}

/* 表示切り替えタブ */
.view-toggle {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 16px;
    background-color: #e9ecef;
    border-radius: 8px;
    padding: 4px;
}

.toggle-btn {
    flex: 1;
    background-color: transparent;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.toggle-btn.active {
    background-color: white;
    color: #2196F3;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-btn:hover:not(.active) {
    background-color: rgba(255,255,255,0.5);
}

.stats-period {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.period-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex: 1;
}

.period-nav-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #2196F3;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.period-nav-btn:hover {
    background-color: #f5f5f5;
}

.current-period {
    text-align: center;
    margin-bottom: 16px;
}

.period-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.period-btn {
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.period-btn.active {
    background-color: #2196F3;
    color: white;
    border-color: #2196F3;
}

.period-btn:hover {
    background-color: #f5f5f5;
}

.period-btn.active:hover {
    background-color: #1976D2;
}

.stats-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-card {
    background-color: white;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stat-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    border-radius: 50%;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 12px;
    color: #666;
}

/* 記録セクション */
.records-section {
    padding: 16px;
}

.section-header {
    margin-bottom: 16px;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.filter-tab {
    background-color: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-tab.active {
    background-color: #2196F3;
    color: white;
    border-color: #2196F3;
}

.filter-tab:hover {
    background-color: #f5f5f5;
}

.filter-tab.active:hover {
    background-color: #1976D2;
}

/* 記録アイテム */
.record-item {
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

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

.record-type {
    display: flex;
    align-items: center;
    gap: 8px;
}

.type-icon {
    font-size: 20px;
}

.type-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.record-date {
    text-align: right;
}

.date {
    font-size: 14px;
    color: #333;
    display: block;
}

.time {
    font-size: 12px;
    color: #666;
}

.record-content {
    margin-bottom: 12px;
}

.record-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.record-stats.ride-stats {
    grid-template-columns: 1fr 1fr 1fr;
}

.stat-item {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}

.stat-item .stat-label {
    font-size: 11px;
    color: #666;
    display: block;
    margin-bottom: 2px;
}

.stat-item .stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

/* メモ欄 */
.record-memo {
    margin-top: 12px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.memo-text {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin: 0;
}

.record-actions {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid #e0e0e0;
    padding-top: 12px;
    margin-top: 12px;
}

.record-actions .action-btn {
    background: none;
    border: none;
    font-size: 14px;
    color: #2196F3;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.record-actions .action-btn:hover {
    background-color: #f5f5f5;
}

.record-actions .action-btn:active {
    transform: scale(0.95);
}

/* ヘッダーのフィルターボタン */
.filter-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    color: white;
}

.filter-btn:hover {
    background-color: rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* 目標表示 */
.goals-view {
    padding: 20px 16px;
}

.goals-view.hidden {
    display: none;
}

.goals-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.goal-section {
    background: white;
    border-radius: 12px;
    padding: 16px;
}

.goal-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 16px;
}

.goal-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.goal-card {
    background: #f5f7fa;
    border-radius: 12px;
    padding: 16px;
}

.goal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

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

.goal-type {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.goal-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-info {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 16px;
    color: #333;
}

.current-value {
    font-size: 24px;
    font-weight: bold;
    color: #2196F3;
}

.separator {
    color: #999;
}

.target-value {
    font-weight: 600;
}

.unit {
    font-size: 14px;
    color: #666;
    margin-left: 4px;
}

.progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2196F3 0%, #42A5F5 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-percentage {
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: #2196F3;
}

.goal-setting-btn {
    width: 100%;
    padding: 16px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.goal-setting-btn:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

/* カレンダー表示 */
.calendar-view {
    padding: 8px 0;
}

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

.calendar-nav-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #2196F3;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.calendar-nav-btn:hover {
    background-color: #f5f5f5;
}

.calendar-month {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.calendar-grid {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background-color: #f8f9fa;
}

.weekday {
    padding: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    border-right: 1px solid #e9ecef;
}

.weekday:last-child {
    border-right: none;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #333;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

.calendar-day:hover {
    background-color: #f5f5f5;
}

.calendar-day.inactive {
    color: #ccc;
}

.calendar-day.exercise-day {
    font-weight: 600;
    position: relative;
}

.calendar-day.exercise-day::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 2px solid #2196F3;
    border-radius: 50%;
    z-index: -1;
}

.calendar-day.exercise-day::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background-color: #2196F3;
    border-radius: 50%;
}

/* 複数の運動タイプがある日 */
.calendar-day.multiple-exercises::before {
    border-color: #666;
}

.calendar-day.multiple-exercises::after {
    width: 16px;
    background: linear-gradient(90deg, #2196F3 33%, #4CAF50 33%, #4CAF50 66%, #FF9800 66%);
}

/* ライドの日 */
.calendar-day.ride-day::before {
    border-color: #2196F3;
}

.calendar-day.ride-day::after {
    background-color: #2196F3;
}

/* ランの日 */
.calendar-day.run-day::before {
    border-color: #4CAF50;
}

.calendar-day.run-day::after {
    background-color: #4CAF50;
}

/* ウォークの日 */
.calendar-day.walk-day::before {
    border-color: #FF9800;
}

.calendar-day.walk-day::after {
    background-color: #FF9800;
}

/* 今日の日付 */
.calendar-day.today {
    border: 2px solid #2196F3;
    font-weight: 700;
}

/* カレンダー凡例 */
.calendar-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    margin-top: -1px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #333;
}

.legend-color::before {
    content: '15';
    z-index: 2;
}

.legend-color::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid;
    border-radius: 50%;
    z-index: 1;
}

.legend-color.ride::after {
    border-color: #2196F3;
}

.legend-color.run::after {
    border-color: #4CAF50;
}

.legend-color.walk::after {
    border-color: #FF9800;
}

.legend-color.multiple::after {
    border-color: #666;
}

/* 複数運動の凡例に小さなドットを追加 */
.legend-item:has(.legend-color.multiple) {
    position: relative;
}

.legend-color.multiple + .legend-label::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 6px;
    width: 16px;
    height: 4px;
    background: linear-gradient(90deg, #2196F3 33%, #4CAF50 33%, #4CAF50 66%, #FF9800 66%);
    border-radius: 2px;
}

.legend-label {
    font-size: 12px;
    color: #666;
}

/* 目標設定モーダル */
.goal-settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.goal-settings-modal.show {
    display: block;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1002;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

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

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.goal-settings-section {
    margin-bottom: 32px;
}

.goal-settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 16px;
}

.goal-input-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.goal-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.goal-icon {
    font-size: 20px;
}

.goal-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.goal-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.goal-input {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    text-align: right;
    background: white;
    transition: all 0.3s ease;
}

.goal-input:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.goal-unit {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-secondary,
.btn-primary {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-primary {
    background: #2196F3;
    color: white;
}

.btn-primary:hover {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

/* 目標編集ボタン */
.goals-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.goals-main-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.edit-goals-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-goals-btn:hover {
    background: #e0e0e0;
    color: #333;
}

.edit-icon {
    font-size: 14px;
}

/* レスポンシブ対応 */
@media (max-width: 430px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .record-stats {
        grid-template-columns: 1fr;
    }
    
    .filter-tabs {
        flex-wrap: wrap;
    }
    
    .calendar-day {
        font-size: 12px;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .goal-input {
        width: 70px;
    }
}