/* Picture Magician - 簡潔主題 */
:root {
  --bg: #0b1020;
  --surface: #121a2e;
  --card: #161f36;
  --text: #ebeff5;
  --muted: #a9b3c9;
  --primary: #5c8cff;
  --primary-rgb: 92, 140, 255;
  --primary-600: #3e6ffd;
  --success: #21c58b;
  --danger: #ff6b6b;
  --warning: #f59e0b;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 12px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  --nav-bg: rgba(18, 26, 46, 0.85);
}

[data-theme="light"] {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --card: #ffffff;
  --text: #1d2433;
  --muted: #55627a;
  --primary: #3867ff;
  --primary-rgb: 56, 103, 255;
  --primary-600: #274ef5;
  --success: #0a9f6f;
  --danger: #e65454;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --nav-bg: rgba(255, 255, 255, 0.9);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans TC", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[data-theme="light"] body,
body[data-theme="light"] {
  background: var(--bg);
}

/* Top nav - Modern Glass Design */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 25, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
}

.brand {
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
  font-size: 18px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand .brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  line-height: 1;
  transition: all .25s ease;
  padding: 6px 12px 6px 8px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
  border: 1px solid rgba(92, 140, 255, 0.15);
}

.brand .brand-link:hover {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
  border-color: rgba(92, 140, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(92, 140, 255, 0.15);
}

[data-theme="light"] .brand .brand-link {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.08) 0%, rgba(168, 85, 247, 0.08) 100%);
}

[data-theme="light"] .brand .brand-link:hover {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
}

.brand .brand-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Hamburger button (mobile) - Modern */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger:hover {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  border-color: rgba(92, 140, 255, 0.3);
}

.hamburger:hover span {
  background: var(--primary);
}

[data-theme="light"] .hamburger {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .hamburger:hover {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
}

.hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Navigation links - Modern Pills */
.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
  flex: 1;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .nav-links {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.05);
}

.nav-links .nav-link {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 10px;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.nav-links .nav-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  opacity: 0;
  transition: opacity .25s ease;
  border-radius: 10px;
}

.nav-links .nav-link span {
  white-space: nowrap;
  position: relative;
  z-index: 1;
  line-height: 1;
}

.nav-links .nav-link svg {
  opacity: 0.7;
  transition: all .25s ease;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  display: block;
}

.nav-links .nav-link:hover {
  color: var(--text);
  border-color: rgba(92, 140, 255, 0.2);
  transform: translateY(-1px);
}

.nav-links .nav-link:hover::before {
  opacity: 1;
}

.nav-links .nav-link:hover svg {
  opacity: 1;
  transform: scale(1.1);
}

[data-theme="light"] .nav-links .nav-link:hover {
  background: rgba(92, 140, 255, 0.08);
}

/* Active page highlight - Glowing Effect */
.nav-links .nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(92, 140, 255, 0.4), 0 0 0 1px rgba(92, 140, 255, 0.2);
}

.nav-links .nav-link.active::before {
  opacity: 0;
}

.nav-links .nav-link.active svg {
  opacity: 1;
  color: #fff;
}

[data-theme="light"] .nav-links .nav-link.active {
  color: #fff;
  box-shadow: 0 4px 15px rgba(92, 140, 255, 0.3);
}

/* Dropdown (更多功能) - Modern Style */
.dropdown {
  position: relative;
}

.dropbtn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-theme="light"] .dropbtn {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}

.dropbtn svg {
  flex-shrink: 0;
  display: block;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropbtn .dropdown-arrow {
  opacity: 0.6;
}

.dropbtn:hover {
  color: var(--text);
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
  border-color: rgba(92, 140, 255, 0.25);
  transform: translateY(-1px);
}

.dropbtn:hover .dropdown-arrow {
  opacity: 1;
}

[data-theme="light"] .dropbtn:hover {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
}

.dropdown.open .dropbtn .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown.open .dropbtn {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  border-color: rgba(92, 140, 255, 0.3);
  color: var(--text);
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: rgba(20, 20, 35, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  display: none;
  z-index: 200;
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] .dropdown-menu {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.dropdown.open .dropdown-menu {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.dropdown-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 450;
  transition: all .2s ease;
  position: relative;
  overflow: hidden;
}

.dropdown-menu .dropdown-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.12) 0%, rgba(168, 85, 247, 0.12) 100%);
  opacity: 0;
  transition: opacity .2s ease;
}

.dropdown-menu .dropdown-item svg {
  opacity: 0.7;
  transition: all .2s ease;
  position: relative;
  z-index: 1;
}

.dropdown-menu .dropdown-item span {
  position: relative;
  z-index: 1;
}

.dropdown-menu .dropdown-item:hover {
  color: var(--primary);
  transform: translateX(4px);
}

.dropdown-menu .dropdown-item:hover::before {
  opacity: 1;
}

.dropdown-menu .dropdown-item:hover svg {
  opacity: 1;
  transform: scale(1.15);
}

[data-theme="light"] .dropdown-menu .dropdown-item:hover {
  background: rgba(92, 140, 255, 0.08);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* ===== 分類式下拉選單 (其他功能) - Modern Categorized ===== */
.dropdown-menu.categorized {
  min-width: 300px;
  max-width: 340px;
  max-height: 75vh;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(92, 140, 255, 0.3) transparent;
}

.dropdown-menu.categorized::-webkit-scrollbar {
  width: 5px;
}

.dropdown-menu.categorized::-webkit-scrollbar-track {
  background: transparent;
  margin: 8px 0;
}

.dropdown-menu.categorized::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.3) 0%, rgba(168, 85, 247, 0.3) 100%);
  border-radius: 4px;
}

.dropdown-menu.categorized::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.5) 0%, rgba(168, 85, 247, 0.5) 100%);
}

[data-theme="light"] .dropdown-menu.categorized::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.25) 0%, rgba(168, 85, 247, 0.25) 100%);
}

[data-theme="light"] .dropdown-menu.categorized::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.4) 0%, rgba(168, 85, 247, 0.4) 100%);
}

/* dropdown-category 樣式已移至第 3329 行，避免重複 */


.dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.dropdown-header svg {
  opacity: 0.7;
}

.user-email-dropdown {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-item.logout-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.dropdown-item.logout-item:hover {
  background: rgba(255, 68, 68, 0.12);
  color: var(--danger);
}

[data-theme="light"] .dropdown-item.logout-item:hover {
  background: rgba(230, 84, 84, 0.12);
}

.account-dropdown .dropdown-menu {
  min-width: 240px;
}

/* Right side actions in nav - Modern */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav-actions .btn.theme {
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: none;
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-actions .btn.theme:hover {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 152, 0, 0.15) 100%);
  border-color: rgba(255, 193, 7, 0.3);
  transform: rotate(15deg);
}

.nav-actions .btn.theme:hover svg {
  color: #ffc107;
}

[data-theme="light"] .nav-actions .btn.theme {
  color: #1d2433;
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .nav-actions .btn.theme:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  border-color: rgba(99, 102, 241, 0.3);
}

[data-theme="light"] .nav-actions .btn.theme:hover svg {
  color: #6366f1;
}

.nav-actions .icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.nav-actions .icon-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.nav-actions .icon-link .btn-label {
  display: inline;
}

.nav-actions .user-email {
  color: var(--muted);
  font-size: 13px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-actions .logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
}

.nav-actions .logout-btn svg {
  width: 16px;
  height: 16px;
}

