/**
 * FitTrack Pro - 主樣式文件
 */

/* ========== CSS Variables ========== */
:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --primary-light: #C8E6C9;
    --accent: #FF9800;
    --accent-dark: #F57C00;
    --accent-light: #FFE0B2;
    
    --bg-main: #F5F5F5;
    --bg-card: #FFFFFF;
    --bg-dark: #2C3E50;
    
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --text-light: #FFFFFF;
    
    --border-color: #E0E0E0;
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
    
    --success: #4CAF50;
    --info: #2196F3;
    --warning: #FFC107;
    --danger: #F44336;
    
    --transition: all 0.3s ease;
}

/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-main);
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 15px;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
    margin-bottom: 15px;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========== Layout ========== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--bg-dark);
    color: var(--text-light);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition);
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--primary);
}

.sidebar-header .tagline {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.sidebar-nav {
    padding: 20px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: var(--text-light);
    border-left-color: var(--primary);
}

.sidebar-nav a i {
    width: 24px;
    margin-right: 10px;
    font-size: 1.1rem;
}

.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px;
    min-height: 100vh;
}

.page-header {
    background: var(--bg-card);
    padding: 20px 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h2 {
    margin: 0;
    color: var(--text-primary);
}

.page-header .breadcrumb {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.page-header .breadcrumb a {
    color: var(--primary);
}

/* ========== Cards ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0,0,0,0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(0,0,0,0.02);
}

/* ========== Stats Cards ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.accent::before { background: var(--accent); }
.stat-card.info::before { background: var(--info); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.warning::before { background: var(--warning); }

.stat-card .icon {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 2rem;
    opacity: 0.2;
}

.stat-card .label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card .unit {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-left: 5px;
}

.stat-card .change {
    font-size: 0.75rem;
    margin-top: 5px;
}

.stat-card .change.up { color: var(--success); }
.stat-card .change.down { color: var(--danger); }

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-light);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--text-light);
}

.btn-accent {
    background: var(--accent);
    color: var(--text-light);
}

.btn-accent:hover {
    background: var(--accent-dark);
    color: var(--text-light);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-light);
}

.btn-danger:hover {
    background: #D32F2F;
    color: var(--text-light);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 10px;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group label .required {
    color: var(--danger);
    margin-left: 3px;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    background: var(--bg-card);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

.form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 5px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* ========== Tables ========== */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    background: rgba(0,0,0,0.02);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

table tbody tr:hover {
    background: rgba(0,0,0,0.02);
}

table tbody tr:nth-child(even) {
    background: rgba(0,0,0,0.01);
}

table .actions {
    white-space: nowrap;
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 20px;
}

.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: #E8F5E9; color: #2E7D32; }
.badge-warning { background: #FFF3E0; color: #E65100; }
.badge-danger { background: #FFEBEE; color: #C62828; }
.badge-info { background: #E3F2FD; color: #1565C0; }
.badge-default { background: #ECEFF1; color: #546E7A; }

/* ========== Progress ========== */
.progress {
    height: 10px;
    background: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease;
}

.progress-bar.bg-success { background: var(--success); }
.progress-bar.bg-warning { background: var(--warning); }
.progress-bar.bg-danger { background: var(--danger); }
.progress-bar.bg-primary { background: var(--primary); }

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

/* ========== Alerts ========== */
.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #C8E6C9;
}

.alert-danger {
    background: #FFEBEE;
    color: #C62828;
    border: 1px solid #FFCDD2;
}

.alert-warning {
    background: #FFF3E0;
    color: #E65100;
    border: 1px solid #FFE0B2;
}

.alert-info {
    background: #E3F2FD;
    color: #1565C0;
    border: 1px solid #BBDEFB;
}

/* ========== Auth Pages ========== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    overflow: hidden;
}

.auth-header {
    background: var(--bg-dark);
    padding: 30px;
    text-align: center;
}

.auth-header h1 {
    color: var(--primary);
    margin-bottom: 5px;
}

.auth-header p {
    color: rgba(255,255,255,0.7);
    font-size: 0.875rem;
    margin: 0;
}

.auth-body {
    padding: 30px;
}

.auth-footer {
    padding: 20px 30px;
    background: rgba(0,0,0,0.02);
    text-align: center;
    font-size: 0.875rem;
}

/* ========== Calorie Circle ========== */
.calorie-circle {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.calorie-circle svg {
    transform: rotate(-90deg);
}

.calorie-circle .circle-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 15;
}

.calorie-circle .circle-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 15;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}

.calorie-circle .circle-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.calorie-circle .current {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.calorie-circle .goal {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ========== Dashboard Grid ========== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}

.dashboard-item {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.dashboard-item.span-3 { grid-column: span 3; }
.dashboard-item.span-4 { grid-column: span 4; }
.dashboard-item.span-6 { grid-column: span 6; }
.dashboard-item.span-8 { grid-column: span 8; }
.dashboard-item.span-9 { grid-column: span 9; }
.dashboard-item.span-12 { grid-column: span 12; }

/* ========== Calendar ========== */
.calendar {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0,0,0,0.02);
}

.calendar-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.calendar-nav {
    display: flex;
    gap: 10px;
}

.calendar-nav button {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.calendar-nav button:hover {
    background: var(--primary);
    color: var(--text-light);
    border-color: var(--primary);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-weekday {
    padding: 10px;
    text-align: center;
    font-weight: 600;
    background: rgba(0,0,0,0.02);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.calendar-day {
    min-height: 80px;
    padding: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.calendar-day:hover {
    background: rgba(0,0,0,0.02);
}

.calendar-day.other-month {
    background: rgba(0,0,0,0.01);
}

.calendar-day.other-month .day-number {
    color: var(--text-muted);
}

.calendar-day.today {
    background: rgba(76, 175, 80, 0.1);
}

.calendar-day.selected {
    background: rgba(76, 175, 80, 0.2);
    border-color: var(--primary);
}

.calendar-day .day-number {
    font-weight: 600;
    margin-bottom: 5px;
}

.calendar-day .day-indicator {
    height: 4px;
    border-radius: 2px;
    margin-bottom: 4px;
}

.calendar-day .day-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-day .day-record {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 4px;
}

.calendar-day .day-record.diet {
    background: rgba(76, 175, 80, 0.15);
    color: #388E3C;
}

.calendar-day .day-record.exercise {
    background: rgba(255, 152, 0, 0.15);
    color: #F57C00;
}

.calendar-day .record-icon {
    font-size: 0.7rem;
}

.calendar-day .record-value {
    font-weight: 600;
}

.calendar-day .day-exercise-name {
    font-size: 0.6rem;
    color: #F57C00;
    padding: 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.calendar-legend {
    display: flex;
    gap: 20px;
    padding: 10px 20px;
    background: rgba(0,0,0,0.02);
    font-size: 0.75rem;
}

.calendar-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.calendar-legend-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ========== Charts ========== */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

.chart-legend-item .color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* ========== Modal ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    width: 30px;
    height: 30px;
    border: none;
    background: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(0,0,0,0.1);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========== Search ========== */
.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.search-result-item:hover {
    background: rgba(0,0,0,0.02);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item .name {
    font-weight: 500;
    color: var(--text-primary);
}

.search-result-item .info {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.empty-state h4 {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ========== Loading ========== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

/* ========== Utilities ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }

.p-0 { padding: 0; }
.p-1 { padding: 10px; }
.p-2 { padding: 20px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

.hidden { display: none !important; }
.visible { visibility: visible; }
.invisible { visibility: hidden; }

/* ========== Responsive ========== */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    .dashboard-item.span-3,
    .dashboard-item.span-4 { grid-column: span 6; }
    .dashboard-item.span-6 { grid-column: span 6; }
    .dashboard-item.span-8,
    .dashboard-item.span-9 { grid-column: span 12; }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .menu-toggle {
        display: block !important;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-item.span-3,
    .dashboard-item.span-4,
    .dashboard-item.span-6,
    .dashboard-item.span-8,
    .dashboard-item.span-9,
    .dashboard-item.span-12 { grid-column: span 1; }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 3px;
        font-size: 0.75rem;
    }
    
    .calendar-day .day-record {
        font-size: 0.6rem;
        padding: 1px 2px;
    }
    
    .calendar-day .record-icon {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .auth-card {
        margin: 10px;
    }
    
    .calorie-circle {
        width: 150px;
        height: 150px;
    }
}

/* ========== Print ========== */
@media print {
    .sidebar,
    .btn,
    .modal,
    .loading-overlay {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}

/* ========== Custom Scrollbar ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========== Animations ========== */
.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ========== Menu Toggle ========== */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.menu-toggle i {
    font-size: 1.25rem;
    color: var(--text-primary);
}

/* ========== Date Picker ========== */
.date-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.date-input-group input[type="date"] {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
}

/* ========== Tabs ========== */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab,
.tab-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    border: none;
    background: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    text-decoration: none;
}

.tab:hover,
.tab-item:hover {
    color: var(--primary);
}

.tab.active,
.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ========== Nutrient Bar ========== */
.nutrient-bar {
    margin-bottom: 15px;
}

.nutrient-bar .label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 5px;
}

.nutrient-bar .label .name {
    font-weight: 500;
    color: var(--text-secondary);
}

.nutrient-bar .label .value {
    color: var(--text-muted);
}

.nutrient-bar .progress {
    height: 6px;
}

/* ========== Meal Cards ========== */
.meal-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.meal-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.meal-card-header {
    padding: 15px;
    background: rgba(0,0,0,0.02);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.meal-card-header h4 {
    margin: 0;
    font-size: 1rem;
}

.meal-card-body {
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.meal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.meal-item:last-child {
    border-bottom: none;
}

.meal-item-info .name {
    font-weight: 500;
    color: var(--text-primary);
}

.meal-item-info .portion {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.meal-item-calories {
    text-align: right;
}

.meal-item-calories .cal {
    font-weight: 600;
    color: var(--primary);
}

.meal-item-calories .unit {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== Exercise Cards ========== */
.exercise-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 15px;
    margin-bottom: 15px;
    transition: var(--transition);
}

.exercise-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.exercise-card .header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.exercise-card .name {
    font-weight: 600;
    color: var(--text-primary);
}

.exercise-card .duration {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.exercise-card .stats {
    display: flex;
    gap: 20px;
    font-size: 0.875rem;
}

.exercise-card .stats span {
    color: var(--text-muted);
}

.exercise-card .stats strong {
    color: var(--text-primary);
    margin-left: 5px;
}

/* ========== Toast Notifications ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 15px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.25rem;
}

/* ========== Admin Specific ========== */
.admin-sidebar .section-title {
    padding: 10px 20px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.status-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-badge.active .dot { background: var(--success); }
.status-badge.inactive .dot { background: var(--danger); }
.status-badge.pending .dot { background: var(--warning); }

/* ========== Quick Actions ========== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.quick-action-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.quick-action-btn i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.quick-action-btn span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========== Weight Trend ========== */
.weight-change {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
}

.weight-change.positive { color: var(--success); }
.weight-change.negative { color: var(--danger); }

.weight-change i {
    font-size: 1.25rem;
}

/* ========== Weight Progress ========== */
.weight-progress {
    background: var(--bg-main);
    border-radius: var(--border-radius);
    padding: 15px;
}

.weight-progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.weight-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.weight-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.weight-item .value {
    font-size: 1rem;
    font-weight: 600;
}

.weight-progress-bar {
    margin-top: 10px;
}

.weight-lost {
    margin-top: 10px;
    text-align: center;
    font-size: 0.875rem;
}

.stat-card.success {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    color: white;
}

.stat-card.success .label,
.stat-card.success .change {
    color: rgba(255, 255, 255, 0.9);
}

.stat-card.success .unit {
    color: rgba(255, 255, 255, 0.7);
}

.stat-card.warning {
    background: linear-gradient(135deg, #FF9800 0%, #E65100 100%);
    color: white;
}

.stat-card.warning .label,
.stat-card.warning .change {
    color: rgba(255, 255, 255, 0.9);
}

.stat-card.warning .unit {
    color: rgba(255, 255, 255, 0.7);
}

/* 表單內聯樣式 */
.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.form-inline .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-inline .form-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* 響應式標籤 */
@media (max-width: 768px) {
    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab, .tab-item {
        padding: 10px 15px;
        font-size: 0.8rem;
        white-space: nowrap;
    }
}

