/* 移动端样式 - 适配各品牌手机 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #5a6fd6;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* 登录页面 */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.login-header .logo {
    font-size: 60px;
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 500;
}

.login-box {
    background: white;
    padding: 30px 25px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
}

/* 移动端容器 */
.mobile-container {
    min-height: 100vh;
    padding-bottom: 70px;
}

/* 顶部导航 */
.mobile-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.mobile-header h1 {
    font-size: 18px;
    font-weight: 500;
}

.back-btn {
    color: white;
    text-decoration: none;
    font-size: 24px;
    padding: 5px;
}

.placeholder {
    width: 30px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.logout-btn {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 15px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-icon {
    color: white;
    text-decoration: none;
    font-size: 20px;
    padding: 5px;
}

/* 主内容区 */
.mobile-main {
    padding: 15px;
}

/* 统计区域 */
.stats-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 15px 10px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:active {
    transform: scale(0.95);
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 统计栏 */
.stats-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-item.warning .stat-number {
    color: var(--danger-color);
}

.stat-number {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.filter-tag {
    padding: 8px 16px;
    background: white;
    border-radius: 20px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.filter-tag.active {
    background: var(--primary-color);
    color: white;
}

.badge-count {
    display: inline-block;
    background: var(--danger-color);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
}

/* 快捷操作 */
.quick-actions {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.quick-actions h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-primary);
    padding: 15px 10px;
    border-radius: 12px;
    background: var(--bg-color);
    transition: transform 0.2s;
}

.action-item:active {
    transform: scale(0.95);
}

.action-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.action-item span {
    font-size: 13px;
}

/* 时间提示 */
.time-notice {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.time-notice h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.time-notice p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

/* 仪表盘提醒卡片 */
.reminder-dashboard-card {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border: 1px solid #ffc107;
    border-radius: 12px;
    padding: 15px 20px;
    margin: 0 15px 20px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
    transition: all 0.3s ease;
}

.reminder-dashboard-card:active {
    transform: scale(0.98);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 193, 7, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

.reminder-icon-large {
    font-size: 32px;
    margin-right: 15px;
    flex-shrink: 0;
}

.reminder-content {
    flex: 1;
}

.reminder-title {
    font-size: 16px;
    font-weight: 600;
    color: #856404;
    margin-bottom: 4px;
}

.reminder-desc {
    font-size: 13px;
    color: #856404;
}

.reminder-desc strong {
    color: #dc3545;
    font-size: 18px;
}

.reminder-arrow {
    font-size: 24px;
    color: #856404;
    margin-left: 10px;
}

/* 底部导航 */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-secondary);
    padding: 5px 15px;
    transition: color 0.3s;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 22px;
    margin-bottom: 2px;
}

.nav-text {
    font-size: 11px;
}

/* 表单样式 */
.mobile-form {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.form-group .required {
    color: var(--danger-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    background: white;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-secondary);
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    -webkit-appearance: checkbox;
    appearance: checkbox;
}

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

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s;
    -webkit-appearance: none;
    appearance: none;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-large {
    padding: 15px 24px;
    font-size: 16px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    background: #a0aec0;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

/* 提示框 */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    position: relative;
}

.alert-dismissible {
    padding-right: 40px;
}

.close-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
}

.close-btn:hover {
    opacity: 1;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
}

/* 患者列表 */
.patient-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.patient-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s;
}

.patient-card:active {
    transform: scale(0.98);
}

.patient-card.reminder {
    border-left: 4px solid var(--danger-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--bg-color);
}

.patient-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.patient-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

.patient-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.patient-date {
    font-size: 13px;
    color: var(--text-secondary);
}

.card-body {
    margin-bottom: 12px;
}

.info-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.info-label {
    color: var(--text-secondary);
    margin-right: 8px;
    min-width: 60px;
}

.info-value {
    color: var(--text-primary);
}

.status-badges {
    display: flex;
    gap: 8px;
}

.card-actions {
    display: flex;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--bg-color);
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.action-btn.phone {
    background: #d1ecf1;
    color: #0c5460;
}

.action-btn.visit {
    background: #d4edda;
    color: #155724;
}

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

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--bg-color);
}

.submit-time {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:active {
    background: #138496;
}

/* 表格容器 */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow-x: auto;
    margin: 10px;
}

/* 数据表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border: 1px solid #e0e0e0;
}

.data-table thead {
    background: var(--primary-color);
    color: white;
}

.data-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.3);
    border-bottom: 2px solid #0056b3;
}

.data-table td {
    padding: 10px 8px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.data-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.data-table tbody tr:hover {
    background: #e3f2fd;
}

.data-table tbody tr:active {
    background: #bbdefb;
}

.table-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.table-actions .btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

/* 提醒样式 */
.reminder-row {
    background: #fff3cd !important;
}

.reminder-row td {
    border-color: #ffc107 !important;
}

.reminder-badge {
    display: inline-block;
    margin-left: 5px;
    font-size: 14px;
    cursor: help;
}

.reminder-notice {
    animation: pulse 2s infinite;
}

.return-type-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin-top: 15px;
}

.page-btn {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.page-btn:active {
    background: var(--primary-dark);
    transform: scale(0.95);
}

.page-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    background: white;
    border-radius: 12px;
}

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

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* 区块标题 */
.form-section,
.list-section {
    margin-bottom: 20px;
}

.form-section h3,
.list-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-primary);
    padding-left: 5px;
    border-left: 3px solid var(--primary-color);
}

/* 列表容器 */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 回访卡片 */
.return-visit-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* 位置按钮组 */
.location-buttons {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.location-buttons .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
}

/* 链接 */
.link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 13px;
}

.text-small {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 导出栏 */
.export-bar {
    margin: 10px;
    text-align: right;
}

/* 加载动画 */
.btn-loading {
    display: inline-block;
}

/* 适配小屏幕手机 */
@media (max-width: 320px) {
    html {
        font-size: 14px;
    }
    
    .stats-section {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .stat-card {
        padding: 12px 8px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .action-grid {
        gap: 10px;
    }
    
    .action-icon {
        font-size: 28px;
    }
    
    .nav-text {
        font-size: 10px;
    }
}

/* 适配平板 */
@media (min-width: 768px) {
    .mobile-container {
        max-width: 768px;
        margin: 0 auto;
    }
    
    .stats-section {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* iPhone X+ 适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .mobile-container {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }
}

/* 打印样式 */
@media print {
    .mobile-nav,
    .mobile-header,
    .back-btn,
    .action-buttons {
        display: none !important;
    }
    
    .mobile-container {
        padding-bottom: 0;
    }
}