/* Mobile responsive */
@media (max-width: 900px) {
  .hamburger {
    display: flex;
    margin-left: auto;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--surface);
    border-top: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    box-shadow: none;
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      padding 0.3s ease,
      visibility 0.3s ease,
      opacity 0.3s ease,
      border-top 0.3s ease;
    z-index: 99;
  }

  .nav-links.open {
    max-height: none;
    padding: 8px;
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow);
    visibility: visible;
    opacity: 1;
    overflow-y: auto;
  }

  .nav-links .nav-link {
    width: 100%;
    padding: 12px 14px;
    justify-content: flex-start;
  }

  .dropdown {
    width: 100%;
  }

  .dropdown .dropbtn {
    width: 100%;
    justify-content: space-between;
  }

  .nav-actions {
    gap: 6px;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    justify-content: flex-start;
  }

  .nav-actions .icon-link .btn-label {
    display: none;
  }

  .nav-actions .user-email {
    display: none;
  }

  .nav-actions .logout-btn span {
    display: none;
  }

  .nav-actions .logout-btn {
    padding: 8px;
  }

  /* 用戶選單在手機端內聯顯示 */
  .user-menu {
    position: static !important;
    transform: none !important;
    width: 100%;
    margin-top: 8px;
    border-radius: 12px;
    box-shadow: none !important;
    min-width: auto;
    display: none;
  }

  .user-menu-dropdown.open .user-menu {
    display: block;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
  }

  /* 日間模式的漢堡選單背景 - 不透明 */
  [data-theme="light"] .nav-links {
    background: #ffffff;
  }
}

/* Layout */
.container {
  max-width: 980px;
  margin: 36px auto 80px;
  padding: 0 20px;
}

.title {
  text-align: center;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.2px;
  margin: 14px 0 28px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 900px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ============================
   增強型卡片組件
   ============================ */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 16px 0 22px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #a855f7);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover {
  transform: translateY(-6px) scale(1.01);
  border-color: rgba(var(--primary-rgb), 0.4);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(var(--primary-rgb), 0.15),
    0 0 30px rgba(var(--primary-rgb), 0.1);
}

.card:hover::before {
  opacity: 1;
}

.card:active {
  transform: translateY(-2px) scale(1.005);
  transition-duration: 100ms;
}

[data-theme="light"] .card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
}

[data-theme="light"] .card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(var(--primary-rgb), 0.15);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card h2::before {
  content: '';
  width: 4px;
  height: 18px;
  background: linear-gradient(180deg, var(--primary), #a855f7);
  border-radius: 2px;
}

.card p {
  margin: 4px 0 14px;
  color: var(--muted);
  line-height: 1.6;
}

/* 卡片變體 */
.card.card-flat {
  border: none;
  box-shadow: none;
  background: transparent;
}

.card.card-flat:hover {
  transform: none;
  box-shadow: none;
}

.card.card-flat::before {
  display: none;
}

.card.card-bordered {
  background: transparent;
  box-shadow: none;
}

.card.card-highlight {
  border-color: var(--primary);
  background: linear-gradient(180deg, rgba(var(--primary-rgb), 0.08), rgba(var(--primary-rgb), 0.03));
}

.card.card-highlight::before {
  opacity: 1;
}

/* 卡片內容區塊 */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-body {
  padding: 4px 0;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* 卡片網格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.card-grid .card {
  margin: 0;
}

@media (max-width: 640px) {
  .card-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .card {
    padding: 16px;
  }

  .card:hover {
    transform: none;
  }
}

/* Forms */
form {
  display: grid;
  gap: 10px;
}

.row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* 正向提示詞和輸出風格對齊樣式 */
.prompt-style-row {
  align-items: stretch;
}

.prompt-style-row .prompt-field,
.prompt-style-row .style-field {
  display: flex;
  flex-direction: column;
}

.prompt-style-row .prompt-field input,
.prompt-style-row .style-field select {
  height: 44px;
  flex-shrink: 0;
}

/* Field wrappers and labels */
label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field {
  display: block;
}

.fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 12px;
}

[data-theme="light"] .fieldset {
  background: rgba(0, 0, 0, 0.02);
}

.fieldset legend {
  font-weight: 600;
  color: var(--text);
  padding: 0 6px;
}

.field.toggled {
  display: grid;
  gap: 6px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
}

.checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ============================
   增強型表單輸入
   ============================ */
input[type="text"],
input[type="number"],
input[type="file"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  outline: none;
  font-size: 14px;
  transition: all 0.25s ease;
  position: relative;
}

/* Focus 狀態 - 發光效果 */
input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.18),
    0 6px 16px rgba(var(--primary-rgb), 0.12),
    inset 0 1px 2px rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

/* Select focus 需要保留 background-image (箭頭) */
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.18),
    0 6px 16px rgba(var(--primary-rgb), 0.12),
    inset 0 1px 2px rgba(0, 0, 0, 0.1);
  background-color: rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

/* Hover 狀態 */
input[type="text"]:hover:not(:focus),
input[type="number"]:hover:not(:focus),
input[type="email"]:hover:not(:focus),
input[type="password"]:hover:not(:focus),
textarea:hover:not(:focus) {
  border-color: rgba(var(--primary-rgb), 0.4);
  background: rgba(0, 0, 0, 0.3);
}

/* Select hover 需要保留 background-image (箭頭) */
select:hover:not(:focus) {
  border-color: rgba(var(--primary-rgb), 0.4);
  background-color: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="file"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="password"],
[data-theme="light"] textarea {
  background: #fff;
}

/* Light theme select 需要保留 background-image (箭頭) */
[data-theme="light"] select {
  background-color: #fff;
}

[data-theme="light"] input[type="text"]:focus,
[data-theme="light"] input[type="number"]:focus,
[data-theme="light"] input[type="email"]:focus,
[data-theme="light"] input[type="password"]:focus,
[data-theme="light"] textarea:focus {
  background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12),
    0 4px 12px rgba(var(--primary-rgb), 0.08);
}

/* Light theme select focus 需要保留 background-image (箭頭) */
[data-theme="light"] select:focus {
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12),
    0 4px 12px rgba(var(--primary-rgb), 0.08);
}

input::placeholder {
  color: #92a1bd;
  transition: opacity 0.2s ease;
}

input:focus::placeholder {
  opacity: 0.6;
}

input[type="file"] {
  padding: 10px;
  cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  background: var(--primary);
  color: white;
  font-weight: 500;
  cursor: pointer;
  margin-right: 12px;
  transition: background 0.2s ease;
}

input[type="file"]::-webkit-file-upload-button:hover {
  background: var(--primary-600);
}

/* Textarea 增強 */
textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

/* Select 增強 */
select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2392a1bd' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 40px;
  box-sizing: border-box;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* ============================
   表單標籤增強
   ============================ */
.form-label,
label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
  transition: color 0.2s ease;
}

.form-group:focus-within label,
.form-label:focus-within {
  color: var(--primary);
}

/* 表單群組 */
.form-group {
  position: relative;
  margin-bottom: 16px;
}

.form-group.has-icon input {
  padding-left: 42px;
}

.form-group .form-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  transition: color 0.2s ease;
}

.form-group:focus-within .form-icon {
  color: var(--primary);
}

/* 輸入驗證樣式 */
input:valid:not(:placeholder-shown) {
  border-color: rgba(34, 197, 94, 0.4);
}

input:invalid:not(:placeholder-shown):not(:focus) {
  border-color: rgba(239, 68, 68, 0.4);
}

/* ============================
   增強型按鈕
   ============================ */
.btn {
  appearance: none;
  border: none;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.2px;
  color: white;
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.35);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  width: fit-content;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Ripple 效果容器 */
.btn::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 60%);
  transform: scale(0);
  opacity: 0;
  transition: transform 0.5s ease, opacity 0.3s ease;
}

.btn:active::after {
  transform: scale(2.5);
  opacity: 1;
  transition: transform 0s, opacity 0s;
}

.btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 30px rgba(var(--primary-rgb), 0.45),
    0 0 20px rgba(var(--primary-rgb), 0.2);
  filter: brightness(1.08);
}

.btn:active {
  transform: translateY(-1px) scale(0.98);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.35);
  transition-duration: 100ms;
}

.btn:disabled {
  filter: grayscale(0.6) brightness(0.85);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* 按鈕尺寸變體 */
.btn.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 8px;
}

.btn.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: 12px;
}

/* 按鈕顏色變體 */
.btn.secondary {
  background: linear-gradient(180deg, #6b768e, #59637a);
  box-shadow: 0 4px 14px rgba(107, 118, 142, 0.35);
}

.btn.secondary:hover {
  box-shadow: 0 8px 25px rgba(107, 118, 142, 0.4);
}

.btn.success {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
}

.btn.success:hover {
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.4);
}

