/* 颐护之翼 - 网页版样式 */
/* 橙色温暖主题 + 老年友好设计 */

/* ========== 基础变量 ========== */
:root {
    --primary: #FF7A3D;
    --primary-light: #FF9A5C;
    --primary-dark: #E55A20;
    --primary-bg: #FFF8F5;
    --border: #FFE8DD;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-hint: #999999;
    --white: #FFFFFF;
    --shadow: 0 4px 20px rgba(255, 122, 61, 0.15);
    --radius: 16px;
    --radius-lg: 24px;
}

/* ========== 基础样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* ========== 页面容器 ========== */
.page {
    display: none;
    min-height: 100vh;
    padding-bottom: 80px;
}

.page.active {
    display: block;
}

/* ========== 登录页面 ========== */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 30px;
    background: linear-gradient(180deg, #FFF8F5 0%, #FFFFFF 100%);
}

.login-header {
    text-align: center;
    margin-bottom: 50px;
}

.logo {
    font-size: 64px;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    font-size: 16px;
    color: var(--text-hint);
}

.login-form {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
}

.form-title {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-primary);
}

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

.input-group input {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--primary);
}

.verify-group {
    display: flex;
    gap: 12px;
}

.verify-group input {
    flex: 1;
}

.send-code-btn {
    padding: 0 20px;
    font-size: 14px;
    color: var(--primary);
    background: var(--primary-bg);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

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

.send-code-btn:disabled {
    background: var(--border);
    border-color: var(--border);
    color: var(--text-hint);
    cursor: not-allowed;
}

.login-btn {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    font-weight: 600;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255, 122, 61, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 122, 61, 0.5);
}

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

.login-tip {
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-hint);
    text-align: center;
}

.login-tip .link {
    color: var(--primary);
    cursor: pointer;
}

.login-footer {
    margin-top: 40px;
    text-align: center;
    color: var(--text-hint);
    font-size: 14px;
}

.login-footer .phone {
    font-size: 20px;
    color: var(--primary);
    font-weight: 600;
    margin-top: 8px;
}

/* ========== 头部 ========== */
.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    padding: 20px 30px;
    padding-top: max(20px, env(safe-area-inset-top));
}

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

.greeting-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
}

.user-name {
    color: var(--white);
    font-size: 20px;
    font-weight: 600;
}

.profile-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    border: none;
    font-size: 20px;
    cursor: pointer;
}

/* ========== 快捷服务 ========== */
.quick-services {
    padding: 20px 20px;
}

.quick-services h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.service-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.service-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 2px 8px rgba(255, 122, 61, 0.2);
}

.service-item span {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ========== AI助手入口 ========== */
.ai-assistant {
    margin: 16px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 122, 61, 0.35);
}

.assistant-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 600;
    color: var(--white);
}

.assistant-info {
    flex: 1;
}

.assistant-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--white);
}

.assistant-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
}

.start-chat {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.25);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--white);
}

.arrow {
    color: inherit;
}

/* ========== 健康资讯 ========== */
.health-tips {
    padding: 0 20px;
}

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

.tips-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.more {
    font-size: 14px;
    color: var(--primary);
    cursor: pointer;
}

.tips-list {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.tip-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--primary-bg);
    cursor: pointer;
}

.tip-card:last-child {
    border-bottom: none;
}

.tip-card:hover {
    background: var(--primary-bg);
}

.tip-content {
    flex: 1;
}

.tip-title {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

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

.tip-card .arrow {
    font-size: 20px;
    color: var(--text-hint);
    margin-left: 12px;
}

/* ========== 底部导航 ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--white);
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
    cursor: pointer;
    color: var(--text-hint);
    font-size: 11px;
    transition: color 0.2s;
}

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

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

/* ========== 聊天页面 ========== */
.chat-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    padding: 16px 20px;
    padding-top: max(16px, env(safe-area-inset-top));
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    border: none;
    font-size: 24px;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--white);
    font-size: 18px;
    font-weight: 600;
}

.title-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.clear-btn {
    padding: 6px 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 16px;
    cursor: pointer;
}

.chat-messages {
    height: calc(100vh - 130px - env(safe-area-inset-bottom));
    overflow-y: auto;
    padding: 20px;
    background: var(--primary-bg);
}

/* 欢迎消息 */
.welcome-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.welcome-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--white);
}

.welcome-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.welcome-desc {
    font-size: 14px;
    color: var(--text-hint);
}

/* 快捷问题 */
.quick-questions {
    margin-bottom: 20px;
}

.quick-label {
    font-size: 13px;
    color: var(--text-hint);
    margin-bottom: 12px;
}

.quick-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.quick-btn {
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(255, 122, 61, 0.08);
    transition: all 0.2s;
}

