/* 基础样式已在 common.css 中定义 */

/* 生成中遮罩层（只覆盖内容区，不影响导航栏） */
.plan-generating-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    min-height: 500px;
}

/* 有任务生成时临时隐藏静态内容，防止闪烁 */
.plan-hidden {
    display: none !important;
}

/* 复用 profile-setup 的加载动画样式 */
.plan-generating-overlay .loader-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 180px;
    height: 180px;
    font-family: "Inter", sans-serif;
    font-size: 1.1em;
    font-weight: 300;
    color: white;
    border-radius: 50%;
    background: rgba(26, 51, 121, 0.9);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    margin: 0 auto 30px auto; /* 确保水平居中 */
}

.plan-generating-overlay .loader-circle {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background-color: transparent;
    animation: loader-combined 2.3s linear infinite;
    z-index: 0;
}

@keyframes loader-combined {
    0% {
        transform: rotate(90deg);
        box-shadow:
            0 6px 12px 0 #38bdf8 inset,
            0 12px 18px 0 #005dff inset,
            0 36px 36px 0 #1e40af inset,
            0 0 3px 1.2px rgba(56, 189, 248, 0.3),
            0 0 6px 1.8px rgba(0, 93, 255, 0.2);
    }
    25% {
        transform: rotate(180deg);
        box-shadow:
            0 6px 12px 0 #0099ff inset,
            0 12px 18px 0 #38bdf8 inset,
            0 36px 36px 0 #005dff inset,
            0 0 6px 2.4px rgba(56, 189, 248, 0.3),
            0 0 12px 3.6px rgba(0, 93, 255, 0.2),
            0 0 18px 6px rgba(30, 64, 175, 0.15);
    }
    50% {
        transform: rotate(270deg);
        box-shadow:
            0 6px 12px 0 #60a5fa inset,
            0 12px 6px 0 #0284c7 inset,
            0 24px 36px 0 #005dff inset,
            0 0 3px 1.2px rgba(56, 189, 248, 0.3),
            0 0 6px 1.8px rgba(0, 93, 255, 0.2);
    }
    75% {
        transform: rotate(360deg);
        box-shadow:
            0 6px 12px 0 #3b82f6 inset,
            0 12px 18px 0 #0ea5e9 inset,
            0 36px 36px 0 #2563eb inset,
            0 0 6px 2.4px rgba(56, 189, 248, 0.3),
            0 0 12px 3.6px rgba(0, 93, 255, 0.2),
            0 0 18px 6px rgba(30, 64, 175, 0.15);
    }
    100% {
        transform: rotate(450deg);
        box-shadow:
            0 6px 12px 0 #4dc8fd inset,
            0 12px 18px 0 #005dff inset,
            0 36px 36px 0 #1e40af inset,
            0 0 3px 1.2px rgba(56, 189, 248, 0.3),
            0 0 6px 1.8px rgba(0, 93, 255, 0.2);
    }
}

.plan-generating-overlay .loader-letter {
    display: inline-block;
    opacity: 0.4;
    transform: translateY(0);
    animation: loader-letter-anim 2.4s infinite;
    z-index: 1;
    border-radius: 50ch;
    border: none;
}

.plan-generating-overlay .loader-letter:nth-child(1) { animation-delay: 0s; }
.plan-generating-overlay .loader-letter:nth-child(2) { animation-delay: 0.1s; }
.plan-generating-overlay .loader-letter:nth-child(3) { animation-delay: 0.2s; }
.plan-generating-overlay .loader-letter:nth-child(4) { animation-delay: 0.3s; }
.plan-generating-overlay .loader-letter:nth-child(5) { animation-delay: 0.4s; }
.plan-generating-overlay .loader-letter:nth-child(6) { animation-delay: 0.6s; }
.plan-generating-overlay .loader-letter:nth-child(7) { animation-delay: 0.7s; }
.plan-generating-overlay .loader-letter:nth-child(8) { animation-delay: 0.8s; }
.plan-generating-overlay .loader-letter:nth-child(9) { animation-delay: 0.9s; }

@keyframes loader-letter-anim {
    0%, 100% {
        opacity: 0.4;
        transform: translateY(0);
    }
    20% {
        opacity: 1;
        text-shadow: #f8fcff 0 0 5px;
    }
    40% {
        opacity: 0.7;
        transform: translateY(0);
    }
}

.plan-generating-overlay .generation-text {
    text-align: center;
    color: #111;
    max-width: 600px;
    width: 100%;
    padding: 0 20px;
    margin: 0 auto;
}

.plan-generating-overlay .generation-text h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #111;
    font-weight: 600;
}

