/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */

/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html {
  color: #222;
  font-size: 1em;
  line-height: 1.4;
}

::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

::selection {
  background: #b3d4fc;
  text-shadow: none;
}

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

textarea {
  resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

/* ==========================================================================
   App layout
   ========================================================================== */

.app-layout {
  display: flex;
  flex-direction: column;
  max-width: 960px;
  height: 100vh;
  max-height: 700px;
  margin: 40px auto;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   Top navigation styles
   ========================================================================== */

.top-nav {
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 52px;
  background: #fafbfc;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
  gap: 16px;
}

.top-nav-brand {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}

.top-nav-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}

.top-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

/* ==========================================================================
   Top nav user / logout
   ========================================================================== */

#topNavRight .user-info {
  font-size: 13px;
  color: #555;
  font-weight: 500;
}

#topNavRight .btn-logout {
  background: none;
  border: 1px solid #ddd;
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: #999;
  transition: color 0.2s, border-color 0.2s;
}

#topNavRight .btn-logout:hover {
  color: #e53935;
  border-color: #e53935;
}

/* ==========================================================================
   Sidebar styles
   ========================================================================== */

.sidebar {
  width: 280px;
  min-width: 280px;
  background: #fafbfc;
  border-right: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease, min-width 0.25s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #e8e8e8;
  white-space: nowrap;
}

.sidebar-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.sidebar-close-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #999;
  padding: 4px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  background: #eee;
  color: #333;
}

/* Tab 导航 */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid #e8e8e8;
  white-space: nowrap;
}

.sidebar-tab {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  cursor: pointer;
  color: #888;
  transition: color 0.2s, border-color 0.2s;
}

.sidebar-tab:hover {
  color: #555;
}

.sidebar-tab.active {
  color: #4a90d9;
  border-bottom-color: #4a90d9;
  font-weight: 500;
}

/* 面板容器 */
.sidebar-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-panel.active {
  display: flex;
}

/* 衣库面板内容可滚动 */
#panelWardrobe {
  overflow-y: auto;
}

.panel-header {
  padding: 12px 16px 8px;
  font-size: 12px;
  color: #999;
  white-space: nowrap;
}

/* ---------- 聊天历史 ---------- */
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
}

.chat-history-item {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
  margin-bottom: 4px;
}

.chat-history-item:hover {
  background: #f0f2f5;
}

.chat-history-item .h-preview {
  font-size: 14px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.chat-history-item .h-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

.chat-history-item .h-type {
  font-size: 11px;
  color: #4a90d9;
}

.chat-history-item .h-time {
  font-size: 11px;
  color: #bbb;
}

.chat-history-empty {
  text-align: center;
  color: #ccc;
  font-size: 13px;
  padding: 40px 0;
}

/* ---------- 衣库管理 ---------- */
.wardrobe-section {
  padding: 12px 16px;
}

.wardrobe-section + .wardrobe-section {
  border-top: 1px solid #eee;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #555;
}

.section-count {
  font-size: 12px;
  color: #999;
  font-weight: 400;
}

.btn-refresh-section {
  padding: 3px 10px;
  background: #f0f0f0;
  border: none;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 8px;
  transition: background 0.2s;
}

.btn-refresh-section:hover {
  background: #e0e0e0;
}

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

/* 按钮行容器 */
.section-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

/* 新增按钮 */
.btn-add-section {
  padding: 3px 10px;
  background: #e3f2fd;
  border: none;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-add-section:hover {
  background: #bbdefb;
}

/* 衣库网格 */
.wardrobe-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  white-space: normal;
}

.wardrobe-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #ccc;
  font-size: 12px;
  padding: 20px 0;
}

.wardrobe-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #eee;
  cursor: pointer;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
}

.wardrobe-card:hover {
  border-color: #4a90d9;
}

