/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* CSS变量 - 粉色主题 */
:root {
    --primary-color: #ff69b4;
    --primary-light: #ffb3d9;
    --primary-dark: #e6007a;
    --secondary-color: #ffc0cb;
    --accent-color: #ff1493;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(255, 105, 180, 0.1);
    --shadow-hover: 0 4px 20px rgba(255, 105, 180, 0.2);
}

/* 管理后台布局 */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
    width: 250px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* 动态菜单样式 */
.logo {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

.logo img {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    display: block;
    object-fit: cover;
}

.logo h2 {
    font-size: 20px;
    font-weight: bold;
    color: white;
    margin: 0;
}

.nav-menu {
    padding: 20px 0;
}

.nav-item {
    display: block;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    margin-bottom: 5px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-left-color: white;
    font-weight: 600;
}

.nav-icon {
    margin-right: 10px;
    font-size: 16px;
}

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

/* 兼容原有样式 */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

.sidebar-logo {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-title {
    font-size: 20px;
    font-weight: bold;
    color: white;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    margin-bottom: 5px;
}

.nav-link {
    display: block;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: white;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-left-color: white;
    font-weight: 600;
}

/* 主内容区样式 */
.main-content {
    flex: 1;
    margin-left: 250px;
    background: #f8f9fa;
}

.header {
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.header-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

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

.logout-btn {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.logout-btn:hover {
    color: var(--primary-dark);
}

.content {
    padding: 30px;
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, #fff, #fafafa);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #343a40;
    margin: 0;
}

.card-body {
    padding: 30px;
}

/* 统计卡片样式 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table th {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

table td {
    padding: 15px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

table tr:hover {
    background: #f8f9fa;
}

table tr:last-child td {
    border-bottom: none;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

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

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--accent-color));
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    margin-top: 30px;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success-color);
    color: white;
    margin-top: 10px;
}

.btn-warning {
    background: var(--warning-color);
    color: #212529;
}

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

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

.btn-lg {
    padding: 15px 30px;
    font-size: 16px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 105, 180, 0.1);
}

/* 搜索栏样式 */
.search-bar {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
}

.search-bar .form-group {
    margin: 0;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-bar .form-group label {
    margin-bottom: 0;
    white-space: nowrap;
    font-weight: 500;
}

.search-bar .form-group select,
.search-bar .form-group input {
    width: auto;
    min-width: 120px;
    flex: 1;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.pagination a:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination .current {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #fff, #fafafa);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--danger-color);
    color: white;
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    background: #f8f9fa;
}

/* 聊天记录样式 */
.chat-records {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    background: #f8f9fa;
}

.chat-message {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-message.user {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    color: white;
    margin-left: 20px;
}

.chat-message.assistant {
    background: white;
    margin-right: 20px;
}

.chat-time {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 5px;
}

.chat-content {
    font-size: 14px;
    line-height: 1.4;
}

/* 富文本编辑器样式 */
.rich-editor {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.editor-toolbar {
    background: #f8f9fa;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.editor-btn {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

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

.editor-content {
    min-height: 200px;
    padding: 15px;
    outline: none;
    font-size: 14px;
    line-height: 1.6;
}

/* 状态标签样式 */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: white;
}

.status-active {
    background: var(--success-color);
}

.status-inactive {
    background: var(--text-light);
}

.status-pending {
    background: var(--warning-color);
    color: #212529;
}

.status-error {
    background: var(--danger-color);
}

/* 工具提示样式 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 加载动画样式 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 105, 180, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 登录页面样式 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(255, 105, 180, 0.3);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-title {
    font-size: 28px;
    font-weight: bold;
    color: #000000;
    margin-bottom: 10px;
}

.login-subtitle {
    color: var(--text-light);
    margin-bottom: 30px;
}

.login-form .form-group {
    text-align: left;
    margin-bottom: 25px;
}

.login-form input {
    padding: 15px 20px;
    font-size: 16px;
    border-radius: 10px;
}

.login-btn {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    margin-top: 10px;
}

.captcha-container {
    display: flex;
    gap: 15px;
    align-items: center;
}

.captcha-input {
    flex: 1;
}

.captcha-image {
    width: 100px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header {
        padding: 15px 20px;
    }
    
    .content {
        padding: 20px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .search-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-bar .form-group {
        min-width: auto;
    }
    
    .content-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    table {
        font-size: 12px;
    }
    
    table th,
    table td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 20px;
    }
    
    .card-header {
        padding: 15px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .login-card {
        padding: 30px 20px;
    }
    
    .login-title {
        font-size: 24px;
    }
}

/* 打印样式 */
@media print {
    .sidebar,
    .header-actions,
    .btn,
    .pagination {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    body {
        background: white;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: #f8f9fa;
        --text-light: #adb5bd;
        --border-color: #495057;
        --light-color: #343a40;
    }
    
    body {
        background-color: #212529;
        color: #f8f9fa;
    }
    
    .card,
    .modal-content {
        background: #343a40;
        color: #f8f9fa;
    }
    
    .header {
        background: #343a40;
        border-bottom-color: #495057;
    }
    
    table {
        background: #343a40;
    }
    
    table tr:hover {
        background: #495057;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        background: #495057;
        color: #f8f9fa;
        border-color: #6c757d;
    }
    
    .chat-message.assistant {
        background: #495057;
        color: #f8f9fa;
    }
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高对比度支持 */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #d63384;
        --border-color: #000;
        --shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .card {
        border: 2px solid var(--border-color);
    }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Firefox滚动条 */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f1f1f1;
}