/* public/css/app.css - Shopee Assistant 现代极速控制台样式表 */

:root {
    --primary: #ee4d2d;
    --primary-hover: #d73211;
    --primary-light: #fff5f2;
    --primary-border: #ffd8cc;
    --dark: #0f172a;
    --dark-card: #1e293b;
    --gray-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--gray-bg);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* 头部导航 */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}
.nav-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--dark);
    text-decoration: none;
}
.brand-logo span { color: var(--primary); }
.brand-badge {
    font-size: 0.65rem;
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    border: 1px solid var(--primary-border);
}

.nav-tabs {
    display: flex;
    gap: 0.25rem;
    height: 100%;
}
.nav-tab-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.85rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    height: 60px;
}
.nav-tab-btn:hover {
    color: var(--dark);
    background: rgba(0, 0, 0, 0.02);
}
.nav-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-light);
}

/* 主内容容器 */
.main-wrapper {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.25rem;
    flex: 1;
    width: 100%;
}

/* 按钮规范 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.25;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-outline {
    background: #ffffff;
    color: var(--text-main);
    border-color: var(--border-color);
}
.btn-outline:hover { background: #f1f5f9; border-color: #cbd5e1; }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }
.btn-info { background: #2563eb; color: #fff; }
.btn-info:hover { background: #1d4ed8; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; border-radius: var(--radius-md); }

/* 卡片样式 */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-color);
}
.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* =========================================================================
   AI 对话工作台高级布局
========================================================================= */
.ai-studio-grid {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 1.25rem;
    height: calc(100vh - 120px);
    min-height: 680px;
}
@media (max-width: 1024px) {
    .ai-studio-grid { grid-template-columns: 1fr; height: auto; }
}

.chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #f8fafc;
}
.chat-bubble {
    max-width: 90%;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    line-height: 1.6;
    word-break: break-word;
}
.chat-bubble.ai {
    align-self: flex-start;
    background: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    border-bottom-left-radius: 2px;
}
.chat-bubble.user {
    align-self: flex-end;
    background: var(--primary);
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

/* AI 思考步骤胶囊 */
.ai-step-indicator {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}
.step-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #475569;
    font-weight: 600;
}
.step-item.done { color: #10b981; }

/* 聊天气泡内嵌商品快照卡片 */
.chat-product-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin-top: 0.75rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.chat-product-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}
.chat-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.chat-quick-presets {
    padding: 0.5rem 0.85rem;
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    white-space: nowrap;
}
.preset-tag {
    font-size: 0.75rem;
    background: #f1f5f9;
    color: var(--text-main);
    padding: 3px 9px;
    border-radius: 99px;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    transition: all 0.15s;
    font-weight: 500;
}
.preset-tag:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary-border); }

.chat-input-area {
    padding: 0.75rem;
    background: #ffffff;
    border-top: 1px solid var(--border-color);
}
.chat-textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.65rem;
    font-size: 0.875rem;
    font-family: inherit;
    resize: none;
    height: 72px;
    outline: none;
    transition: border-color 0.15s;
}
.chat-textarea:focus { border-color: var(--primary); }

/* 铺货草稿控制台 (Draft Console) */
.draft-panel {
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 利润率动态滑块控制器 */
.margin-slider-box {
    background: #fff8f6;
    border: 1px solid var(--primary-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
}
.margin-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: #fed7aa;
    outline: none;
}
.margin-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 4px rgba(0,0,0,0.2);
}

.pricing-metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}
.metric-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    text-align: center;
}
.metric-box .label { font-size: 0.7rem; color: var(--text-muted); }
.metric-box .val { font-size: 1.1rem; font-weight: 800; color: var(--primary); }

.image-preview-strip {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding: 0.4rem 0;
}
.image-preview-card {
    position: relative;
    width: 95px;
    height: 95px;
    border-radius: var(--radius-sm);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    flex-shrink: 0;
    background: #f1f5f9;
}
.image-preview-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.image-watermark-tag {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(238, 77, 45, 0.95);
    color: #fff;
    font-size: 0.6rem;
    font-weight: bold;
    text-align: center;
    padding: 2px;
}