/* 卡片标签 */
.card-tags {
  position: absolute;
  bottom: 4px;
  left: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.card-tag {
  font-size: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
}

.wardrobe-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 用户画像卡片显示完整图片 */
.wardrobe-card.wardrobe-card-portrait img {
  object-fit: contain;
  background: #f5f7fa;
}

.wardrobe-card .card-placeholder {
  font-size: 32px;
  opacity: 0.4;
}

.wardrobe-card .card-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.wardrobe-card:hover .card-delete {
  display: flex;
}

.wardrobe-card .card-delete:hover {
  background: rgba(198, 40, 40, 0.85);
}

/* ==========================================================================
   Chat styles
   ========================================================================== */

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;     /* ← 新增：和 .wardrobe-container 同理，约束内部 flex 高度，让 .chat-messages 正确滚动 */
}

/* 衣库管理主区域 */
.wardrobe-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;     /* ← 新增：确保内部 flex 子项有确定的高度约束，让 .wardrobe-body 能正确滚动 */
  background: #f5f7fa;
}

.wardrobe-header {
  padding: 16px 20px;
  background: #4a90d9;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.wardrobe-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 16px;
}

.chat-header {
  padding: 16px 20px;
  background: #4a90d9;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.sidebar-open-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-open-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f5f7fa;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 消息气泡 */
.message {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 16px;
  position: relative;
  animation: msgFadeIn 0.2s ease;
}

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

.message.user {
  align-self: flex-end;
  background: #4a90d9;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.system {
  align-self: flex-start;
  background: #e8ecf1;
  color: #333;
  border-bottom-left-radius: 4px;
}

.message .msg-time {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 4px;
  text-align: right;
}

.message .file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: underline;
  margin-top: 4px;
  word-break: break-all;
}

.message .file-link:hover {
  opacity: 0.85;
}

/* 上传进度提示 */
.upload-progress {
  align-self: flex-end;
  background: #e3f2fd;
  color: #1565c0;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: msgFadeIn 0.2s ease;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #bbdefb;
  border-top: 2px solid #1565c0;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.upload-error {
  align-self: flex-end;
  background: #ffebee;
  color: #c62828;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
}

/* 思考中指示器 */
.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #888;
}

/* 输入提示 */
.chat-input-hint {
  padding: 6px 16px;
  font-size: 12px;
  color: #999;
  background: #fafbfc;
  border-top: 1px solid #eee;
  text-align: center;
  line-height: 1.4;
}

/* 输入区域 */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e8e8e8;
  background: #fff;
}

