/* 移动端基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
    background: white;
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
}

.coach-app {
    min-height: 100vh;
    position: relative;
    background: white;
}

/* 加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
    color: #4a90e2;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    font-size: 14px;
    color: #666;
}

/* 错误页面 */
.error-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    padding: 20px;
}

.error-content {
    text-align: center;
    max-width: 300px;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.error-message {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

.retry-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
    min-width: 100px;
}

.retry-btn:hover {
    background: #357abd;
}

.retry-btn:active {
    transform: scale(0.98);
}

/* 头部区域 */
.header {
    background: white;
    color: #333;
    padding: 20px 15px;
    border-radius: 0;
    box-shadow: none;
    position: relative;
}

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

.coach-info {
    flex: 1;
    min-width: 0;
}

.coach-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.today-date {
    font-size: 14px;
    color: #666;
}

.refresh-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.refresh-btn:hover {
    background: #e0e3e8;
    transform: scale(1.1);
}

.refresh-btn:active {
    transform: scale(0.95);
}

.refresh-icon {
    font-size: 18px;
    transition: transform 0.6s;
}

.refresh-btn.rotating .refresh-icon {
    transform: rotate(360deg);
}

/* 摘要卡片 */
.summary-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    justify-content: space-around;
    border: 1px solid #e8e8e8;
}

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

.summary-number {
    display: block;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #4a90e2;
}

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

/* 主内容区 */
.main-content {
    min-height: 100vh;
    background: white;
}

.lessons-container {
    padding: 20px 15px 80px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-title h2 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

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

/* 无课程提示 */
.no-lessons {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-lessons-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.no-lessons h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #333;
}

.no-lessons p {
    font-size: 14px;
    color: #666;
}

/* 课程卡片列表 */
.lessons-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* =================== 极简单行课程卡片 =================== */
.lesson-card-minimal {
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid #4a90e2;
    margin-bottom: 8px;

    display: flex;
    align-items: center;
    gap: 16px;
}

.lesson-card-minimal:active {
    opacity: 0.9;
    transform: scale(0.99);
}

/* 时间 */
.lesson-time-minimal {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    min-width: 100px;
}

/* 学员姓名 */
.lesson-student-minimal {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 已完成状态 */
.lesson-card-minimal.completed {
    opacity: 0.6;
    background: #fafafa;
    border-left-color: #28a745;
}

.lesson-card-minimal.completed .lesson-time-minimal,
.lesson-card-minimal.completed .lesson-student-minimal {
    color: #999;
    text-decoration: line-through;
}

/* 已取消状态 */
.lesson-card-minimal.cancelled {
    opacity: 0.5;
    background: #fff5f5;
    border-left-color: #dc3545;
}

.lesson-card-minimal.cancelled .lesson-time-minimal,
.lesson-card-minimal.cancelled .lesson-student-minimal {
    color: #ccc;
    text-decoration: line-through;
}

/* 待上课状态（默认） */
.lesson-card-minimal.pending {
    border-left-color: #4a90e2;
}

/* 旧版课程卡片样式（保留以防需要） */
.lesson-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
    border-left: 4px solid #4a90e2;
}

.lesson-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.lesson-card:active {
    transform: translateY(0);
    opacity: 0.9;
}

.lesson-card.completed {
    opacity: 0.85;
    background: #f8f9fa;
    border-left-color: #28a745;
}

.lesson-card.cancelled {
    opacity: 0.7;
    background: #fff5f5;
    border-left-color: #dc3545;
}

/* 状态标签 */
.status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    color: white;
    white-space: nowrap;
}

.status-badge.pending {
    background: #ff9500;
}

.status-badge.completed {
    background: #28a745;
}

.status-badge.cancelled {
    background: #dc3545;
}

/* 时间显示 */
.lesson-time {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding-right: 80px; /* 为状态标签留空间 */
}

.time-icon {
    margin-right: 6px;
    opacity: 0.7;
}

.time-range {
    font-size: 16px;
    font-weight: 600;
    color: #4a90e2;
}

.time-duration {
    font-size: 12px;
    color: #999;
    margin-left: 8px;
}

/* 学员信息 */
.lesson-student {
    margin-bottom: 8px;
}

.student-name {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.student-phone {
    font-size: 13px;
    color: #666;
}

/* 课程信息 */
.lesson-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    color: #666;
    font-size: 13px;
    margin-bottom: 8px;
}

.lesson-info-item {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 6px;
}

.lesson-info-item span:first-child {
    margin-right: 4px;
}

/* 费用信息 */
.lesson-fee {
    text-align: right;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.fee-amount {
    font-size: 16px;
    font-weight: 600;
    color: #ff6b35;
}

/* 底部工具栏 */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e8e8e8;
    display: flex;
    gap: 8px;
    justify-content: center;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    padding: 0 15px;
    height: 65px;
}