.quick-btn:hover {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
}

/* 消息样式 */
.message-item {
    display: flex;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

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

.message-item.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.message-item.user .message-avatar {
    background: linear-gradient(135deg, var(--primary-light), #FFB088);
    color: var(--white);
    margin-left: 10px;
}

.message-item.assistant .message-avatar {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    margin-right: 10px;
}

.message-content {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}

.message-item.user .message-content {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    border-bottom-right-radius: 6px;
}

.message-item.assistant .message-content {
    background: var(--white);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 加载动画 */
.loading-dots {
    display: flex;
    gap: 6px;
    padding: 14px 18px;
    background: var(--white);
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.loading-dots .dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dots .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* 聊天输入区域 */
.chat-input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: var(--white);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
}

.chat-input-area input {
    flex: 1;
    padding: 14px 20px;
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: 50px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-area input:focus {
    border-color: var(--primary);
}

.send-btn {
    padding: 0 24px;
    font-size: 16px;
    font-weight: 600;
    color: var(--white);
    background: var(--border);
    border: none;
    border-radius: 50px;
    cursor: not-allowed;
    transition: all 0.2s;
}

.send-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 122, 61, 0.35);
}

/* ========== 订单页面 ========== */
.page-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    padding: 16px 20px;
    padding-top: max(16px, env(safe-area-inset-top));
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-header h1 {
    flex: 1;
    color: var(--white);
    font-size: 18px;
    font-weight: 600;
}

.tabs {
    display: flex;
    background: var(--white);
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
}

.tab-item {
    flex: 1;
    padding: 14px 0;
    text-align: center;
    font-size: 15px;
    color: var(--text-hint);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.tab-item.active {
    color: var(--primary);
    font-weight: 600;
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.orders-content {
    padding: 20px;
    min-height: calc(100vh - 200px);
}

.order-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--primary-bg);
    margin-bottom: 14px;
}

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

.department {
    font-size: 13px;
    color: var(--text-hint);
}

.order-status {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 12px;
}

.status-ongoing {
    background: #FFF3E0;
    color: #FF9800;
}

.status-completed {
    background: #E8F5E9;
    color: #4CAF50;
}

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

.order-info div {
    margin-bottom: 6px;
}

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

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

.order-price {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
}

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

.action-btn {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 16px;
    cursor: pointer;
    border: none;
}

.action-btn.secondary {
    background: var(--primary-bg);
    color: var(--primary);
    border: 1px solid var(--border);
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
}

/* 无订单 */
.empty-orders {
    text-align: center;
    padding: 60px 20px;
}

.empty-orders .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-orders p {
    color: var(--text-hint);
    font-size: 15px;
    margin-bottom: 20px;
}

.empty-orders .go-chat {
    display: inline-block;
    padding: 12px 28px;
    font-size: 15px;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(255, 122, 61, 0.35);
    cursor: pointer;
}

/* ========== 个人中心 ========== */
.profile-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    padding: 30px 20px;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.profile-detail .name {
    font-size: 20px;
    font-weight: 600;
    color: var(--white);
}

.profile-detail .phone {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
}

.profile-content {
    padding: 20px;
}

.member-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.member-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.member-icon {
    font-size: 28px;
}

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

.member-desc {
    font-size: 12px;
    color: var(--text-hint);
}

.member-btn {
    padding: 8px 16px;
    font-size: 13px;
    color: var(--white);
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border: none;
    border-radius: 16px;
    cursor: pointer;
}

.menu-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--primary-bg);
    cursor: pointer;
    transition: background 0.2s;
}

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

.menu-item:hover {
    background: var(--primary-bg);
}

.menu-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: 14px;
}

.menu-item span:nth-child(2) {
    flex: 1;
    font-size: 16px;
    color: var(--text-primary);
}

.menu-item .arrow {
    font-size: 18px;
    color: var(--text-hint);
}

.logout-btn {
    width: 100%;
    padding: 16px;
    margin-top: 20px;
    font-size: 16px;
    color: #FF6B6B;
    background: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    box-shadow: var(--shadow);
}

/* ========== Toast提示 ========== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 14px 28px;
    font-size: 15px;
    color: var(--white);
    background: rgba(0, 0, 0, 0.75);
    border-radius: 50px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.toast.show {
    opacity: 1;
}

/* ========== 确认弹窗 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    width: 80%;
    max-width: 320px;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.modal-message {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    font-size: 16px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

.modal-btn.cancel {
    background: var(--primary-bg);
    color: var(--text-secondary);
}

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

/* ========== 响应式 ========== */
@media (max-width: 375px) {
    .service-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .message-content {
        max-width: 85%;
    }
}