.btn.danger {
  background: linear-gradient(180deg, #ef4444, #dc2626);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.btn.danger:hover {
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

/* Loading 狀態 */
.btn.loading {
  pointer-events: none;
  position: relative;
  color: transparent;
}

.btn.loading::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: btnSpin 0.8s linear infinite;
}

@keyframes btnSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Icon 按鈕 */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.btn-icon.btn-lg {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

/* 🌐 翻譯按鈕樣式 */
.btn.translate-btn {
  background: linear-gradient(180deg, #4a9eff, #2563eb);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  font-size: 13px;
  padding: 8px 14px;
  white-space: nowrap;
}

.btn.translate-btn:hover {
  background: linear-gradient(180deg, #60a5fa, #3b82f6);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

.btn.translate-btn:disabled {
  background: linear-gradient(180deg, #94a3b8, #64748b);
  cursor: wait;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn.ghost:hover {
  background: rgba(var(--primary-rgb), 0.1);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: none;
}

/* Feedback */
.msg {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
}

.msg.success {
  color: var(--success);
}

.msg.error {
  color: var(--danger);
}

pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  overflow: auto;
}

[data-theme="light"] pre {
  background: #f4f6fb;
}

.flash {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.flash.error {
  background: rgba(255, 107, 107, 0.12);
  color: #ffb0b0;
}

.flash.success {
  background: rgba(33, 197, 139, 0.12);
  color: #b8f2d9;
}

[data-theme="light"] .flash.error {
  background: #ffe8e8;
  color: #a11;
}

[data-theme="light"] .flash.success {
  background: #e8fff3;
  color: #0a5;
}

/* Media */
.result img {
  display: block;
  width: 100%;
  max-width: 780px;
  border-radius: 12px;
  margin: 10px 0 4px;
  box-shadow: var(--shadow);
}

.result video {
  display: block;
  width: 100%;
  max-width: 780px;
  border-radius: 12px;
  margin: 10px 0 4px;
  box-shadow: var(--shadow);
}

/* Utility */
.spacer {
  height: 6px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

/* Accessibility focus with better visibility */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Skip focus styles for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Enhanced focus for buttons */
.btn:focus-visible {
  outline-offset: 4px;
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.3);
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Dropzone with enhanced feedback */
.dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.25s var(--ease-smooth);
  min-height: 200px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.dropzone:hover {
  border-color: rgba(var(--primary-rgb), 0.5);
  background: rgba(var(--primary-rgb), 0.03);
}

.dropzone.dragover {
  background: rgba(92, 140, 255, 0.12);
  border-color: var(--primary);
  border-style: solid;
  transform: scale(1.02);
  box-shadow: 0 0 0 4px rgba(92, 140, 255, 0.15) inset,
    0 8px 32px rgba(92, 140, 255, 0.15);
}

.dropzone.dragover .drop-hint {
  opacity: .45;
  filter: saturate(1.1);
}

.dropzone::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s ease;
}

.dropzone.dragover::after {
  opacity: 1;
  background: radial-gradient(120% 80% at 50% 50%, rgba(92, 140, 255, 0.12), transparent 70%);
}

@keyframes dropPulse {
  0% {
    transform: scale(0.96);
    opacity: .85;
  }

  50% {
    transform: scale(1);
    opacity: 1;
  }

  100% {
    transform: scale(0.96);
    opacity: .85;
  }
}

.dropzone.dragover .drop-hint::before {
  animation: dropPulse 1.2s ease-in-out infinite;
}

.dragover {
  outline: 2px dashed var(--primary);
}

.preview img {
  display: block;
  max-width: 220px;
  width: 100%;
  border-radius: 10px;
  margin-top: 8px;
  box-shadow: var(--shadow);
}

/* Drop hint block with icon */
.drop-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  margin-top: 8px;
}

.drop-hint::before {
  content: "";
  width: 28px;
  height: 28px;
  background: url('upload_icon.svg') center/contain no-repeat;
  opacity: 0.85;
}

.drop-hint:hover {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .drop-hint:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* Fallback: show icon on generic hint inside dropzone */
.dropzone .hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
}

.dropzone .hint::before {
  content: "";
  width: 22px;
  height: 22px;
  background: url('upload_icon.svg') center/contain no-repeat;
  opacity: 0.7;
}

/* Progress bar */
.progress {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress .bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  transition: width .1s ease;
}

/* Toasts */
.toast-container {
  position: fixed;
  right: 16px;
  top: 16px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 12px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  max-width: 340px;
}

.toast.success {
  border-color: rgba(33, 197, 139, 0.65);
}

.toast.error {
  border-color: rgba(255, 107, 107, 0.65);
}

.toast.warning {
  border-color: rgba(255, 193, 7, 0.65);
}

.toast.info {
  border-color: rgba(59, 130, 246, 0.65);
}

/* Modal viewer */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  z-index: 9997;
}

.modal img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

/* Magic cursor canvas */
#magicCanvas {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Optional active state for toggle */
.btn.ghost.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(92, 140, 255, 0.25) inset;
}

/* Magic FAB 樣式已移至 fab.css */

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 0 0 8px 0;
  z-index: 10000;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Page loader */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(92, 140, 255, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Back to top button */
.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 9995;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--primary-600);
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(92, 140, 255, 0.4);
}

.back-to-top:active {
  transform: translateY(-2px);
}

@media (max-width: 640px) {
  .back-to-top {
    right: 12px;
    bottom: 16px;
    width: 44px;
    height: 44px;
  }
}

/* Password strength indicator */
.password-strength {
  position: relative;
}

.password-strength[data-strength="weak"] #password-strength-bar {
  width: 33%;
  background: #ff6b6b;
}

.password-strength[data-strength="medium"] #password-strength-bar {
  width: 66%;
  background: #ffd93d;
}

.password-strength[data-strength="strong"] #password-strength-bar {
  width: 100%;
  background: #21c58b;
}

/* Form validation feedback */
input:invalid:not(:placeholder-shown) {
  border-color: var(--danger);
}

input:valid:not(:placeholder-shown) {
  border-color: var(--success);
}

.hint.error {
  color: var(--danger);
}

.hint.success {
  color: var(--success);
}

/* Loading state for buttons */
.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Image lazy loading placeholder */
img[loading="lazy"] {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] img[loading="lazy"] {
  background: rgba(0, 0, 0, 0.05);
}

/* Smooth scroll behavior with reduced motion support */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  /* Account for fixed navbar */
}

/* Performance: Reduce animations for users who prefer */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .btn,
  .card,
  .nav-link,
  .dropdown-menu,
  .toast,
  .modal,
  .back-to-top {
    will-change: auto;
    transform: none;
  }
}

/* AI 聊天機器人樣式已移至 chatbot.css */

/* 覆蓋層 */
.chatbot-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9998;
}

.chatbot-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* 聊天面板 */
.chatbot-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 420px;
  height: 650px;
  background: var(--bg);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  border: 1px solid var(--border);
}

.chatbot-panel.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* 頭部 */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--primary), #667eea);
  color: white;
}

.chatbot-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-title-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chatbot-name {
  font-size: 15px;
  font-weight: 600;
}

.chatbot-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.9;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #21c58b;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.chatbot-actions {
  display: flex;
  gap: 8px;
}

.chatbot-action-btn {
  padding: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: white;
  transition: all 0.2s;
}

.chatbot-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 對話區域 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  scroll-behavior: smooth;
}