.chat-input-area input[type="text"] {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 24px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input-area input[type="text"]:focus {
  border-color: #4a90d9;
}

.btn {
  border: none;
  border-radius: 24px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:active {
  transform: scale(0.95);
}

.btn-send {
  padding: 10px 20px;
  background: #4a90d9;
  color: #fff;
  font-weight: 500;
}

.btn-send:hover {
  background: #3a7bc8;
}

.btn-send:disabled {
  background: #b0cfe8;
  cursor: not-allowed;
}

.btn-upload {
  width: 40px;
  height: 40px;
  background: #f0f0f0;
  font-size: 18px;
  border-radius: 50%;
}

.btn-upload:hover {
  background: #e4e4e4;
}

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

.btn-upload-portrait {
  background: #e3f2fd;
  color: #1565c0;
}

.btn-upload-portrait:hover {
  background: #bbdefb;
}

.btn-upload-clothing {
  background: #fce4ec;
  color: #c62828;
}

.btn-upload-clothing:hover {
  background: #f8bbd0;
}

/* 聊天区分类标签 */
.chat-tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 12px;
  align-items: center;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
}

.chat-tag-label {
  font-size: 14px;
  color: #999;
  white-space: nowrap;
  margin-right: 4px;
}

.chat-tag {
  font-size: 15px;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 5px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.chat-tag:hover {
  background: #c8e6c9;
}

.chat-tag:active {
  transform: scale(0.95);
}

.chat-tag.selected {
  background: #2e7d32;
  color: #fff;
}

/* 聊天区空数据提示 */
.chat-empty-tips {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-empty-tip {
  font-size: 13px;
  color: #888;
  background: #fef8e7;
  border: 1px solid #f5e6b8;
  border-radius: 8px;
  padding: 10px 14px;
  line-height: 1.5;
}

/* ==========================================================================
   Login styles
   ========================================================================== */

.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.login-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
  animation: loginSlideUp 0.5s ease;
}

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

.login-icon {
  font-size: 56px;
  margin-bottom: 8px;
}

.login-card h2 {
  margin: 0 0 4px;
  font-size: 22px;
  color: #333;
}

.login-subtitle {
  margin: 0 0 28px;
  font-size: 14px;
  color: #999;
}

.login-field {
  text-align: left;
  margin-bottom: 18px;
}

.login-field label {
  display: block;
  font-size: 13px;
  color: #555;
  margin-bottom: 6px;
  font-weight: 500;
}

.login-field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.login-field input:focus {
  border-color: #667eea;
}

.login-error {
  color: #e53935;
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 4px;
  text-align: left;
}

.btn-login {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  margin-top: 4px;
}

.btn-login:hover {
  opacity: 0.92;
}

.btn-login:active {
  transform: scale(0.98);
}

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

/* 注册字段切换：默认隐藏，切换到注册模式时显示 */
.register-field {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  transition: max-height 0.35s ease, opacity 0.35s ease, margin 0.35s ease, padding 0.35s ease;
}

.register-field.visible {
  max-height: 80px;
  opacity: 1;
  margin-bottom: 18px;
}

.login-toggle {
  margin-top: 16px;
  font-size: 13px;
  color: #999;
}

.login-toggle a {
  color: #667eea;
  text-decoration: none;
  cursor: pointer;
}

.login-toggle a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Sidebar footer / logout
   ========================================================================== */

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid #e8e8e8;
  white-space: nowrap;
  margin-top: auto;
}

.user-info {
  font-size: 13px;
  color: #555;
  font-weight: 500;
}

.btn-logout {
  background: none;
  border: 1px solid #ddd;
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: #999;
  transition: color 0.2s, border-color 0.2s;
}

.btn-logout:hover {
  color: #e53935;
  border-color: #e53935;
}

/* ==========================================================================
   Helper classes
   ========================================================================== */

.hidden,
[hidden] {
  display: none !important;
}

.visually-hidden {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

.invisible {
  visibility: hidden;
}

.clearfix::before,
.clearfix::after {
  content: "";
  display: table;
}

.clearfix::after {
  clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   ========================================================================== */

@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */
}

@media print,
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 1.25dppx),
(min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}

/* ==========================================================================
   Image preview overlay
   ========================================================================== */

.image-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: previewFadeIn 0.2s ease;
}

.image-preview-overlay.active {
  display: flex;
}

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

.image-preview-card {
  background: #fff;
  border-radius: 12px;
  width: 90vw;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
  animation: previewSlideUp 0.25s ease;
}

@keyframes previewSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.image-preview-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.image-preview-close:hover {
  background: rgba(0, 0, 0, 0.6);
}

.image-preview-card {
  position: relative;
}

.image-preview-img-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  min-height: 300px;
  overflow: hidden;
}

.image-preview-img-wrapper img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  display: block;
}

.image-preview-tags-bar {
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid #eee;
  min-height: 32px;
}

/* 可选标签容器 */
.preview-tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 0;
  align-items: center;
}

.tag-options-label {
  font-size: 11px;
  color: #999;
  margin-right: 2px;
  white-space: nowrap;
}

.tag-option {
  font-size: 11px;
  background: #e3f2fd;
  color: #1565c0;
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.tag-option:hover {
  background: #bbdefb;
}

.tag-option:active {
  transform: scale(0.95);
}

/* 输入行容器 */
.preview-tag-input-row {
  display: flex;
  gap: 6px;
  width: 100%;
}

.preview-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.preview-tag-list .card-tag {
  font-size: 11px;
}

.preview-tag-list-empty {
  color: #ccc;
  font-size: 12px;
}

.image-preview-edit-area {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid #eee;
}

.image-preview-edit-area input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}