.plan-generating-overlay .generation-text p {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* 生成进度条 */
.plan-progress-bar {
    margin-top: 16px;
    width: 100%;
    max-width: 500px;
    height: 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.3);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
    margin-left: auto;
    margin-right: auto;
}

.plan-progress-bar-inner {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #38bdf8, #0ea5e9, #2563eb);
    transition: width 0.3s ease;
}

/** 训练计划课表样式 **/
.workout-container {
    position: relative; /* 为生成中遮罩层提供定位基准 */
    max-width: 1180px;
    margin: 35px auto 40px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    /* 保证内容区域在加载时也至少撑满一屏，避免 footer 看起来跑到中间 */
    min-height: calc(100vh - 220px);
}

.sidebar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(80px);
    -webkit-backdrop-filter: blur(80px);
    border-radius: 12px;
    padding: 40px 30px 30px;
    width: 420px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    position: relative;
    flex-shrink: 0;
}

.main-content {
    flex-grow: 1;
}

/* 没有训练计划时，主内容单列居中展示 */
.main-content.plan-empty-single {
    max-width: 640px;
    margin: 0 auto;
}

.plan-title {
    font-size: 24px;
    font-weight: bold;
    margin: 20px auto 30px;
    text-align: center;
    max-width: 1180px;
    padding: 80px 20px 0; /* 为固定头部留出空间 */
    color: #111;
}

.phase {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 1px solid #f3f3f3;
    padding-bottom: 30px;
    position: relative;
}

.phase:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.unlock .phase-details {
    opacity: 0.4;
}

.phase-number {
    background-color: #007bff;
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
}

.phase-details h3 {
    font-size: 16px;
    font-weight: bold;
}

.phase-details p {
    font-size: 14px;
    color: #111;
    margin-top: 10px;
}

.weeks {
    margin-top: 20px;
    display: flex;
    gap: 7px;
    font-size: 13px;
}

.week {
    color: #999;
    letter-spacing: 1.2px;
}

.week.active {
    color: #007bff;
    font-weight: bold;
}

.week.active::after {
    content: '🏊‍♀️';
}

.week.completed {
    color: #111;
}

.week.completed::after {
    content: '✅';
    color: green;
    margin-left: 1px;
}

.week.locked::after {
    content: '🔒';
    margin-right: 0px;
}