.chat-message {
  display: flex;
  gap: 12px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bot-message .message-avatar {
  background: linear-gradient(135deg, var(--primary), #667eea);
  color: white;
}

.user-message {
  flex-direction: row-reverse;
}

.user-message .message-avatar {
  background: var(--text);
  color: white;
}

.message-content {
  flex: 1;
  max-width: 75%;
}

.user-message .message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.message-text {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
}

.bot-message .message-text {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.user-message .message-text {
  background: linear-gradient(135deg, var(--primary), #667eea);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-text p {
  margin: 0 0 8px 0;
}

.message-text p:last-child {
  margin-bottom: 0;
}

.message-text ul {
  margin: 8px 0;
  padding-left: 20px;
}

.message-text li {
  margin: 4px 0;
}

.message-time {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* 打字中動畫 */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-10px);
  }
}

/* 快速建議 */
.quick-suggestions {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.suggestion-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 12px;
}

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.suggestion-chip {
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.suggestion-chip:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* 輸入區域 */
.chat-input-container {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 16px 20px;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  transition: all 0.2s;
}

.chat-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.5;
}

.chat-input::placeholder {
  color: var(--muted);
}

.chat-send-btn {
  padding: 8px;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
  background: #5a67d8;
  transform: scale(1.05);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-send-btn.loading {
  position: relative;
}

.chat-send-btn.loading svg {
  opacity: 0;
}

.chat-send-btn.loading::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.chat-input-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 響應式 */
@media (max-width: 640px) {
  .chatbot-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }

  .chatbot-overlay {
    display: none;
  }

  .suggestion-grid {
    grid-template-columns: 1fr;
  }

  .message-content {
    max-width: 85%;
  }
}

/* ===== 增強載入動畫 ===== */

/* 骨架載入效果 */
.skeleton {
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0.05) 0%,
      rgba(255, 255, 255, 0.12) 50%,
      rgba(255, 255, 255, 0.05) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

[data-theme="light"] .skeleton {
  background: linear-gradient(90deg,
      rgba(0, 0, 0, 0.04) 0%,
      rgba(0, 0, 0, 0.08) 50%,
      rgba(0, 0, 0, 0.04) 100%);
  background-size: 200% 100%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* 處理中脈衝效果（適用於表單提交時） */
.processing {
  position: relative;
  overflow: hidden;
}

.processing::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(92, 140, 255, 0.15), transparent);
  animation: processingWave 1.5s ease-in-out infinite;
}

@keyframes processingWave {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* 圖片載入漸入效果 */
.result img,
.preview img {
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 圖片懸停放大效果 */
.result img:hover {
  transform: scale(1.02);
  transition: transform 0.3s ease;
  cursor: zoom-in;
}

/* 成功/失敗訊息動畫 */
.msg.success,
.msg.error,
.toast {
  animation: msgSlideIn 0.35s ease;
}

@keyframes msgSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 進階選項摺疊動畫 */
.advanced-options {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  margin: 8px 0;
}

.advanced-options summary {
  padding: 12px 14px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s ease;
}

.advanced-options summary:hover {
  color: var(--text);
}

.advanced-options summary::marker {
  content: "";
}

.advanced-options summary::before {
  content: "▸";
  transition: transform 0.2s ease;
}

.advanced-options[open] summary::before {
  transform: rotate(90deg);
}

.advanced-options[open]>summary {
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.advanced-options> :not(summary) {
  padding: 12px 14px;
}

/* 副標題樣式 */
.subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  margin: -20px 0 24px;
}

/* info-card 樣式 */
.info-card {
  background: rgba(92, 140, 255, 0.06);
  border-color: rgba(92, 140, 255, 0.2);
}

.info-card h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--text);
}

.info-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.info-card li {
  margin: 6px 0;
  line-height: 1.5;
}

/* ===== Inpaint Canvas Editor ===== */
.inpaint-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inpaint-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
}

[data-theme="light"] .inpaint-toolbar {
  background: rgba(0, 0, 0, 0.04);
}

.inpaint-toolbar .toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inpaint-toolbar label {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.brush-slider {
  width: 120px;
  height: 6px;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  cursor: pointer;
}

.brush-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(92, 140, 255, 0.4);
}

.brush-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(92, 140, 255, 0.4);
}

#brushSizeValue {
  font-size: 13px;
  color: var(--text);
  min-width: 40px;
}

.inpaint-canvas-container {
  position: relative !important;
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: repeating-conic-gradient(#808080 0% 25%, transparent 0% 50%) 50% / 20px 20px;
  margin: 0 auto;
  display: block;
}

.inpaint-canvas {
  display: block;
}

.inpaint-canvas.base-layer {
  position: relative;
  z-index: 1;
}

.inpaint-canvas.draw-layer {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 2;
  cursor: crosshair;
}

/* Active tool buttons */
.inpaint-toolbar .btn.ghost.active {
  background: rgba(92, 140, 255, 0.15);
  border-color: var(--primary);
  color: var(--primary);
}

/* Editor container centering */
.inpaint-editor {
  text-align: center;
}

.inpaint-editor>label {
  display: block;
  text-align: left;
  margin-bottom: 12px;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .inpaint-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .inpaint-toolbar .toolbar-group {
    justify-content: space-between;
  }

  .brush-slider {
    flex: 1;
    max-width: 150px;
  }

  .inpaint-canvas-container {
    touch-action: none;
  }
}

/* ============================================================
   UI/UX 增強樣式
   ============================================================ */

/* 頁面載入器 */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Skip link (Accessibility) */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  font-weight: 600;
  z-index: 10001;
  text-decoration: none;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 16px;
}