.image-preview-edit-area input:focus {
  border-color: #4a90d9;
}

.btn-preview-save {
  padding: 6px 14px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.btn-preview-save:hover {
  background: #3a7bc8;
}

.image-preview-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #eee;
}

.btn-preview-edit {
  flex: 1;
  padding: 8px;
  background: #e3f2fd;
  color: #1565c0;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-preview-edit:hover {
  background: #bbdefb;
}

.btn-preview-delete {
  flex: 1;
  padding: 8px;
  background: #ffebee;
  color: #c62828;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-preview-delete:hover {
  background: #ffcdd2;
}

/* 聊天中的图片 */
.chat-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  display: block;
}

/* ==========================================================================
   Responsive styles - 手机 & 平板适配
   ========================================================================== */

/* 小平板 & 小桌面 */
@media (max-width: 1024px) {
  .app-layout {
    margin: 20px auto;
    max-height: none;
  }
}

/* 手机 */
@media (max-width: 768px) {
  /* 应用布局 - 全屏 */
  .app-layout {
    margin: 0;
    max-height: none;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .top-nav {
    padding: 0 12px;
    height: 46px;
    gap: 8px;
  }

  .top-nav-brand {
    font-size: 14px;
  }

  .sidebar-tab {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* 登录卡片 */
  .login-card {
    padding: 28px 20px;
  }

  .login-icon {
    font-size: 44px;
  }

  .login-card h2 {
    font-size: 20px;
  }

  /* 顶部栏 */
  .chat-header,
  .wardrobe-header {
    padding: 12px 14px;
  }

  .chat-header h3,
  .wardrobe-header h3 {
    font-size: 16px;
  }

  /* 聊天区域 */
  .chat-messages {
    padding: 12px;
  }

  .message {
    max-width: 85%;
    font-size: 13px;
    padding: 8px 12px;
  }

  /* 输入区域 */
  .chat-input-area {
    padding: 10px 12px;
  }

  .chat-input-area input[type="text"] {
    font-size: 13px;
    padding: 8px 12px;
  }

  .btn-send {
    padding: 8px 16px;
    font-size: 13px;
  }

  /* 输入提示 */
  .chat-input-hint {
    font-size: 11px;
    padding: 4px 12px;
  }

  /* 衣库区域 */
  .wardrobe-body {
    padding: 12px 14px;
  }

  .wardrobe-grid {
    gap: 6px;
  }

  /* 图片预览 */
  .image-preview-card {
    width: 95vw;
    border-radius: 8px;
  }

  .image-preview-img-wrapper {
    min-height: 200px;
  }

  .image-preview-img-wrapper img {
    max-height: 45vh;
  }

  .image-preview-actions {
    padding: 10px 12px;
  }
}

/* 小屏手机 */
@media (max-width: 480px) {
  .login-card {
    padding: 20px 14px;
    max-width: 94vw;
  }

  .login-icon {
    font-size: 36px;
  }

  .login-card h2 {
    font-size: 17px;
  }

  .login-field {
    margin-bottom: 14px;
  }

  .login-field input {
    padding: 10px 12px;
    font-size: 13px;
  }

  .btn-login {
    padding: 11px;
    font-size: 14px;
  }

  .sidebar {
    width: 260px;
    min-width: 260px;
  }

  .sidebar.collapsed {
    transform: translateX(-100%);
    width: 260px;
    min-width: 260px;
  }

  .wardrobe-grid {
    grid-template-columns: repeat(1, 1fr);
    gap: 8px;
  }

  .message {
    max-width: 90%;
  }

  .chat-messages {
    padding: 8px;
  }

  .chat-input-area {
    padding: 8px 10px;
    gap: 6px;
  }
}

/* 聊天中的图片 */
.chat-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  display: block;
}