.footer-item {
    flex: 0 0 auto;
    min-width: 70px;
    max-width: 90px;
    text-align: center;
    padding: 12px 18px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    margin: 8px 0;
}

.footer-item:hover {
    background: #f5f5f5;
}

.footer-item:active {
    background: #e9ecef;
    transform: scale(0.95);
}

.footer-label {
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

/* Toast提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    max-width: 80%;
    text-align: center;
}

.toast.show {
    opacity: 1;
}

/* 课程详情弹窗 */
.lesson-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.lesson-detail-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.lesson-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e8e8e8;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.lesson-detail-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.close-btn:hover {
    background: #e9ecef;
}

.lesson-detail-body {
    padding: 20px;
}

.detail-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.detail-section h4 {
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
    font-weight: 500;
}

.detail-section p {
    font-size: 15px;
    color: #333;
    margin-bottom: 4px;
}

/* 响应式设计 */
@media (max-width: 375px) {
    .header {
        padding: 15px 12px;
    }

    .lessons-container {
        padding: 15px 12px 80px;
    }

    .lesson-card {
        padding: 14px;
    }

    .summary-card {
        padding: 12px;
    }

    .coach-name {
        font-size: 18px;
    }

    .summary-number {
        font-size: 20px;
    }

    /* 极简卡片响应式 */
    .lesson-card-minimal {
        padding: 10px 14px;
        gap: 12px;
    }

    .lesson-time-minimal {
        font-size: 14px;
        min-width: 90px;
    }

    .lesson-student-minimal {
        font-size: 14px;
    }
}

/* 针对iPhone X系列的安全区域 */
@supports (padding: max(0px)) {
    .footer {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

/* 滚动条优化 */
::-webkit-scrollbar {
    width: 3px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

/* 触摸反馈优化 */
.lesson-card:active,
.footer-item:active,
.refresh-btn:active,
.retry-btn:active {
    transition: none;
}

/* 动画性能优化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .coach-app {
        background: #1a1a1a;
    }

    .main-content {
        background: #1a1a1a;
    }

    .lesson-card {
        background: #2d2d2d;
        color: #e0e0e0;
        border-left-color: #4a90e2;
    }

    .lesson-card.completed {
        background: #2a2a2a;
    }

    .lesson-card.cancelled {
        background: #2d2525;
    }

    .section-title h2 {
        color: #e0e0e0;
    }

    .student-name {
        color: #e0e0e0;
    }

    .lesson-info-item {
        background: #3a3a3a;
        color: #b0b0b0;
    }

    .footer {
        background: #2d2d2d;
        border-top-color: #404040;
    }

    .footer-label {
        color: #b0b0b0;
    }
}

/* 加载状态优化 */
.lesson-card.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}
/* =================== 日期选择器样式 =================== */
.date-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: transparent;
    border-radius: 12px;
    margin: 10px 15px 0;
    box-shadow: none;
}

.date-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #4a90e2;
    color: white;
    border-radius: 8px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.date-btn:active {
    transform: scale(0.95);
    opacity: 0.8;
}

.date-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 0 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.date-display:active {
    background: #e9ecef;
}

.date-icon {
    font-size: 18px;
    margin-right: 8px;
}

.date-text {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

/* 响应式调整 */
/* =================== 视图容器 =================== */
.view-container {
    min-height: calc(100vh - 140px);
    padding-bottom: 60px;
}

/* =================== 马匹计划页面 =================== */
.horse-plan-container {
    padding: 15px;
    padding-bottom: 80px;
}

/* 任务区块 */
.task-section {
    margin-bottom: 25px;
}

.section-title-simple {
    font-size: 17px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    padding-left: 0;
}

/* 任务列表 */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 任务卡片 */
.task-card {
    background: white;
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border-left: 3px solid #4a90e2;
    cursor: pointer;
    transition: all 0.2s ease;
}

.task-card:active {
    opacity: 0.9;
    transform: scale(0.99);
}

/* 今日任务标记为紧急 */
.task-card.urgent {
    border-left-color: #ff9500;
    background: #fffaf0;
}

/* 任务头部 */
.task-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

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

.task-type {
    font-size: 14px;
    color: #666;
    padding: 2px 8px;
    background: #f0f2f5;
    border-radius: 4px;
}

/* 时间提示 */
.task-time {
    font-size: 13px;
    color: #ff9500;
    margin-bottom: 6px;
    font-weight: 500;
}

/* 备注 */
.task-note {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.task-note-label {
    color: #999;
    margin-right: 4px;
}

/* 无数据提示 */
.no-data {
    text-align: center;
    padding: 50px 20px;
}

.no-data-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.no-data p {
    color: #999;
    font-size: 14px;
}

@media (max-width: 375px) {
    .date-selector {
        padding: 10px 12px;
    }

    .date-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .date-display {
        padding: 6px 12px;
        margin: 0 8px;
    }

    .date-text {
        font-size: 14px;
    }
}