/* 规格矩阵表格 */
.variation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.variation-table th, .variation-table td {
    border: 1px solid #e2e8f0;
    padding: 6px 8px;
    text-align: left;
}
.variation-table th { background: #f8fafc; font-weight: 600; color: #475569; }

/* 订单卡片与表格 */
.order-group-card {
    margin-bottom: 1.25rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.order-group-header {
    background: #1e293b;
    color: #ffffff;
    padding: 0.85rem 1.15rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.order-item-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.order-item-row:last-child { border-bottom: none; }
.order-item-img {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

/* 状态 Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
}
.badge-ready { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-processed { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-shipped { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-default { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

/* 实时终端日志框 */
.terminal-box {
    background: #0f172a;
    color: #38bdf8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.78rem;
    padding: 0.85rem;
    border-radius: var(--radius-sm);
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.4;
    border: 1px solid #1e293b;
}

/* 加载动画 Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}
.spinner-primary {
    border-color: rgba(238, 77, 45, 0.2);
    border-top-color: var(--primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================================
   悬浮操作按钮 (Floating Action Button - FAB)
========================================================================= */
.floating-tutorial-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #ee4d2d 0%, #ff6b4a 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: 999px;
    border: 2px solid #ffffff;
    box-shadow: 0 10px 25px -5px rgba(238, 77, 45, 0.5), 0 8px 10px -6px rgba(238, 77, 45, 0.3);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fab-glow 3s infinite;
}
.floating-tutorial-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 15px 30px -5px rgba(238, 77, 45, 0.6), 0 10px 12px -6px rgba(238, 77, 45, 0.4);
    background: linear-gradient(135deg, #d73211 0%, #ee4d2d 100%);
}
.floating-tutorial-btn .fab-badge {
    background: #ffffff;
    color: #ee4d2d;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 1px 6px;
    border-radius: 99px;
    text-transform: uppercase;
}
@keyframes fab-glow {
    0%, 100% { box-shadow: 0 10px 25px -5px rgba(238, 77, 45, 0.4); }
    50% { box-shadow: 0 15px 35px -2px rgba(238, 77, 45, 0.7); }
}

/* =========================================================================
   教程与指南全屏模态窗口 (Tutorial Modal)
========================================================================= */
.tutorial-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.tutorial-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.tutorial-modal-container {
    background: #ffffff;
    width: 100%;
    max-width: 920px;
    max-height: 90vh;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tutorial-modal-overlay.active .tutorial-modal-container {
    transform: scale(1) translateY(0);
}
.tutorial-modal-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #ffffff;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tutorial-modal-nav {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
}
.tutorial-nav-btn {
    padding: 0.45rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.tutorial-nav-btn:hover {
    color: #0f172a;
    background: #f1f5f9;
}
.tutorial-nav-btn.active {
    color: #ee4d2d;
    background: #fff5f2;
    border-color: #ffd8cc;
    font-weight: 700;
}
.tutorial-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: #ffffff;
}

/* 教程步骤卡片 */
.tutorial-step-card {
    display: flex;
    gap: 1.25rem;
    padding: 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 1rem;
    transition: all 0.2s;
}
.tutorial-step-card:hover {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.tutorial-step-number {
    width: 38px;
    height: 38px;
    background: #ee4d2d;
    color: #ffffff;
    font-weight: 900;
    font-size: 1.1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(238, 77, 45, 0.3);
}

/* Prompt 模板卡片 */
.prompt-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    transition: all 0.2s;
}
.prompt-card:hover {
    border-color: #ee4d2d;
    background: #fffdfd;
}
.prompt-text-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #334155;
    margin: 0.5rem 0;
    font-family: inherit;
    line-height: 1.5;
}

/* =========================================================================
   右侧草稿面板直接输入与店铺选择组件
========================================================================= */
.cost-weight-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.85rem;
}
.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}
.input-with-unit input {
    width: 100%;
    padding: 0.55rem 2.2rem 0.55rem 0.65rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    outline: none;
    transition: all 0.15s;
}
.input-with-unit input:focus {
    border-color: #ee4d2d;
    box-shadow: 0 0 0 3px rgba(238, 77, 45, 0.15);
}
.input-unit-suffix {
    position: absolute;
    right: 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #94a3b8;
    pointer-events: none;
}

/* 店铺选择卡片组件 */
.shop-select-group {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.85rem;
}
.shop-tag-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
    transition: all 0.15s;
}
.shop-tag-item:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}
.shop-tag-item.selected {
    border-color: #ee4d2d;
    background: #fff5f2;
    color: #ee4d2d;
}
.shop-tag-item input[type="checkbox"] {
    accent-color: #ee4d2d;
    width: 14px;
    height: 14px;
    cursor: pointer;
}
