/* Modern Elegant Light Design System for Web Apps / Tools */
:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.15);
  --accent-color: #7c3aed;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --text-color: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max-width: 1200px;
  --radius-lg: 14px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 30px -4px rgba(79, 70, 229, 0.1);
  --transition: all 0.2s ease;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Top Navigation (Language Selector) */
.lang-nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 100;
}

.lang-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  max-height: 38px;
  overflow: hidden;
  gap: 6px 12px;
  transition: max-height 0.25s ease, box-shadow 0.25s ease;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--card-border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.lang-nav-container:hover .lang-nav,
.lang-nav:hover {
  max-height: 260px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.lang-nav a,
.footer-lang-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  padding: 2px 6px;
  border-radius: 4px;
}

.lang-nav a:hover,
.footer-lang-nav a:hover {
  color: var(--primary-color);
  background: rgba(79, 70, 229, 0.06);
}

.footer-lang-nav a {
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid var(--card-border);
  background: #ffffff;
}

/* Main Layout Wrapper */
.app-container {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-body {
  width: 100%;
}

/* Brand Section */
.brand-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  width: 100%;
  margin-bottom: 16px;
}

.brand-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.toolbox-badge-wrapper {
  margin-bottom: 6px;
}

.toolbox-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(79, 70, 229, 0.06);
  border: 1px solid rgba(79, 70, 229, 0.15);
  padding: 3px 10px;
  border-radius: 20px;
  color: var(--primary-color);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  transition: var(--transition);
}

.toolbox-badge:hover {
  background: rgba(79, 70, 229, 0.12);
  transform: translateY(-1px);
}

.toolbox-badge svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  display: block;
  flex-shrink: 0;
}

.app-header {
  text-align: left;
}

.app-title {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-color);
  margin-bottom: 4px;
}

.app-description {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.header-ad {
  flex-shrink: 0;
  width: 728px;
  height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  overflow: hidden;
}

/* Tool Main Card */
.tool-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Top Settings Bar */
.tool-settings-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--card-border);
}

.settings-left,
.settings-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.setting-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-color);
  cursor: pointer;
  user-select: none;
  line-height: 1;
}

.setting-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--primary-color);
  width: 16px;
  height: 16px;
  display: block;
}

.prefix-input-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1;
}

.subtle-input,
.subtle-select {
  border: 1px solid var(--card-border);
  background: #f8fafc;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-color);
  outline: none;
  transition: var(--transition);
}

.subtle-input {
  width: 140px;
}

.quality-input {
  width: 75px;
}

.subtle-select {
  cursor: pointer;
  padding-right: 12px;
}

.subtle-input:focus,
.subtle-select:focus {
  border-color: var(--primary-color);
  background: #ffffff;
  box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Paste / Drop Stage */
.paste-stage {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  background: #fbfcfe;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
  position: relative;
  transition: var(--transition);
  cursor: pointer;
  outline: none;
  caret-color: transparent;
}

.paste-stage:hover,
.paste-stage.is-dragover {
  border-color: var(--primary-color);
  background: rgba(79, 70, 229, 0.02);
}

.paste-stage.has-image {
  cursor: default;
  background: #ffffff;
  padding: 16px;
  border-style: solid;
  border-color: var(--card-border);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 500px;
}

.paste-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(79, 70, 229, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  margin-bottom: 4px;
}

.paste-icon-wrap svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.empty-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-color);
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.keyboard-badge {
  display: inline-block;
  padding: 2px 6px;
  background: #e2e8f0;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 600;
  color: #334155;
  border-bottom: 2px solid #cbd5e1;
}

/* Image Preview Container */
.preview-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.image-wrapper {
  max-width: 100%;
  width: 100%;
  max-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  /* Checkerboard pattern for transparent images */
  background-color: #ffffff;
  background-image: 
    linear-gradient(45deg, #f1f5f9 25%, transparent 25%), 
    linear-gradient(-45deg, #f1f5f9 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #f1f5f9 75%), 
    linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  padding: 12px;
}

.preview-img {
  max-width: 100%;
  max-height: 480px;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.image-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
  background: #f8fafc;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
}

.meta-item strong {
  color: var(--text-color);
  font-weight: 600;
}

/* Action Toolbar & Buttons */
.action-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  user-select: none;
  vertical-align: middle;
}

.btn span {
  display: inline-block;
  line-height: 1;
}

.btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: block;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-color);
  border-color: var(--card-border);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.btn-paste {
  background: #ffffff;
  color: var(--primary-color);
  border: 1px solid rgba(79, 70, 229, 0.3);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.05);
}

.btn-paste:hover {
  background: rgba(79, 70, 229, 0.06);
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(79, 70, 229, 0.12);
}

.btn-outline-primary {
  background: #ffffff;
  color: var(--primary-color);
  border-color: rgba(79, 70, 229, 0.3);
}

.btn-outline-primary:hover {
  background: rgba(79, 70, 229, 0.05);
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: #f8fafc;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  outline: none;
}

.btn-icon:hover {
  background: #ffffff;
  color: var(--primary-color);
  border-color: var(--primary-color);
  transform: rotate(-30deg);
}

.btn-icon svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* Dropdown Menu Styles */
.dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.dropdown-arrow {
  width: 14px;
  height: 14px;
  fill: currentColor;
  transition: transform 0.2s ease;
  margin-left: -2px;
}

.dropdown-wrapper:hover .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 130px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 4px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 1000;
}

/* 增加伪元素防止 hover 移出间隙消失 */
.dropdown-menu-list::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 0;
  width: 100%;
  height: 8px;
}

.dropdown-wrapper:hover .dropdown-menu-list {
  display: flex;
}

.dropdown-item {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  font-weight: 500;
  user-select: none;
}

.dropdown-item:hover {
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary-color);
}

/* Article & Documentation Section */
.article-container {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 32px 28px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Feature Highlights Grid */
.feature-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feature-box h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-color);
  line-height: 1.4;
  position: relative;
  padding-left: 12px;
}

.feature-box h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  background: var(--primary-color);
  border-radius: 2px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.feature-card {
  background: #f8fafc;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  transition: var(--transition);
}

.feature-card:hover {
  background: #ffffff;
  border-color: rgba(79, 70, 229, 0.3);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(79, 70, 229, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  flex-shrink: 0;
}

.feature-icon-wrap svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.feature-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-color);
  line-height: 1.3;
}

.feature-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

@media (max-width: 900px) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }
}

.article-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.article-section h2 {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-color);
  line-height: 1.4;
  position: relative;
  padding-left: 12px;
}

.article-section h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  background: var(--primary-color);
  border-radius: 2px;
}

.article-text {
  font-size: 14px;
  color: #334155;
  line-height: 1.7;
}

.article-list {
  list-style: disc;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: #334155;
  line-height: 1.6;
}

.article-list strong {
  color: var(--text-color);
}

.keyboard-inline {
  display: inline-block;
  padding: 1px 5px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  color: #0f172a;
  margin: 0 2px;
}

/* Notification Toast */
.toast-msg {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #0f172a;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Footer Section */
.app-footer {
  margin: auto auto 0;
  max-width: var(--max-width);
  width: 100%;
  border-top: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.7);
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}

.footer-lang-nav {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
}

.footer-links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.footer-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.footer-link:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 1024px) {
  .brand-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .app-title {
    font-size: 1.35rem;
  }

  .header-ad {
    display: none;
  }

  .tool-settings-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-toolbar {
    width: 100%;
    flex-direction: column;
  }

  .action-toolbar .btn {
    width: 100%;
  }
}