/* 通用樣式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.header {
    background-color: #4CAF50;
    color: white;
    padding: 15px 20px;
    text-align: center;
    border-bottom: 5px solid #388E3C;
    position: relative; /* 為了返回按鈕定位 */
}

.header h1 {
    margin: 0;
    font-size: 1.8em;
}

.footer {
    text-align: center;
    padding: 15px;
    margin-top: 30px;
    color: #777;
    font-size: 0.9em;
    border-top: 1px solid #eee;
}

/* 按鈕樣式 */
.btn {
    display: inline-block;
    padding: 12px 25px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-align: center;
}

.btn-primary {
    background-color: #4CAF50;
    color: white;
    border: none;
    width: 100%; /* 讓它佔滿寬度 */
    margin-top: 15px;
}

.btn-primary:hover {
    background-color: #388E3C;
}

.btn-secondary {
    background-color: #f0f0f0;
    color: #555;
    border: 1px solid #ccc;
    width: 100%;
    margin-top: 10px;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

/* 表單與輸入框 */
.form-group {
    margin-bottom: 15px;
}

.input-field, .select-field {
    width: calc(100% - 22px); /* 考慮 padding 和 border */
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box; /* 讓 padding 不會超出寬度 */
    font-size: 1em;
}

select.input-field {
    width: 100%; /* 下拉選單 */
}


/* 儀表板卡片 */
.dashboard-card {
    background-color: #e8f5e9;
    border: 1px solid #c8e6c9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.dashboard-card h2 {
    color: #2E7D32;
    margin-top: 0;
    font-size: 1.5em;
    border-bottom: 1px solid #a5d6a7;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.highlight {
    color: #2E7D32;
    font-weight: bold;
}

/* 訓練紀錄頁的組數容器 */
.sets-container {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    max-height: 300px; /* 限制高度，超出可滾動 */
    overflow-y: auto;
    background-color: #fcfcfc;
}

.set-item {
    display: flex;
    align-items: center;
    gap: 10px; /* 元素間距 */
    margin-bottom: 10px;
    padding: 8px;
    border-bottom: 1px dashed #eee;
}

.set-item:last-child {
    border-bottom: none; /* 最後一項不需要底線 */
}

.set-item span {
    white-space: nowrap; /* 不換行 */
}

.set-item .input-field {
    flex-grow: 1; /* 讓輸入框自動填滿剩餘空間 */
    width: auto; /* 重置 width */
}
.set-item .set-weight, .set-item .set-reps {
    width: 70px; /* 給重量和次數輸入框固定寬度 */
    text-align: center;
}


/* 歷史進度頁的紀錄項目 */
.record-item {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 6px;
}

.record-item p {
    margin-top: 0;
    font-weight: bold;
    color: #4CAF50;
    border-bottom: 1px dotted #ccc;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.record-item ul {
    list-style-type: disc;
    padding-left: 20px;
    margin: 0;
}

.record-item li {
    margin-bottom: 5px;
}

/* 返回按鈕 */
.back-btn {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    text-decoration: none;
    font-size: 1.1em;
    font-weight: bold;
}

.back-btn:hover {
    text-decoration: underline;
}

/* 輔助類 */
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.text-center { text-align: center; }

/* 讓按鈕在小螢幕下堆疊 */
.action-buttons {
    display: flex;
    flex-direction: column; /* 垂直堆疊 */
    gap: 10px; /* 按鈕間距 */
}

/* RWD 調整 */
@media (max-width: 600px) {
    .container {
        margin: 10px;
        padding: 15px;
    }
    .header h1 {
        font-size: 1.5em;
    }
    .back-btn {
        font-size: 1em;
        left: 10px;
    }
    .btn {
        padding: 10px 20px;
        font-size: 0.9em;
    }
    .set-item {
        flex-wrap: wrap; /* 小螢幕下可換行 */
        justify-content: center;
    }
    .set-item span {
        width: 100%; /* 讓組數文字獨立一行 */
        text-align: center;
        margin-bottom: 5px;
    }
    .set-item .input-field {
        width: calc(50% - 15px); /* 輸入框各佔一半寬度 */
    }
}.timer-container-flex {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.rest-timer {
    flex: 1;
    background: #333;
    color: #fff;
}

.total-timer {
    flex: 1;
    background: #4CAF50; /* 綠色背景代表進行中 */
    color: white;
}

.timer-label {
    font-size: 0.8em;
    opacity: 0.8;
    margin-bottom: 5px;
}

.timer-subtext {
    font-size: 0.7em;
    font-style: italic;
    margin-top: 5px;
}

@media (max-width: 600px) {
    .timer-container-flex {
        flex-direction: column; /* 手機版改為上下排 */
    }
}
.timer-dropdown {
    background: #444;
    color: white;
    border: 1px solid #666;
    padding: 5px 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.btn-timer {
    background-color: #4CAF50;
    transition: all 0.2s;
    min-width: 60px;
}

.btn-timer:active {
    transform: scale(0.95);
}

.timer-display {
    font-family: 'Courier New', Courier, monospace; /* 數字看起來更有電子錶感 */
    letter-spacing: 2px;
}
/* 手機版基礎設定 */
@media (max-width: 600px) {
    .container, .progress-container {
        padding: 10px;
        width: 95%;
    }

    /* 讓按鈕更大，方便手指點擊 */
    .btn, .btn-primary, .btn-secondary {
        padding: 15px;
        font-size: 1.1rem;
        border-radius: 12px;
    }

    /* 讓輸入框填滿寬度 */
    .num-input, .input-field {
        height: 50px;
        font-size: 1.1rem;
    }

    /* 調整 AI 區塊在手機上的間距 */
    .ai-status-card {
        padding: 15px;
    }
    
    .header-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #exerciseSelect {
        width: 100% !important;
        margin-top: 10px;
    }
}