/* 基础样式 */
* {
    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;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* 导航栏样式 */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo {
    font-size: 1.5em;
    font-weight: 700;
    color: #667eea;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo:hover {
    color: #764ba2;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-links a {
    color: #555;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.nav-links a:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

/* 搜索模式切换 */
.nav-search-modes {
    display: flex;
    gap: 10px;
    margin-right: 20px;
}

.nav-mode-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: #f5f5f5;
    border-radius: 20px;
    text-decoration: none;
    color: #666;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.nav-mode-btn:hover {
    background: #e8e8e8;
}

.nav-mode-btn.active {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* 用户登录区域 */
#user-info,
#login-link {
    display: flex;
    align-items: center;
    gap: 15px;
}

#user-info {
    display: none;
    align-items: center;
    gap: 12px;
    background: rgba(102, 126, 234, 0.1);
    padding: 6px 16px;
    border-radius: 20px;
}

#username {
    font-weight: 500;
    color: #667eea;
}

#user-info button {
    padding: 6px 14px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s ease;
}

#user-info button:hover {
    background: #ff5252;
}

/* 主内容区 */
.main-content {
    min-height: calc(100vh - 70px - 100px);
    padding: 20px;
}

/* 底部样式 */
.footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px 20px;
    text-align: center;
    margin-top: 50px;
}

.footer-content {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.footer-section {
    text-align: left;
    min-width: 200px;
}

.footer-section h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

.footer-section p {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.quick-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.quick-links a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.quick-links a:hover {
    color: #5a6fd6;
    text-decoration: underline;
}

.link-divider {
    color: #ccc;
}

.disclaimer {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.copyright {
    color: #999;
    font-size: 0.85em;
}

/* ==================== 登录/注册页面样式 ==================== */

/* 认证容器 */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 70px - 100px);
    padding: 40px 20px;
}

/* 认证盒子 */
.auth-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-box h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 1.8em;
}

/* 表单组 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 0.95em;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 表单错误提示 */
.form-error {
    color: #e74c3c;
    font-size: 0.9em;
    margin-bottom: 15px;
    min-height: 20px;
}

/* 按钮样式 */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* 认证链接 */
.auth-links {
    text-align: center;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #eee;
}

.auth-links p {
    margin: 10px 0;
    color: #666;
}

.auth-links a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* ==================== 管理后台样式 ==================== */

/* 管理页面布局 */
.admin-page {
    display: flex;
    min-height: calc(100vh - 70px);
}

/* 侧边栏 */
.admin-sidebar {
    width: 250px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    padding: 20px 0;
    flex-shrink: 0;
}

.admin-sidebar h3 {
    padding: 0 20px 15px;
    margin: 0 0 15px 0;
    border-bottom: 1px solid #eee;
    color: #333;
    font-size: 1.1em;
}

.admin-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-sidebar li {
    margin: 0;
}

.admin-sidebar a {
    display: block;
    padding: 12px 20px;
    color: #555;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.admin-sidebar a:hover {
    background: #f5f5f5;
    color: #667eea;
}

.admin-sidebar a.active {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border-left-color: #667eea;
    font-weight: 500;
}

/* 管理内容区 */
.admin-content {
    flex: 1;
    padding: 30px;
    background: #f9f9f9;
    min-height: calc(100vh - 70px);
}

.admin-content h1 {
    margin-bottom: 25px;
    color: #333;
    font-size: 1.8em;
}

/* 统计网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
}

.stat-card h4 {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
    font-weight: 500;
}

.stat-value {
    font-size: 2em;
    font-weight: 700;
    color: #667eea;
    margin: 0;
}

/* 管理区块 */
.admin-section {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 25px;
}

.admin-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3em;
}

/* 数据表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.search-box {
    display: flex;
    gap: 10px;
}

.search-box input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    width: 250px;
}

.search-box button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.search-box button:hover {
    background: #5a6fd6;
}

/* 按钮样式 */
.btn-secondary {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-text {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.btn-text:hover {
    text-decoration: underline;
}

/* 表格状态 */
.loading, .empty, .error {
    text-align: center;
    padding: 40px;
    color: #666;
}

.error {
    color: #dc3545;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.pagination button:hover:not(:disabled) {
    background: #5a6fd6;
}

.pagination button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.pagination span {
    color: #666;
}

/* 危险按钮 */
.btn-danger {
    padding: 10px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-danger:hover {
    background: #c82333;
}

/* 编辑/删除按钮 */
.btn-edit {
    color: #28a745;
    margin-left: 8px;
}

.btn-delete {
    color: #dc3545;
    margin-left: 8px;
}

/* 操作列链接样式 */
.data-table td:last-child {
    white-space: nowrap;
}

.action-link {
    display: inline-block;
    font-size: 14px;
    text-decoration: none;
    margin-right: 12px;
    cursor: pointer;
}

.action-link:last-child {
    margin-right: 0;
}

.action-link.edit {
    color: #1890ff;
}

.action-link.edit:hover {
    color: #40a9ff;
    text-decoration: underline;
}

.action-link.delete {
    color: #ff4d4f;
}

.action-link.delete:hover {
    color: #ff7875;
    text-decoration: underline;
}

/* 复诊记录样式 */
.form-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.form-section h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

.no-visits {
    color: #999;
    font-style: italic;
    padding: 10px 0;
}

.visit-item {
    background: #f8f9fa;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.visit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.visit-no {
    font-weight: 600;
    color: #667eea;
}

.btn-remove {
    background: #ff4d4f;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-remove:hover {
    background: #ff7875;
}

/* 必填项标记 */
.required {
    color: #ff4d4f;
    margin-left: 4px;
}

/* 成功按钮 */
.btn-success {
    background: #52c41a;
    color: white;
}

.btn-success:hover {
    background: #73d13d;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content.modal-large {
    max-width: 800px;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #333;
}

.modal-header .close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-header .close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 15px 20px;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
        margin-top: 15px;
    }

    .nav-search-modes {
        margin-right: 0;
    }

    .auth-box {
        padding: 30px 20px;
    }

    .admin-page {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .admin-content {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