.workout-card {
    background-color: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.workout-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

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

.workout-header h2 {
    font-size: 18px;
    font-weight: bold;
}

.workout-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tab {
    padding: 7px 15px;
    border-radius: 30px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f5f5f5;
    color: #666;
    border: 1px solid transparent;
}

.tab:hover {
    background-color: #e8e8e8;
}

.tab.active {
    background-color: #333;
    color: white;
    border-color: #333;
}

.workout-content {
    display: none;
    background-color: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 25px;
    animation: fadeIn 0.3s ease;
}

.workout-content.active {
    display: block;
}

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

.workout-summary {
    padding: 15px 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: #fff;
    border-radius: 8px;
    margin-bottom: 15px;
}

.summary-item {
    text-align: center;
}

.summary-item .value {
    font-size: 18px;
    font-weight: bold;
}

.summary-item .label {
    font-size: 14px;
    color: #999;
}

.tags {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.tag {
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 8px;
    margin: 0 5px;
    background-color: #f0f0f0; /* 添加默认背景色，确保所有标签都有背景 */
    color: #666; /* 添加默认文字颜色 */
}

.tag.endurance {
    background-color: #fcdcdc;
    color: #ef5353;
}

.tag.threshold {
    background-color: #f9e8bb;
    color: #f6890c;
}

.tag.power {
    background-color: #d7a2fe;
    color: #901AE4;
}

.tag.sprint {
    background-color: #f4a8a8;
    color: #DE0101;
}

.tag.recovery {
    background-color: #99ccfc;
    color: #2686E0;
}

.tag.technique {
    background-color: #c7ef93;
    color: #508C03;
}

.tag.test {
    background-color: #d4d4d4;
    color: #111111;
}

.tag.default {
    background-color: #f0f0f0;
    color: #666;
}

.workout-section {
    margin-bottom: 20px;
    margin-top: 30px;
}

.section-title {
    font-size: 15px;
    font-weight: bold;
    color: #000;
    padding-bottom: 10px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e7e7e7;
}

.section-title::before {
    content: '▼';
    margin-right: 8px;
    font-size: 12px;
}

.section-warm-up .section-title::before {
    color: #3BA058;
}

.section-drills .section-title::before {
    color: #F39F0E;
}

.section-main-set .section-title::before {
    color: #E94346;
}

.section-cool-down .section-title::before {
    color: #2686E0;
}

.drill-list {
    padding-left: 0;
}

.drill-item {
    display: flex;
    align-items: baseline;
    margin-top: 12px;
    font-size: 15px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.drill-item:last-child {
    border-bottom: none;
}

.drill-item dt {
    flex-basis: 50px;
    flex-shrink: 0;
    color: #888;
    font-weight: normal;
}

.drill-item dt span {
    margin-right: 10px;
    color: #111;
    font-weight: 600;
}

.drill-item dd {
    margin-left: 10px;
    flex-grow: 1;
    color: #333;
    line-height: 1.6;
}

.drill-item dd div {
    margin-top: 4px;
}

.drill-item dd div:first-child {
    margin-top: 0;
}

.download-btn {
    display: flex;
    width: 140px;
    margin: 30px auto 0;
    padding: 12px 20px;
    background-color: #f2f2f2;
    border: 1px solid #ddd;
    justify-content: center;
    align-items: center;
    color: #111;
    border-radius: 30px;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.download-btn svg {
    margin-right: 8px;
    zoom: 0.8;
    transition: transform 0.3s ease;
}

.download-btn:hover {
    background-color: #e8e8e8;
    border-color: #bbb;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.download-btn:hover svg {
    transform: translateY(-2px);
}

.download-btn:active {
    transform: translateY(0);
}

.accordion {
    background-color: white;
    border-radius: 12px;
    margin-bottom: 15px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.accordion:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.accordion-header {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

.accordion-header:hover {
    background-color: #f9f9f9;
    border-radius: 8px;
}

.accordion-header h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
}

.accordion-header .arrow {
    font-size: 16px;
    height: 26px;
    width: 26px;
    line-height: 22px;
    overflow: hidden;
    text-align: center;
    background-color: #f2f2f2;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.accordion-header .arrow:hover {
    background-color: #ddd;
    transform: scale(1.1);
}

.accordion.open .accordion-header .arrow {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 15px 20px;
    display: none;
    flex-wrap: wrap;
    gap: 10px;
}

.accordion.open .accordion-content {
    display: flex;
}

.line {
    display: block;
    width: 1px;
    height: 22em;
    border-right: 2px dashed #ccc;
    position: absolute;
    top: 45px;
    left: 45px;
    z-index: -1;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .workout-container {
        width: 100%;
        padding: 20px;
    }
}

@media (max-width: 992px) {
    .workout-container {
        flex-direction: column;
    }

    .sidebar,
    .main-content {
        width: 100%;
    }
}

@media (max-width: 768px) {
    body,
    html {
        padding-top: 20px;
    }

    .workout-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .workout-summary {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .summary-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .tags {
        justify-content: flex-end;
    }
}

/* ==================== 完成训练功能样式 ==================== */

/* 完成训练区域 */
.complete-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.btn-complete-training {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #1a3379 0%, #2d4a9e 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-complete-training:hover {
    background: linear-gradient(135deg, #2d4a9e 0%, #3d5ab8 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 51, 121, 0.3);
}

.btn-complete-training:active {
    transform: translateY(0);
}

/* 已完成状态 */
.complete-section.completed {
    text-align: center;
}

.completed-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #f0f9ff;
    border: 2px solid #1a3379;
    border-radius: 8px;
    color: #1a3379;
    font-weight: 500;
}

.check-icon {
    font-size: 20px;
    color: #10b981;
}

.completed-date {
    font-size: 12px;
    color: #6b7280;
    margin-left: 8px;
}

.record-images {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.record-image-preview {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: transform 0.2s;
}

.record-image-preview:hover {
    transform: scale(1.05);
}

.record-notes {
    margin-top: 15px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    border-left: 3px solid #1a3379;
}

.record-notes p {
    margin: 0;
    color: #374151;
    line-height: 1.6;
}

/* 完成训练弹窗 */
.complete-training-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1001;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a3379;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.image-upload-area {
    margin-top: 8px;
}

.btn-upload {
    padding: 10px 20px;
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-upload:hover {
    background: #e5e7eb;
    border-color: #1a3379;
    color: #1a3379;
}

.image-preview-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.image-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.image-preview-item button {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.image-preview-item button:hover {
    background: #dc2626;
}

#trainingNotes {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
}

#trainingNotes:focus {
    outline: none;
    border-color: #1a3379;
    box-shadow: 0 0 0 3px rgba(26, 51, 121, 0.1);
}

.tip {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

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

.btn-cancel,
.btn-submit {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-cancel {
    background: #f3f4f6;
    color: #6b7280;
}

.btn-cancel:hover {
    background: #e5e7eb;
    color: #374151;
}

.btn-submit {
    background: linear-gradient(135deg, #1a3379 0%, #2d4a9e 100%);
    color: white;
}

.btn-submit:hover {
    background: linear-gradient(135deg, #2d4a9e 0%, #3d5ab8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 51, 121, 0.3);
}