/* Toast 通知容器 */
.toast-container {
  position: fixed;
  top: 90px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: toastSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.toast:hover {
  transform: translateX(-4px);
}

.toast.removing {
  animation: toastSlideOut 0.3s ease forwards;
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.warning {
  border-left: 4px solid #f59e0b;
}

.toast.info {
  border-left: 4px solid var(--primary);
}

.toast-icon {
  font-size: 18px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error .toast-icon {
  color: var(--danger);
}

.toast.warning .toast-icon {
  color: #f59e0b;
}

.toast.info .toast-icon {
  color: var(--primary);
}

.toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* 按鈕載入狀態 */
.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

.btn.loading .btn-loading-spinner+span,
.btn.loading::after {
  color: white;
}

.btn.success {
  background: linear-gradient(180deg, var(--success), #1aad7a) !important;
}

.btn.error {
  background: linear-gradient(180deg, var(--danger), #e55555) !important;
}

/* 進度條 */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* 圓形進度 */
.progress-circle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.progress-circle svg {
  transform: rotate(-90deg);
}

.progress-circle-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 4;
}

.progress-circle-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease;
}

.progress-circle-text {
  position: absolute;
  font-size: 12px;
  font-weight: 600;
}

/* Modal 彈窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 9001;
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.modal.active {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* 圖片載入動畫 */
.img-loading {
  position: relative;
  background: linear-gradient(90deg, var(--border) 25%, var(--surface) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

.img-loading img {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.img-loading img.loaded,
img.loaded {
  opacity: 1;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* 表單輸入增強 */
input.error,
textarea.error,
select.error {
  border-color: var(--danger) !important;
  animation: inputShake 0.4s ease;
}

input.success,
textarea.success,
select.success {
  border-color: var(--success) !important;
}

@keyframes inputShake {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-4px);
  }

  40%,
  80% {
    transform: translateX(4px);
  }
}

/* Scroll reveal */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* 卡片懸停效果 */
.card-hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

/* 響應式 Toast */
@media (max-width: 480px) {
  .toast-container {
    left: 12px;
    right: 12px;
    max-width: none;
  }

  .modal {
    width: 95%;
  }
}

/* 減少動畫偏好 */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .scroll-reveal {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   用戶選單 (User Menu Dropdown)
   ============================================================ */

.user-menu-dropdown {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text);
}

.user-menu-btn:hover {
  background: var(--card);
  border-color: var(--primary);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar.large {
  width: 48px;
  height: 48px;
}

.user-avatar .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar .avatar-initial {
  color: white;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
}

.user-avatar.large .avatar-initial {
  font-size: 20px;
}

.user-menu-btn .user-name {
  font-size: 14px;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-btn .dropdown-arrow {
  transition: transform 0.2s ease;
  opacity: 0.6;
}

.user-menu-dropdown.open .user-menu-btn .dropdown-arrow {
  transform: rotate(180deg);
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 260px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  overflow: hidden;
}

.user-menu-dropdown.open .user-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px 14px;
  background: linear-gradient(180deg, rgba(92, 140, 255, 0.08), transparent);
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.user-display-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.user-email-small {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s ease;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.user-menu-item:hover {
  background: rgba(92, 140, 255, 0.1);
  color: var(--primary);
}

.user-menu-item svg {
  opacity: 0.7;
  flex-shrink: 0;
}

.user-menu-item:hover svg {
  opacity: 1;
}

.user-menu-item.logout {
  color: var(--danger);
}

.user-menu-item.logout:hover {
  background: rgba(255, 107, 107, 0.1);
}

.user-menu-item.logout svg {
  stroke: var(--danger);
}

/* 登入/註冊按鈕美化 */
.login-btn {
  border: 1px solid var(--border) !important;
}

.login-btn:hover {
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

.register-btn {
  padding: 10px 20px !important;
  border-radius: 50px !important;
  font-weight: 600 !important;
}

/* 響應式用戶選單 */
@media (max-width: 900px) {
  .user-menu-btn .user-name {
    display: none;
  }

  .user-menu-btn {
    padding: 4px;
    border-radius: 50%;
  }

  .user-menu {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    min-width: 100%;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }

  .user-menu-dropdown.open .user-menu {
    transform: translateY(0);
  }

  .user-menu-header {
    padding: 24px 20px 18px;
  }

  .user-menu-item {
    padding: 16px 20px;
  }
}

/* ============================================================
   導覽列增強美化
   ============================================================ */

.navbar {
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
  transition: transform 0.2s ease;
}

.brand-link:hover {
  transform: scale(1.02);
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

/* 導覽連結動畫增強 */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 1px;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 60%;
}

/* 下拉選單美化 */
.dropdown-menu {
  border-radius: 16px !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25) !important;
  border: 1px solid var(--border) !important;
  padding: 8px !important;
}

.dropdown-item {
  border-radius: 10px !important;
  margin: 2px 0 !important;
  transition: all 0.15s ease !important;
}

.dropdown-item:hover {
  background: rgba(92, 140, 255, 0.1) !important;
  transform: translateX(4px);
}

.dropdown-divider {
  margin: 8px 12px !important;
  opacity: 0.5;
}

/* ============================================================
   分類下拉選單樣式 - 美化版
   ============================================================ */

/* 更多功能下拉選單 */
.dropdown-menu.categorized {
  min-width: 300px;
  max-width: 340px;
  max-height: 75vh;
  overflow-y: auto;
  padding: 8px !important;
  background: linear-gradient(180deg, var(--surface), var(--card)) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset !important;
}

[data-theme="light"] .dropdown-menu.categorized {
  background: linear-gradient(180deg, #ffffff, #f8fafc) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.03) inset !important;
}

/* 分類區塊 */
.dropdown-category {
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  padding: 8px;
  transition: background 0.2s ease;
}

.dropdown-category:hover {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .dropdown-category {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .dropdown-category:hover {
  background: rgba(0, 0, 0, 0.04);
}

.dropdown-category:last-child {
  margin-bottom: 0;
}

/* 分類標題 - 可摺疊 */
.dropdown-category-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  user-select: none;
  cursor: pointer;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.1), rgba(129, 140, 248, 0.05));
  margin-bottom: 0;
  transition: all 0.2s ease;
}

.dropdown-category-title:hover {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.2), rgba(129, 140, 248, 0.1));
}

.dropdown-category-title .category-icon {
  font-size: 13px;
}

.dropdown-category-title .category-name {
  flex: 1;
}

.dropdown-category-title .category-arrow {
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.6;
}

.dropdown-category.open .dropdown-category-title .category-arrow,
.dropdown-category.expanded .dropdown-category-title .category-arrow {
  transform: rotate(180deg);
}

/* 摺疊內容區 - 預設隱藏（帳戶選單風格） */
.dropdown-category-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  padding: 0 8px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  transition:
    max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease,
    visibility 0.25s ease,
    transform 0.25s ease,
    padding 0.25s ease;
}

/* 展開時的動畫效果 */
.dropdown-category.expanded .dropdown-category-content {
  max-height: 600px;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  padding: 8px;
}

/* 展開時分類標題高亮 */
.dropdown-category.expanded .dropdown-category-title {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.2), rgba(129, 140, 248, 0.12));
  box-shadow: 0 2px 8px rgba(92, 140, 255, 0.15);
}

/* 展開時箭頭動畫 */
.dropdown-category.expanded .dropdown-category-title .category-arrow {
  transform: rotate(180deg);
  color: var(--primary);
}

/* 子項目進場動畫 */
.dropdown-category-content .dropdown-item {
  opacity: 0;
  transform: translateX(-8px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    background 0.15s ease;
}

.dropdown-category.expanded .dropdown-category-content .dropdown-item {
  opacity: 1;
  transform: translateX(0);
}

/* 子項目延遲進場（錯落感） */
.dropdown-category.expanded .dropdown-category-content .dropdown-item:nth-child(1) {
  transition-delay: 0.05s;
}

.dropdown-category.expanded .dropdown-category-content .dropdown-item:nth-child(2) {
  transition-delay: 0.1s;
}

.dropdown-category.expanded .dropdown-category-content .dropdown-item:nth-child(3) {
  transition-delay: 0.15s;
}

.dropdown-category.expanded .dropdown-category-content .dropdown-item:nth-child(4) {
  transition-delay: 0.2s;
}

.dropdown-category.expanded .dropdown-category-content .dropdown-item:nth-child(5) {
  transition-delay: 0.25s;
}

.dropdown-category.expanded .dropdown-category-content .dropdown-item:nth-child(6) {
  transition-delay: 0.3s;
}

.dropdown-category.expanded .dropdown-category-content .dropdown-item:nth-child(7) {
  transition-delay: 0.35s;
}

.dropdown-category.expanded .dropdown-category-content .dropdown-item:nth-child(8) {
  transition-delay: 0.4s;
}

.dropdown-category.expanded .dropdown-category-content .dropdown-item:nth-child(9) {
  transition-delay: 0.45s;
}

[data-theme="light"] .dropdown-category-title {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.12), rgba(129, 140, 248, 0.06));
}

[data-theme="light"] .dropdown-category-title:hover {
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.2), rgba(129, 140, 248, 0.12));
}

/* 分類區塊內的項目樣式 */
.dropdown-category .dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px !important;
  font-size: 14px;
  border-radius: 10px !important;
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.dropdown-category .dropdown-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(92, 140, 255, 0.15), rgba(129, 140, 248, 0.1));
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: inherit;
}

.dropdown-category .dropdown-item:hover::before {
  opacity: 1;
}

.dropdown-category .dropdown-item:hover {
  transform: translateX(4px);
  color: var(--primary);
}

.dropdown-category .dropdown-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: all 0.2s ease;
  position: relative;
  z-index: 1;
}

.dropdown-category .dropdown-item:hover svg {
  opacity: 1;
  stroke: var(--primary);
}

.dropdown-category .dropdown-item span {
  position: relative;
  z-index: 1;
  font-weight: 500;
}

/* 分類區塊分隔線移除 - 改用間距 */
.dropdown-category+.dropdown-category::before {
  display: none;
}

/* 滾動條美化 */
.dropdown-menu.categorized::-webkit-scrollbar {
  width: 5px;
}

.dropdown-menu.categorized::-webkit-scrollbar-track {
  background: transparent;
  margin: 8px 0;
}

.dropdown-menu.categorized::-webkit-scrollbar-thumb {
  background: rgba(92, 140, 255, 0.3);
  border-radius: 10px;
}

.dropdown-menu.categorized::-webkit-scrollbar-thumb:hover {
  background: rgba(92, 140, 255, 0.5);
}

[data-theme="light"] .dropdown-menu.categorized::-webkit-scrollbar-thumb {
  background: rgba(92, 140, 255, 0.25);
}

[data-theme="light"] .dropdown-menu.categorized::-webkit-scrollbar-thumb:hover {
  background: rgba(92, 140, 255, 0.4);
}

/* 響應式 - 移動端下拉選單 */
@media (max-width: 900px) {
  .dropdown-menu.categorized {
    /* 移除固定定位,改用inline展開 */
    position: static;
    max-width: 100%;
    min-width: 100%;
    max-height: none;
    border-radius: 12px !important;
    padding: 8px !important;
  }

  .dropdown-category {
    padding: 10px;
    margin-bottom: 8px;
  }

  .dropdown-category-title {
    padding: 10px 12px;
    font-size: 12px;
  }

  .dropdown-category .dropdown-item {
    padding: 14px 14px !important;
    font-size: 15px;
  }

  .dropdown-category .dropdown-item svg {
    width: 20px;
    height: 20px;
  }

  .dropdown-category-title .category-arrow {
    width: 16px;
    height: 16px;
  }
}

