/* Amazon Ops Platform - 主样式 */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f6fa;
  min-height: 100vh;
  color: #2d3748;
}

/* ============ 登录页（独占整个视口） ============ */
.container {
  min-height: 100vh;
}
#loginCard {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#loginCard .login-card { display: none; } /* 让下面卡片样式生效，#loginCard 本身做背景 */
.login-card { background: white; border-radius: 12px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.login-card h1 { font-size: 24px; margin-bottom: 8px; color: #2d3748; }
.login-card .subtitle { color: #718096; font-size: 14px; margin-bottom: 32px; }

/* 通用按钮 */
.btn { padding: 10px 16px; background: #667eea; color: white; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.btn:hover { background: #5568d3; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-full { width: 100%; padding: 12px; }
.btn-secondary { background: #e2e8f0; color: #4a5568; }
.btn-secondary:hover { background: #cbd5e0; }
.btn-danger { background: #e53e3e; }
.btn-danger:hover { background: #c53030; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-outline { background: white; color: #667eea; border: 1px solid #667eea; }
.btn-outline:hover { background: #ebf4ff; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: #4a5568; margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px;
  font-size: 14px; transition: all 0.2s; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}
.form-group input:disabled { background: #f7fafc; color: #a0aec0; cursor: not-allowed; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.help { font-size: 12px; color: #718096; margin-top: 4px; }

.msg { font-size: 13px; margin-top: 10px; text-align: center; min-height: 18px; }
.msg.error { color: #e53e3e; }
.msg.success { color: #38a169; }
.msg.info { color: #3182ce; }

/* ============ 主框架 ============ */
.app-shell { display: none; min-height: 100vh; flex-direction: column; }
.app-header {
  background: white;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand a { text-decoration: none; color: #2d3748; display: flex; align-items: center; gap: 8px; }
.brand-logo { font-size: 22px; }
.brand-name { font-weight: 600; font-size: 16px; }
.breadcrumb { flex: 1; color: #718096; font-size: 14px; }
.breadcrumb a { color: #667eea; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 8px; color: #cbd5e0; }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; background: #f7fafc; border-radius: 24px; cursor: pointer; transition: all 0.2s; }
.user-chip:hover { background: #edf2f7; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #667eea, #764ba2); display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-chip-name { font-size: 14px; color: #2d3748; font-weight: 500; }

.page-content { flex: 1; padding: 28px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ============ 工作台 ============ */
.workbench-section { margin-bottom: 32px; }
.workbench-section h2 { font-size: 14px; color: #718096; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 14px; font-weight: 600; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.tool-card { background: white; border-radius: 12px; padding: 22px; cursor: pointer; transition: all 0.2s; box-shadow: 0 2px 10px rgba(0,0,0,0.05); border: 1px solid #edf2f7; }
.tool-card:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(102,126,234,0.15); border-color: #c3dafe; }
.tool-card .icon { width: 44px; height: 44px; background: linear-gradient(135deg, #667eea, #764ba2); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: white; font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.tool-card.cat-admin .icon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.tool-card.cat-ops .icon { background: linear-gradient(135deg, #10b981, #059669); }
.tool-card.cat-amazon .icon { background: linear-gradient(135deg, #f97316, #ea580c); }
.tool-card h3 { font-size: 15px; margin-bottom: 6px; }
.tool-card p { font-size: 13px; color: #718096; line-height: 1.5; }

.empty { background: white; border-radius: 12px; padding: 60px 20px; text-align: center; color: #a0aec0; }

/* ============ 页面标题 ============ */
.page-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title h1 { font-size: 22px; }
.page-title .actions { display: flex; gap: 10px; }

/* ============ 表格 ============ */
.data-table { width: 100%; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.data-table table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 14px 18px; text-align: left; font-size: 14px; }
.data-table th { background: #f7fafc; color: #4a5568; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table tr { border-bottom: 1px solid #edf2f7; }
.data-table tr:last-child { border-bottom: none; }
.data-table tr:hover { background: #f7fafc; }
.data-table .actions-cell { white-space: nowrap; text-align: right; }
.data-table .actions-cell button { margin-left: 6px; }

.badge { display: inline-block; padding: 2px 8px; background: #ebf4ff; color: #5568d3; border-radius: 4px; font-size: 11px; margin-right: 4px; }
.badge.super { background: #fef3c7; color: #92400e; }
.badge.success { background: #d1fae5; color: #065f46; }
.badge.muted { background: #edf2f7; color: #718096; }

.search-bar { display: flex; gap: 10px; margin-bottom: 18px; }
.search-bar input { flex: 1; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 14px; }
.search-bar input:focus { outline: none; border-color: #667eea; }

/* ============ 抽屉（用户中心） ============ */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 100; display: none; animation: fadeIn 0.2s ease; }
.drawer-backdrop.open { display: block; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 100%; max-width: 460px; background: #f7fafc; z-index: 101; transform: translateX(100%); transition: transform 0.3s ease; overflow-y: auto; }
.drawer.open { transform: translateX(0); }
.drawer-header { background: linear-gradient(135deg, #667eea, #764ba2); color: white; padding: 32px 28px 60px; position: relative; }
.drawer-header h2 { font-size: 18px; margin-bottom: 4px; }
.drawer-header p { font-size: 13px; opacity: 0.85; }
.drawer-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.2); border: none; color: white; font-size: 20px; cursor: pointer; line-height: 1; }
.drawer-close:hover { background: rgba(255,255,255,0.3); }
.drawer-body { padding: 0 24px 24px; }
.avatar-section { display: flex; flex-direction: column; align-items: center; margin-top: -42px; margin-bottom: 24px; }
.avatar-large { width: 84px; height: 84px; border-radius: 50%; background: linear-gradient(135deg, #667eea, #764ba2); display: flex; align-items: center; justify-content: center; color: white; font-size: 32px; font-weight: 600; border: 4px solid #f7fafc; overflow: hidden; position: relative; cursor: pointer; }
.avatar-large img { width: 100%; height: 100%; object-fit: cover; }
.avatar-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); color: white; font-size: 11px; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; }
.avatar-large:hover .avatar-overlay { opacity: 1; }
.avatar-actions { margin-top: 12px; display: flex; gap: 8px; }
.avatar-actions button { font-size: 12px; padding: 6px 12px; border-radius: 6px; cursor: pointer; border: 1px solid #cbd5e0; background: white; color: #4a5568; }
.avatar-actions button:hover { background: #edf2f7; }

.card { background: white; border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.card h3 { font-size: 14px; color: #4a5568; margin-bottom: 14px; font-weight: 600; letter-spacing: 0.5px; }

/* ============ Modal（编辑用户等） ============ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { background: white; border-radius: 12px; padding: 28px; max-width: 540px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 30px 60px rgba(0,0,0,0.25); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid #edf2f7; }
.modal-header h2 { font-size: 18px; }
.modal-close { background: none; border: none; font-size: 24px; color: #a0aec0; cursor: pointer; line-height: 1; }
.modal-close:hover { color: #4a5568; }
.modal-footer { margin-top: 22px; display: flex; justify-content: flex-end; gap: 10px; }

/* 多选框列表（角色、店铺） */
.checkbox-list { max-height: 180px; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px; background: #f7fafc; }
.checkbox-list label { display: flex; align-items: center; padding: 6px 8px; cursor: pointer; border-radius: 4px; font-size: 14px; }
.checkbox-list label:hover { background: #edf2f7; }
.checkbox-list input { width: auto; margin-right: 10px; }

/* ============ 广告生成器（5 步） ============ */
.wizard-step { background: white; border-radius: 12px; padding: 24px; margin-bottom: 18px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.wizard-step h2 { font-size: 16px; margin-bottom: 6px; color: #2d3748; display: flex; align-items: center; gap: 10px; }
.wizard-step h2 .step-num { width: 28px; height: 28px; background: #667eea; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.wizard-step .step-desc { color: #718096; font-size: 13px; margin-bottom: 16px; }

.upload-area { display: flex; gap: 14px; }
.upload-box { flex: 1; border: 2px dashed #cbd5e0; border-radius: 10px; padding: 22px; text-align: center; cursor: pointer; transition: all 0.2s; background: #f7fafc; }
.upload-box:hover { border-color: #667eea; background: #ebf4ff; }
.upload-box.has-file { border-color: #38a169; background: #f0fff4; }
.upload-box-label { font-size: 13px; color: #4a5568; margin-bottom: 6px; font-weight: 500; }
.upload-box-filename { font-size: 12px; color: #38a169; word-break: break-all; }
.upload-box-hint { font-size: 12px; color: #a0aec0; }
.upload-box input { display: none; }

.placement-row { display: grid; grid-template-columns: 2fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: end; }
.placement-row button { background: #fed7d7; color: #c53030; border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.placement-row button:hover { background: #feb2b2; }

.preview-box { background: #ebf4ff; color: #3c4d8a; padding: 14px 18px; border-radius: 8px; font-size: 14px; margin: 16px 0; line-height: 1.6; }
.preview-box strong { color: #2c4475; }

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

/* 占位页 */
.placeholder { background: white; border-radius: 12px; padding: 60px 30px; text-align: center; }
.placeholder h2 { color: #4a5568; margin-bottom: 10px; }
.placeholder p { color: #718096; margin-bottom: 20px; }

/* 加载中 */
.loading { text-align: center; padding: 40px; color: #a0aec0; }
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid #e2e8f0; border-top-color: #667eea; border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
