/* Cdiscount AI 用户端 - 绿色主题 */
:root {
    --primary-50: #ECFDF5;
    --primary-100: #D1FAE5;
    --primary-200: #A7F3D0;
    --primary-400: #34D399;
    --primary-500: #10B981;
    --primary-600: #059669;
    --primary-700: #047857;
    --primary-800: #065F46;
    --primary-900: #064E3B;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
}

a {
    color: var(--primary-600);
    text-decoration: none;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}

.btn-ghost:hover {
    background: var(--gray-100);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* 输入框 */
.input {
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: white;
    transition: all 0.2s;
}

.input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* 卡片 */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* 标签 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-success {
    background: var(--primary-100);
    color: var(--primary-700);
}

.badge-warning {
    background: #FEF3C7;
    color: #B45309;
}

.badge-error {
    background: #FEE2E2;
    color: #B91C1C;
}

.badge-info {
    background: #DBEAFE;
    color: #1D4ED8;
}

/* 布局 */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary-800), var(--primary-900));
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: var(--primary-400);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.sidebar-brand {
    font-size: 1.125rem;
    font-weight: 600;
}

.sidebar-brand span {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.7;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    border-left: 3px solid var(--primary-400);
    padding-left: calc(1.5rem - 3px);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-400);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.user-role {
    font-size: 0.75rem;
    opacity: 0.7;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

.page-header {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.page-body {
    padding: 1.5rem 2rem;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.green {
    background: var(--primary-100);
    color: var(--primary-600);
}

.stat-icon.blue {
    background: #DBEAFE;
    color: #2563EB;
}

.stat-icon.yellow {
    background: #FEF3C7;
    color: #D97706;
}

.stat-icon.red {
    background: #FEE2E2;
    color: #DC2626;
}

.stat-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-content p {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* 对话列表 */
.discussions-container {
    display: grid;
    grid-template-columns: 320px 1fr 300px;
    gap: 1.5rem;
    height: calc(100vh - 140px);
}

.discussion-list {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.discussion-list-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.discussion-list-body {
    flex: 1;
    overflow-y: auto;
}

.discussion-item {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: all 0.2s;
}

.discussion-item:hover,
.discussion-item.active {
    background: var(--primary-50);
}

.discussion-item.active {
    border-left: 3px solid var(--primary-500);
}

.discussion-customer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.discussion-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-100);
    color: var(--primary-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.discussion-name {
    font-weight: 500;
}

.discussion-time {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-left: auto;
}

.discussion-preview {
    font-size: 0.875rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.discussion-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* 聊天面板 */
.chat-panel {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.chat-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: var(--gray-50);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    max-width: 70%;
}

.message.customer {
    align-self: flex-start;
}

.message.seller {
    align-self: flex-end;
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    line-height: 1.5;
}

.message.customer .message-bubble {
    background: white;
    box-shadow: var(--shadow);
}

.message.seller .message-bubble {
    background: var(--primary-500);
    color: white;
}

.message-time {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

.message.seller .message-time {
    text-align: right;
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid var(--gray-100);
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chat-input textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 0.75rem;
    font-size: 0.875rem;
    min-height: 44px;
    max-height: 120px;
    font-family: inherit;
}

.chat-input textarea:focus {
    outline: none;
    border-color: var(--primary-500);
}

/* AI建议 */
.ai-suggestion {
    background: linear-gradient(135deg, var(--primary-50), #ECFDF5);
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin: 0 1rem 1rem;
}

.ai-suggestion-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--primary-700);
    font-weight: 500;
    font-size: 0.875rem;
}

.ai-suggestion-content {
    font-size: 0.875rem;
    color: var(--gray-700);
    background: white;
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--primary-100);
    white-space: pre-wrap;
}

.ai-suggestion-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* 订单面板 */
.order-panel {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.order-panel-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
    font-weight: 600;
}

.order-panel-body {
    padding: 1rem;
}

.order-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
}

.order-row:last-child {
    border-bottom: none;
}

.order-label {
    color: var(--gray-500);
}

.order-value {
    font-weight: 500;
}

/* 登录页 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-800), var(--primary-600));
    padding: 2rem;
}

.login-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: var(--primary-400);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin: 0 auto 1.5rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.5rem;
}

.login-form .input-wrapper {
    position: relative;
}

.login-form .input-wrapper i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.login-form .input {
    padding-left: 2.75rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid transparent;
}

.login-form .input:focus {
    background: white;
    border-color: var(--primary-400);
}

.login-form .btn-primary {
    width: 100%;
    padding: 0.875rem;
    background: white;
    color: var(--primary-700);
}

.login-form .btn-primary:hover {
    background: var(--primary-50);
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

.login-error {
    background: #FEE2E2;
    color: #B91C1C;
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    text-align: center;
    font-size: 0.875rem;
}

/* 加载 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

/* 响应式 */
@media (max-width: 1200px) {
    .discussions-container {
        grid-template-columns: 280px 1fr;
    }

    .order-panel {
        display: none;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .discussions-container {
        grid-template-columns: 1fr;
    }
}