/* ============================
   FOOTER 頁尾區塊 - 增強版
   ============================ */
.site-footer {
  margin-top: 80px;
  background: linear-gradient(180deg,
      transparent 0%,
      rgba(var(--primary-rgb), 0.02) 30%,
      rgba(var(--primary-rgb), 0.05) 100%);
  position: relative;
  overflow: hidden;
}

/* 頂部分隔裝飾 */
.footer-divider {
  position: relative;
  height: 4px;
  width: 100%;
}

.footer-divider-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  transform: translateY(-50%);
}

.footer-divider-glow {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 4px;
  background: linear-gradient(90deg,
      transparent 0%,
      var(--primary) 20%,
      #8b5cf6 50%,
      var(--primary) 80%,
      transparent 100%);
  border-radius: 2px;
  filter: blur(0.5px);
  animation: footerDividerPulse 4s ease-in-out infinite;
}

@keyframes footerDividerPulse {

  0%,
  100% {
    opacity: 0.6;
    width: 280px;
  }

  50% {
    opacity: 1;
    width: 380px;
  }
}

/* 背景裝飾圓形 */
.site-footer::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(var(--primary-rgb), 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.site-footer::after {
  content: '';
  position: absolute;
  bottom: -150px;
  left: -100px;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 24px 40px;
  display: grid;
  grid-template-columns: 1.2fr 2fr;
  gap: 64px;
  position: relative;
  z-index: 1;
}

/* ===== 品牌區塊 ===== */
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.footer-logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.15), rgba(139, 92, 246, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.2);
  transition: all 0.3s ease;
}

.footer-logo-icon img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.footer-logo:hover .footer-logo-icon {
  transform: rotate(-5deg) scale(1.05);
  box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.3);
}

.footer-logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-title {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 50%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.footer-tagline {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.footer-description {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 320px;
}

/* ===== 社群媒體連結 ===== */
.footer-social {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.social-link {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.social-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.social-link svg {
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
}

.social-link:hover {
  border-color: var(--primary);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.3);
}

.social-link:hover::before {
  opacity: 1;
}

.social-link:hover svg {
  transform: scale(1.1);
}

[data-theme="light"] .social-link {
  background: rgba(0, 0, 0, 0.02);
}

/* ===== 快速連結區塊 ===== */
.footer-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
}

.footer-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.footer-section h4 {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-section h4 .section-icon {
  font-size: 14px;
}

.footer-section a {
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  position: relative;
}

.footer-section a .link-icon {
  font-size: 14px;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.footer-section a:hover {
  color: var(--primary);
  transform: translateX(4px);
}

.footer-section a:hover .link-icon {
  opacity: 1;
  transform: scale(1.15);
}

/* 連結底線動畫 */
.footer-section a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 22px;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  transition: width 0.3s ease;
}

.footer-section a:hover::after {
  width: calc(100% - 22px);
}

/* 聯絡資訊區塊 */
.footer-contact-section .contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 6px 0;
}

.footer-contact-section .contact-item svg {
  color: var(--primary);
  opacity: 0.7;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.footer-contact-section .contact-item:hover svg {
  opacity: 1;
  transform: scale(1.1);
}

.footer-contact-section .contact-item a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
  padding: 0;
}

.footer-contact-section .contact-item a::after {
  display: none;
}

.footer-contact-section .contact-item a:hover {
  color: var(--primary);
  transform: none;
}

/* ===== 版權區塊 ===== */
.footer-bottom {
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, transparent 0%, rgba(var(--primary-rgb), 0.02) 100%);
  position: relative;
  z-index: 1;
}

.footer-bottom-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.footer-copyright {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-copyright .copyright-icon {
  font-size: 14px;
  animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {

  0%,
  100% {
    opacity: 0.7;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

.footer-made-with {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.footer-made-with .heart {
  animation: heartbeat 1.5s ease-in-out infinite;
  display: inline-block;
}

@keyframes heartbeat {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }
}

/* 返回頂部按鈕 */
.back-to-top {
  position: fixed;
  bottom: 150px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 99;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.3);
}

.back-to-top svg {
  transition: transform 0.2s ease;
}

.back-to-top:hover svg {
  transform: translateY(-2px);
}

/* Footer 響應式 */
@media (max-width: 900px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 48px 24px 32px;
  }

  .footer-links {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  .footer-brand {
    text-align: center;
    align-items: center;
  }

  .footer-logo {
    justify-content: center;
  }

  .footer-description {
    text-align: center;
    max-width: 100%;
  }

  .footer-social {
    justify-content: center;
  }

  .footer-section {
    align-items: center;
    text-align: center;
  }

  .footer-section h4 {
    justify-content: center;
  }

  .footer-section a {
    justify-content: center;
  }

  .footer-section a::after {
    left: 50%;
    transform: translateX(-50%);
  }

  .footer-section a:hover::after {
    width: 60%;
  }

  .footer-section a:hover {
    transform: none;
  }

  .footer-contact-section .contact-item {
    justify-content: center;
  }

  .footer-bottom-inner {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .footer-divider-glow {
    width: 200px;
  }

  @keyframes footerDividerPulse {

    0%,
    100% {
      opacity: 0.5;
      width: 180px;
    }

    50% {
      opacity: 0.8;
      width: 260px;
    }
  }

  .back-to-top {
    bottom: 140px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 600px) {
  .footer-links {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .site-footer {
    margin-top: 60px;
  }

  .footer-inner {
    padding: 40px 20px 28px;
    gap: 32px;
  }

  .social-link {
    width: 44px;
    height: 44px;
  }

  .footer-title {
    font-size: 1.25rem;
  }
}

/* ============================
   Skeleton Loading 骨架屏動畫
   ============================ */
.skeleton {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg,
      rgba(var(--primary-rgb), 0.05) 0%,
      rgba(var(--primary-rgb), 0.1) 50%,
      rgba(var(--primary-rgb), 0.05) 100%);
  border-radius: 8px;
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.1) 50%,
      transparent 100%);
  animation: skeletonShimmer 1.5s ease-in-out infinite;
}

@keyframes skeletonShimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* Skeleton 文字行 */
.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-text.long {
  width: 100%;
}

/* Skeleton 標題 */
.skeleton-title {
  height: 24px;
  width: 50%;
  margin-bottom: 16px;
  border-radius: 6px;
}

/* Skeleton 圖片 */
.skeleton-image {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 12px;
}

.skeleton-image.square {
  aspect-ratio: 1/1;
}

.skeleton-image.portrait {
  aspect-ratio: 3/4;
}

/* Skeleton 頭像 */
.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-avatar.sm {
  width: 32px;
  height: 32px;
}

.skeleton-avatar.lg {
  width: 64px;
  height: 64px;
}

/* Skeleton 按鈕 */
.skeleton-button {
  height: 40px;
  width: 120px;
  border-radius: 10px;
}

/* Skeleton 卡片 */
.skeleton-card {
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
}

/* Skeleton 圖片卡片組合 */
.skeleton-gallery-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-gallery-item .skeleton-image {
  aspect-ratio: 1/1;
}

/* 淡入動畫 - 內容載入後使用 */
.fade-in {
  animation: fadeInUp 0.4s ease forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 延遲載入效果 */
.fade-in-delay-1 {
  animation-delay: 0.1s;
}

.fade-in-delay-2 {
  animation-delay: 0.2s;
}

.fade-in-delay-3 {
  animation-delay: 0.3s;
}

.fade-in-delay-4 {
  animation-delay: 0.4s;
}

/* ============================
   通用工具類別
   ============================ */
/* 文字漸層 */
.text-gradient {
  background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 玻璃態效果 */
.glass {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .glass {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.1);
}

/* 發光邊框 */
.glow-border {
  box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.3),
    0 0 20px rgba(var(--primary-rgb), 0.15);
}

/* 滑鼠互動提示 */
.interactive {
  cursor: pointer;
  transition: all 0.2s ease;
}

.interactive:hover {
  transform: translateY(-2px);
}

.interactive:active {
  transform: translateY(0);
}

/* =====================================================
   圖片工具頁面 - 日間模式樣式
   Filter, Crop, Compress, Rotate, Collage, Mosaic, 
   Watermark, Text, GIF Maker
   ===================================================== */

/* 主容器和面板 */
[data-theme="light"] .filter-container,
[data-theme="light"] .crop-container,
[data-theme="light"] .compress-container,
[data-theme="light"] .rotate-container,
[data-theme="light"] .collage-container,
[data-theme="light"] .mosaic-container,
[data-theme="light"] .watermark-container,
[data-theme="light"] .text-container,
[data-theme="light"] .gif-container {
  background: var(--bg);
}

/* 預覽區域和控制面板 */
[data-theme="light"] .preview-area,
[data-theme="light"] .control-panel,
[data-theme="light"] .crop-area,
[data-theme="light"] .compress-area,
[data-theme="light"] .rotate-area,
[data-theme="light"] .collage-area,
[data-theme="light"] .mosaic-area,
[data-theme="light"] .watermark-area,
[data-theme="light"] .text-area,
[data-theme="light"] .gif-area,
[data-theme="light"] .tool-panel,
[data-theme="light"] .settings-panel,
[data-theme="light"] .options-panel {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 預覽框 */
[data-theme="light"] .preview-box,
[data-theme="light"] .crop-box,
[data-theme="light"] .image-box,
[data-theme="light"] .canvas-container {
  background: rgba(0, 0, 0, 0.03);
}

/* 面板標題 */
[data-theme="light"] .panel-title,
[data-theme="light"] .section-title {
  color: #1d2433;
}

/* 上傳佔位符 */
[data-theme="light"] .upload-placeholder {
  color: #55627a;
}

[data-theme="light"] .upload-placeholder svg {
  stroke: #55627a;
}

/* 按鈕樣式 */
[data-theme="light"] .filter-btn,
[data-theme="light"] .aspect-btn,
[data-theme="light"] .tool-btn,
[data-theme="light"] .option-btn,
[data-theme="light"] .preset-btn {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.08);
  color: #1d2433;
}

[data-theme="light"] .filter-btn:hover,
[data-theme="light"] .aspect-btn:hover,
[data-theme="light"] .tool-btn:hover,
[data-theme="light"] .option-btn:hover,
[data-theme="light"] .preset-btn:hover {
  background: #e5e7ef;
  border-color: var(--primary);
}

[data-theme="light"] .filter-btn.active,
[data-theme="light"] .aspect-btn.active,
[data-theme="light"] .tool-btn.active,
[data-theme="light"] .option-btn.active {
  background: rgba(92, 140, 255, 0.15);
  border-color: var(--primary);
  color: var(--primary);
}

/* 次要按鈕 */
[data-theme="light"] .btn-secondary {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.1);
  color: #1d2433;
}

[data-theme="light"] .btn-secondary:hover {
  background: #e5e7ef;
}

/* 滑桿標籤和數值 */
[data-theme="light"] .slider-label,
[data-theme="light"] .slider-label span {
  color: #55627a;
}

[data-theme="light"] .slider-value {
  background: #f0f1f5;
  color: #1d2433;
}

/* 滑桿軌道 */
[data-theme="light"] input[type="range"] {
  background: #e5e7ef;
}

/* 輸入框 */
[data-theme="light"] .size-input,
[data-theme="light"] .text-input,
[data-theme="light"] .number-input {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.1);
  color: #1d2433;
}

[data-theme="light"] .size-input:focus,
[data-theme="light"] .text-input:focus,
[data-theme="light"] .number-input:focus {
  background: #ffffff;
  border-color: var(--primary);
}

/* 快速尺寸按鈕 */
[data-theme="light"] .quick-size-btn,
[data-theme="light"] .quick-btn {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.08);
  color: #55627a;
}

[data-theme="light"] .quick-size-btn:hover,
[data-theme="light"] .quick-btn:hover {
  background: #e5e7ef;
  border-color: var(--primary);
  color: var(--primary);
}

/* 鎖定按鈕 */
[data-theme="light"] .lock-btn {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.1);
  color: #55627a;
}

[data-theme="light"] .lock-btn.locked {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* 資訊提示框 */
[data-theme="light"] .crop-info,
[data-theme="light"] .info-box,
[data-theme="light"] .status-box,
[data-theme="light"] .help-box {
  background: #f0f1f5;
  color: #55627a;
}

[data-theme="light"] .crop-info strong,
[data-theme="light"] .info-box strong {
  color: #1d2433;
}

/* 比較切換 */
[data-theme="light"] .comparison-toggle {
  background: #f0f1f5;
}

/* 分組標題 */
[data-theme="light"] .panel-section {
  border-color: rgba(0, 0, 0, 0.05);
}

/* 顏色選擇器區域 */
[data-theme="light"] .color-picker-area,
[data-theme="light"] .color-preview {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.1);
}

/* 文字樣式選項 */
[data-theme="light"] .font-select,
[data-theme="light"] .style-select {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.1);
  color: #1d2433;
}

