/* 后台管理系统通用样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4B7BFF;
    --success-color: #26DE81;
    --warning-color: #FFA502;
    --danger-color: #FF4757;
    --info-color: #45AAF2;
    --purple-color: #8B5CF6;
    
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --text-light: #999;
    
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --border-color: #e5e5e5;
    
    --sidebar-width: 260px;
    --header-height: 64px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

.admin-page {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.logo-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

.logo-text {
    font-size: 16px;
    font-weight: 600;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

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

.menu-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: white;
    border-radius: 0 4px 4px 0;
}

.menu-icon {
    font-size: 20px;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.admin-name {
    font-size: 14px;
    font-weight: 600;
}

.admin-role {
    font-size: 12px;
    opacity: 0.8;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.btn-menu-toggle {
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

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

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb-item {
    color: var(--text-secondary);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-primary);
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.header-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.notification-btn .badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    font-weight: 600;
}

.logout-btn {
    width: auto;
    padding: 0 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

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

.page-title h1 {
    font-size: 28px;
    font-weight: 600;
}

.page-title p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 按钮样式 */
.btn-primary {
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(75, 123, 255, 0.3);
}

.btn-action {
    padding: 6px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-action.btn-danger:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

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

.badge-success {
    background: rgba(38, 222, 129, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(255, 165, 2, 0.1);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(255, 71, 87, 0.1);
    color: var(--danger-color);
}

/* 占位内容 */
.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    background: white;
    border-radius: 12px;
}

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

.placeholder-content p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}




/* 弹窗样式 */
.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: 10000;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-dialog {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s;
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

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

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.required {
    color: #e74c3c;
    margin-left: 2px;
}

.btn-secondary {
    padding: 10px 20px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: #999;
}

/* 响应式 */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-dialog {
        width: 95%;
        max-height: 95vh;
    }
}

/* ==================== 客服系统样式 ==================== */

/* 菜单角标 */
.menu-badge {
    position: absolute;
    top: 8px;
    right: 16px;
    min-width: 20px;
    height: 20px;
    background: #ff4757;
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* 客服容器 */
.service-container {
    display: flex;
    height: calc(100vh - 180px);
    gap: 20px;
    margin-top: 20px;
}

/* 会话列表 */
.conversation-list {
    width: 350px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.conversation-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.conversation-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.conversation-stats {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.conversation-stats .separator {
    color: #ddd;
}

.conversation-stats strong {
    color: var(--text-primary);
    font-weight: 600;
}

.conversation-items {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.conversation-item:hover {
    background: #f8f9fa;
}

.conversation-item.active {
    background: #e3f2fd;
}

.conversation-item.unread::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--danger-color);
    border-radius: 50%;
}

.conv-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

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

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

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

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

.conv-message {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conv-unread {
    min-width: 20px;
    height: 20px;
    background: var(--danger-color);
    color: white;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.empty-state-service {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state-service .service-icon {
    font-size: 64px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* 聊天区域 */
.chat-area {
    flex: 1;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

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

.chat-active {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.user-status {
    font-size: 13px;
    color: var(--success-color);
}

.chat-actions {
    display: flex;
    gap: 12px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-primary);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #e0e0e0;
}

/* 消息区域 */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    min-height: 0;
}

.message-date {
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    margin: 16px 0;
}

.message-item {
    display: flex;
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease;
}

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

.message-item.received {
    flex-direction: row;
}

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

.msg-avatar {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.message-item.received .msg-avatar {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    margin-right: 10px;
}

.message-item.sent .msg-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    margin-left: 10px;
}

.msg-content {
    max-width: 60%;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-item.received .msg-content {
    background: #FFF;
    color: #000;
    border-radius: 0 8px 8px 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-item.sent .msg-content {
    background: #95EC69;
    color: #000;
    border-radius: 8px 0 8px 8px;
}

.msg-image,
.msg-video {
    max-width: 200px;
    max-height: 200px;
    border-radius: 6px;
    cursor: pointer;
}

.message-item.sent .msg-image,
.message-item.sent .msg-video,
.message-item.received .msg-image,
.message-item.received .msg-video {
    padding: 0;
    background: transparent;
}

/* 输入区域 */
.input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: white;
}

.input-tools {
    display: flex;
    gap: 8px;
}

.tool-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: none;
    border: none;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.tool-btn:hover {
    background: var(--bg-primary);
}

.message-textarea {
    flex: 1;
    min-height: 36px;
    max-height: 100px;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

.message-textarea:focus {
    border-color: var(--primary-color);
}

.send-button {
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    border: none;
    border-radius: 6px;
    font-size: 20px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s;
}

.send-button:hover {
    opacity: 0.9;
}

/* 客服系统响应式 */
@media (max-width: 1024px) {
    .conversation-list {
        width: 300px;
    }
    
    .msg-content {
        max-width: 70%;
    }
}

@media (max-width: 768px) {
    .service-container {
        flex-direction: column;
    }
    
    .conversation-list {
        width: 100%;
        height: 300px;
    }
}
