/* ============================================
   AI智能商铺营销利器 - 全新简洁风格
   ============================================ */

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --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;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-800);
    background-color: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   登录/注册页面
   ============================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-header {
    padding: 1rem 1.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
}

.auth-header .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--gray-800);
    font-weight: 600;
    font-size: 1.125rem;
}

.auth-header .logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
}

.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-box {
    width: 100%;
    max-width: 400px;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-title {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.auth-title p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: all 0.2s;
    background: var(--white);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input-group {
    display: flex;
    gap: 0.5rem;
}

.form-input-group .form-input {
    flex: 1;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-200);
}

.btn-block {
    width: 100%;
    padding: 0.75rem;
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
}

/* 复选框 */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 1rem 0;
}

.form-check input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin-top: 0.125rem;
    accent-color: var(--primary);
}

.form-check label {
    font-size: 0.8125rem;
    color: var(--gray-600);
}

.form-check a {
    color: var(--primary);
    text-decoration: none;
}

.form-check a:hover {
    text-decoration: underline;
}

/* 分隔线 */
.divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--gray-400);
    font-size: 0.8125rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

.divider span {
    padding: 0 1rem;
}

/* 链接 */
.auth-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--gray-600);
}

.auth-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* 页脚 */
.auth-footer {
    padding: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--gray-400);
    border-top: 1px solid var(--gray-200);
}

/* ============================================
   工作台页面
   ============================================ */
.workspace-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部导航 */
.workspace-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 1rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.workspace-header .logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--gray-800);
    font-weight: 600;
}

.workspace-header .logo-icon {
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 0.75rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    transition: all 0.2s;
}

.header-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

/* 主内容区 */
.workspace-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
}

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

.chat-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
}

.chat-title {
    flex: 1;
}

.chat-title h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-800);
}

.chat-title p {
    font-size: 0.75rem;
    color: var(--success);
}

.chat-title p::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    margin-right: 0.375rem;
}

/* 消息列表 */
.chat-messages {
    flex: 3;
    overflow-y: auto;
    padding: 1rem 1.25rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--gray-600);
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--primary);
    color: var(--white);
}

.message-content {
    background: var(--gray-100);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--gray-700);
}

.message.user .message-content {
    background: var(--primary);
    color: var(--white);
}

.message-time {
    font-size: 0.6875rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

/* 输入区域 */
.chat-input {
    flex: 1;
    min-height: 140px;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-100);
    background: var(--white);
}

.input-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.input-area {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.input-area textarea {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    font-family: inherit;
}

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

.send-btn {
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    background: var(--primary-dark);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--white);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    max-height: calc(85vh - 60px);
}

/* 列表样式 */
.list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.list-item:hover {
    background: var(--gray-50);
}

.list-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.list-content {
    flex: 1;
}

.list-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-800);
}

.list-desc {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.125rem;
}

/* ============================================
   移动端适配
   ============================================ */
@media (max-width: 640px) {
    .auth-box {
        padding: 1.5rem;
        border-radius: 0;
        box-shadow: none;
        min-height: calc(100vh - 120px);
    }
    
    .auth-main {
        padding: 0;
    }
    
    .workspace-main {
        padding: 0;
    }
    
    .chat-container {
        border-radius: 0;
        box-shadow: none;
        height: calc(100vh - 56px);
        min-height: 0;
    }
    
    .modal {
        max-width: 100%;
    }
}

/* 安全区域适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .auth-footer {
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }
}