/* GIF 製作特定樣式 */
[data-theme="light"] .frame-list,
[data-theme="light"] .frame-item {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .frame-item.active,
[data-theme="light"] .frame-item:hover {
  border-color: var(--primary);
}

/* 拖放區域 */
[data-theme="light"] .drop-zone,
[data-theme="light"] .dropzone {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .drop-zone:hover,
[data-theme="light"] .dropzone:hover {
  background: rgba(92, 140, 255, 0.05);
  border-color: var(--primary);
}

/* 工具提示 */
[data-theme="light"] .tooltip,
[data-theme="light"] [title]::after {
  background: #1d2433;
  color: #ffffff;
}

/* 進度指示器 */
[data-theme="light"] .progress-bar {
  background: #e5e7ef;
}

/* 標籤 */
[data-theme="light"] .tag,
[data-theme="light"] .badge {
  background: rgba(92, 140, 255, 0.1);
  color: var(--primary);
}

/* =====================================================
   圖片工具頁面 - 詳細日間模式樣式
   針對特定元素的覆蓋
   ===================================================== */

/* 上傳區域 - 圖片壓縮、圖片加字 */
[data-theme="light"] .upload-zone {
  background: #f8f9fc;
  border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .upload-zone:hover {
  background: rgba(92, 140, 255, 0.05);
  border-color: var(--primary);
}

[data-theme="light"] .upload-zone.dragover {
  background: rgba(92, 140, 255, 0.1);
  border-color: var(--primary);
}

[data-theme="light"] .upload-zone svg {
  stroke: #55627a;
}

[data-theme="light"] .upload-zone p,
[data-theme="light"] .upload-zone strong {
  color: #1d2433;
}

[data-theme="light"] .upload-zone .formats {
  color: #55627a;
}

/* 模式切換標籤 - 人臉馬賽克 */
[data-theme="light"] .mode-tabs .mode-tab {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.1);
  color: #55627a;
}

[data-theme="light"] .mode-tabs .mode-tab:hover {
  border-color: var(--primary);
  color: #1d2433;
}

[data-theme="light"] .mode-tabs .mode-tab.active {
  background: rgba(92, 140, 255, 0.15);
  border-color: var(--primary);
  color: var(--primary);
}

/* 偵測狀態 - 人臉馬賽克 */
[data-theme="light"] .detection-status {
  background: #f0f1f5;
  color: #55627a;
}

[data-theme="light"] .detection-status.detecting {
  color: #3b82f6;
}

[data-theme="light"] .detection-status.found {
  color: #10b981;
}

[data-theme="light"] .detection-status.none {
  color: #ca8a04;
}

/* 人臉列表項目 */
[data-theme="light"] .face-item {
  background: #f0f1f5;
}

[data-theme="light"] .face-item:hover {
  background: rgba(92, 140, 255, 0.1);
}

[data-theme="light"] .face-item.selected {
  border-color: var(--primary);
}

[data-theme="light"] .face-info {
  color: #1d2433;
}

/* 手動提示框 */
[data-theme="light"] .manual-hint {
  background: rgba(234, 179, 8, 0.08);
  border-color: rgba(234, 179, 8, 0.3);
  color: #b45309;
}

/* 選項面板 - 圖片壓縮 */
[data-theme="light"] .options-panel {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .option-label {
  color: #1d2433;
}

[data-theme="light"] .option-select,
[data-theme="light"] .option-input {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.1);
  color: #1d2433;
}

[data-theme="light"] .option-select:focus,
[data-theme="light"] .option-input:focus {
  background: #ffffff;
  border-color: var(--primary);
}

/* 品質滑桿 */
[data-theme="light"] .quality-slider input[type="range"] {
  background: #e5e7ef;
}

[data-theme="light"] .quality-value {
  color: var(--primary);
}

/* 檔案列表 - 圖片壓縮 */
[data-theme="light"] .files-list {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .files-header {
  background: #f0f1f5;
  color: #55627a;
}

[data-theme="light"] .file-item {
  border-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .file-name {
  color: #1d2433;
}

[data-theme="light"] .file-size {
  color: #55627a;
}

[data-theme="light"] .file-thumb {
  background: #f0f1f5;
}

/* 批次操作 */
[data-theme="light"] .bulk-actions {
  background: #f0f1f5;
}

[data-theme="light"] .summary {
  color: #55627a;
}

[data-theme="light"] .summary strong {
  color: #1d2433;
}

/* 動作按鈕 */
[data-theme="light"] .action-btn {
  background: #f0f1f5;
  color: #55627a;
}

[data-theme="light"] .action-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

/* 空狀態 */
[data-theme="light"] .empty-state {
  color: #55627a;
}

/* 浮水印類型選擇 */
[data-theme="light"] .type-tabs,
[data-theme="light"] .watermark-tabs {
  background: #f0f1f5;
}

[data-theme="light"] .type-tab,
[data-theme="light"] .watermark-tab {
  background: transparent;
  color: #55627a;
}

[data-theme="light"] .type-tab:hover,
[data-theme="light"] .watermark-tab:hover {
  color: var(--primary);
}

[data-theme="light"] .type-tab.active,
[data-theme="light"] .watermark-tab.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 平鋪模式開關 */
[data-theme="light"] .toggle-group,
[data-theme="light"] .option-toggle {
  background: #f0f1f5;
}

[data-theme="light"] .toggle-label {
  color: #1d2433;
}

/* GIF 製作選項 */
[data-theme="light"] .gif-options,
[data-theme="light"] .playback-options {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .gif-option,
[data-theme="light"] .playback-option {
  color: #55627a;
}

[data-theme="light"] .gif-option.active,
[data-theme="light"] .playback-option.active {
  background: rgba(92, 140, 255, 0.1);
  color: var(--primary);
}

/* 尺寸選項 */
[data-theme="light"] .size-options,
[data-theme="light"] .size-grid {
  background: #f0f1f5;
}

[data-theme="light"] .size-option,
[data-theme="light"] .size-btn {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  color: #55627a;
}

[data-theme="light"] .size-option:hover,
[data-theme="light"] .size-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

[data-theme="light"] .size-option.active,
[data-theme="light"] .size-btn.active {
  background: rgba(92, 140, 255, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

/* 播放控制 */
[data-theme="light"] .playback-controls {
  background: #f0f1f5;
}

/* 文字列表 - 圖片加字 */
[data-theme="light"] .text-list,
[data-theme="light"] .text-item {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .text-item:hover {
  background: rgba(92, 140, 255, 0.05);
}

[data-theme="light"] .text-item.active,
[data-theme="light"] .text-item.selected {
  border-color: var(--primary);
  background: rgba(92, 140, 255, 0.1);
}

/* 畫布容器和包裝器 */
[data-theme="light"] .canvas-wrapper,
[data-theme="light"] .canvas-area {
  background: #f8f9fc;
}

/* 通用標題和標籤 */
[data-theme="light"] .compress-header h1,
[data-theme="light"] .mosaic-container h1,
[data-theme="light"] .watermark-container h1,
[data-theme="light"] .text-container h1,
[data-theme="light"] .gif-container h1 {
  color: #1d2433;
}

[data-theme="light"] .compress-header p {
  color: #55627a;
}

/* 圖片旋轉按鈕 */
[data-theme="light"] .rotate-btn,
[data-theme="light"] .flip-btn {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.1);
  color: #55627a;
}

[data-theme="light"] .rotate-btn:hover,
[data-theme="light"] .flip-btn:hover {
  background: rgba(92, 140, 255, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

/* 圖片拼接網格 */
[data-theme="light"] .collage-grid,
[data-theme="light"] .layout-grid {
  background: #f0f1f5;
}

[data-theme="light"] .collage-cell,
[data-theme="light"] .layout-cell {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .collage-cell:hover,
[data-theme="light"] .layout-cell:hover {
  border-color: var(--primary);
}

/* =====================================================
   圖片工具 - 額外日間模式樣式
   Checkbox, Style Buttons, Position Grid, Playback
   ===================================================== */

/* Checkbox 群組 - 平鋪模式、循環播放、倒轉播放 */
[data-theme="light"] .checkbox-group {
  background: #f0f1f5;
  color: #1d2433;
}

[data-theme="light"] .checkbox-group span {
  color: #1d2433;
}

[data-theme="light"] .checkbox-group:hover {
  background: #e5e7ef;
}

/* 樣式按鈕 - B I U */
[data-theme="light"] .style-btn {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.1);
  color: #55627a;
}

[data-theme="light"] .style-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

[data-theme="light"] .style-btn.active {
  background: rgba(92, 140, 255, 0.15);
  border-color: var(--primary);
  color: var(--primary);
}

/* 對齊按鈕 - 快速定位 */
[data-theme="light"] .align-buttons .style-btn {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.1);
  color: #55627a;
}

[data-theme="light"] .align-buttons .style-btn:hover {
  background: rgba(92, 140, 255, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

/* 位置按鈕 - 浮水印位置 */
[data-theme="light"] .position-btn {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.1);
  color: #55627a;
}

[data-theme="light"] .position-btn:hover {
  border-color: var(--primary);
}

[data-theme="light"] .position-btn.active {
  background: rgba(92, 140, 255, 0.2);
  border-color: var(--primary);
  color: var(--primary);
}

[data-theme="light"] .position-grid {
  background: transparent;
}

/* 播放控制按鈕 - GIF 製作 */
[data-theme="light"] .playback-btn {
  background: #f0f1f5;
  color: #55627a;
}

[data-theme="light"] .playback-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

[data-theme="light"] .playback-btn.active {
  background: var(--primary);
  color: #ffffff;
}

/* 表單輸入 - 圖片加字、浮水印 */
[data-theme="light"] .form-input,
[data-theme="light"] .form-textarea,
[data-theme="light"] .form-select {
  background: #f0f1f5;
  border-color: rgba(0, 0, 0, 0.1);
  color: #1d2433;
}

[data-theme="light"] .form-input:focus,
[data-theme="light"] .form-textarea:focus,
[data-theme="light"] .form-select:focus {
  background: #ffffff;
  border-color: var(--primary);
}

[data-theme="light"] .form-label {
  color: #55627a;
}

/* 顏色選擇器 */
[data-theme="light"] .color-picker::-webkit-color-swatch {
  border-color: rgba(0, 0, 0, 0.15);
}

/* Logo 上傳區 - 浮水印 */
[data-theme="light"] .logo-upload {
  background: #f8f9fc;
  border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .logo-upload:hover {
  border-color: var(--primary);
  background: rgba(92, 140, 255, 0.05);
}

/* 已添加文字項目 */
[data-theme="light"] .text-item-btn {
  border-color: rgba(0, 0, 0, 0.1);
  color: #55627a;
}

[data-theme="light"] .text-item-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* 進度條 */
[data-theme="light"] .progress-bar {
  background: #e5e7ef;
}

/* 影格計數 */
[data-theme="light"] .frame-count {
  color: #55627a;
}