/* KunQiong AI Formatter - Modern Styles with Header/Footer */

/* CSS Variables */
:root {
  --primary-color: #1e88e5;
  --primary-dark: #1565c0;
  --primary-light: #e3f2fd;
  --header-height: 72px;
  --header-bg: #ffffff;
  --footer-bg: #1d2939;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --font-sans: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
  --font-latin: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-zh-cn: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  --font-zh-tw: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", "Source Han Sans TC", sans-serif;
  --font-ja: "Yu Gothic", "Meiryo", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --font-ko: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --font-ar: "Tahoma", "Segoe UI", "Noto Naskh Arabic", "Noto Sans Arabic", sans-serif;
  --font-he: "Segoe UI", "Arial Hebrew", "Noto Sans Hebrew", sans-serif;
  --font-hi: "Nirmala UI", "Mangal", "Noto Sans Devanagari", sans-serif;
  --font-th: "Leelawadee UI", "Tahoma", "Noto Sans Thai", sans-serif;
  --font-bn: "Nirmala UI", "Noto Sans Bengali", sans-serif;
  --font-ta: "Latha", "Nirmala UI", "Noto Sans Tamil", sans-serif;
  --body-font-size: 15px;
  --body-line-height: 1.72;
  --ui-scale: 1;
  --label-font-size: 13px;
  --control-font-size: 14px;
  --nav-font-size: 14px;
  --title-font-size: 28px;
  --subtitle-font-size: 14px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: linear-gradient(180deg, #f0f8ff 0%, #f5f7fa 15%);
  min-height: 100vh;
  color: var(--text-primary);
  font-size: var(--body-font-size);
  line-height: var(--body-line-height);
}

button,
input,
select,
textarea {
  font: inherit;
}

html[data-ui-locale="zh-CN"],
html[data-ui-locale="zh-SG"] {
  --font-sans: var(--font-zh-cn);
}

html[data-ui-locale="zh-TW"],
html[data-ui-locale="zh-HK"],
html[data-ui-locale="zh-MO"] {
  --font-sans: var(--font-zh-tw);
}

html[data-ui-locale="en"],
html[data-ui-locale="fr"],
html[data-ui-locale="de"],
html[data-ui-locale="es"],
html[data-ui-locale="it"],
html[data-ui-locale="pt"],
html[data-ui-locale="pt-BR"],
html[data-ui-locale="nl"],
html[data-ui-locale="pl"],
html[data-ui-locale="tr"],
html[data-ui-locale="uk"],
html[data-ui-locale="vi"],
html[data-ui-locale="id"],
html[data-ui-locale="ms"],
html[data-ui-locale="sw"],
html[data-ui-locale="tl"] {
  --font-sans: var(--font-latin);
}

html[data-ui-locale="ja"] {
  --font-sans: var(--font-ja);
}

html[data-ui-locale="ko"] {
  --font-sans: var(--font-ko);
}

html[data-ui-locale="ar"],
html[data-ui-locale="fa"],
html[data-ui-locale="ur"] {
  --font-sans: var(--font-ar);
}

html[data-ui-locale="he"] {
  --font-sans: var(--font-he);
}

html[data-ui-locale="hi"] {
  --font-sans: var(--font-hi);
}

html[data-ui-locale="th"] {
  --font-sans: var(--font-th);
}

html[data-ui-locale="bn"] {
  --font-sans: var(--font-bn);
}

html[data-ui-locale="ta"] {
  --font-sans: var(--font-ta);
}

html[data-ui-region="US"],
html[data-ui-region="GB"],
html[data-ui-region="FR"],
html[data-ui-region="DE"],
html[data-ui-region="ES"],
html[data-ui-region="IT"],
html[data-ui-region="PT"],
html[data-ui-region="BR"],
html[data-ui-region="RU"],
html[data-ui-region="NL"],
html[data-ui-region="PL"],
html[data-ui-region="TR"],
html[data-ui-region="UA"],
html[data-ui-region="TZ"] {
  --body-font-size: 14.5px;
  --body-line-height: 1.68;
  --ui-scale: 1;
}

html[data-ui-region="CN"],
html[data-ui-region="SG"] {
  --body-font-size: 15px;
  --body-line-height: 1.74;
  --ui-scale: 1.02;
}

html[data-ui-region="TW"],
html[data-ui-region="HK"],
html[data-ui-region="MO"] {
  --body-font-size: 15px;
  --body-line-height: 1.78;
  --ui-scale: 1.03;
}

html[data-ui-region="JP"],
html[data-ui-region="KR"] {
  --body-font-size: 15px;
  --body-line-height: 1.8;
  --ui-scale: 1.04;
}

html[data-ui-region="TH"],
html[data-ui-region="VN"],
html[data-ui-region="ID"],
html[data-ui-region="MY"],
html[data-ui-region="PH"] {
  --body-font-size: 15px;
  --body-line-height: 1.78;
  --ui-scale: 1.03;
}

html[data-ui-region="IN"],
html[data-ui-region="BD"],
html[data-ui-region="PK"],
html[data-ui-region="LK"] {
  --body-font-size: 15.5px;
  --body-line-height: 1.84;
  --ui-scale: 1.05;
}

html[data-ui-region="SA"],
html[data-ui-region="IR"],
html[data-ui-region="IL"] {
  --body-font-size: 16px;
  --body-line-height: 1.88;
  --ui-scale: 1.06;
}

/* Header Styles */
.header {
  background: var(--header-bg);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 32px;
}

.header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo a {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--primary-color);
  transition: transform 0.2s ease;
}

.logo a:hover {
  transform: scale(1.02);
}

.logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
}

/* Navigation */
.nav {
  display: flex;
  gap: 16px;
  margin-left: 32px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
  white-space: nowrap;
  padding: 8px 0;
}

.nav::-webkit-scrollbar {
  height: 4px;
}

.nav::-webkit-scrollbar-track {
  background: transparent;
}

.nav::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}

.nav-link {
  text-decoration: none;
  color: #333;
  font-size: calc(var(--nav-font-size) * var(--ui-scale));
  font-weight: 400;
  padding: 10px 4px;
  position: relative;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: var(--body-line-height);
}

.nav-link:hover {
  color: var(--primary-color);
}

.nav-link:hover::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--primary-color);
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.nav-link.active {
  color: var(--primary-color);
  font-weight: 500;
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--primary-color);
}

.nav-item-wrapper {
  display: flex;
  align-items: center;
  gap: 0;
}

.category-dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  margin-left: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  transition: all 0.2s ease;
  border-radius: 4px;
}

.category-dropdown-toggle:hover {
  background-color: rgba(30, 136, 229, 0.1);
}

/* Header Right Section */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.search-box {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--primary-light);
  border-radius: 18px;
  height: 34px;
  width: 240px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(30, 136, 229, 0.05);
}

.search-box:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.08);
  transform: translateY(-1px);
}

.search-icon-btn {
  background: none;
  border: none;
  padding: 0 12px 0 16px;
  cursor: pointer;
  color: #666;
  font-size: 15px;
  transition: color 0.2s ease;
}

.search-icon-btn:hover {
  color: var(--primary-color);
}

.search-box input {
  border: none;
  background: transparent;
  font-size: 14px;
  width: 100%;
  outline: none;
  padding-right: 16px;
  color: #333;
}

.search-box input::placeholder {
  color: #999;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-login-btn {
  text-decoration: none;
  color: #fff;
  font-size: calc(var(--control-font-size) * var(--ui-scale));
  font-weight: 400;
  padding: 10px 20px;
  border-radius: 8px;
  transition: all 0.2s ease;
  background: linear-gradient(135deg, #1e88e5 0%, #1976d2 100%);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  box-shadow: 0 2px 8px rgba(30, 136, 229, 0.25);
  cursor: pointer;
}

.header-login-btn:hover {
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  box-shadow: 0 4px 12px rgba(30, 136, 229, 0.35);
  transform: translateY(-1px);
}

.header-search-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  border-radius: 8px;
}

.header-search-btn:hover {
  background-color: #f5f5f5;
}

.header-search-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.mobile-menu-btn:hover {
  background-color: rgba(30, 136, 229, 0.1);
}

/* Main Content Area */
.main-content {
  min-height: calc(100vh - 72px);
  padding: 12px 20px 40px;
}

.content-wrapper {
  max-width: 1200px;
  margin: -84px auto 0;
}

/* Tool Card Container */
.tool-container {
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: visible;
  border: 1px solid rgba(226, 232, 240, 0.8);
  min-height: calc(100vh - 120px);
}

.tool-header {
  background: linear-gradient(135deg, rgba(30, 136, 229, 0.05) 0%, rgba(227, 242, 253, 0.1) 100%);
  padding: 24px 32px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  overflow: visible;
  z-index: 20;
}

.tool-title-section {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
}

.tool-title-section > :first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.tool-title {
  font-size: calc(var(--title-font-size) * var(--ui-scale));
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.tool-subtitle {
  font-size: calc(var(--subtitle-font-size) * var(--ui-scale));
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: var(--body-line-height);
}

.lang-selector {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
  flex: 0 0 auto;
}

.locale-selector-grid,
.locale-footer-grid {
  display: grid;
  grid-template-columns: minmax(220px, 280px);
  gap: 12px;
  width: min(100%, 280px);
}

.locale-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.lang-selector label,
.locale-field label {
  font-size: calc(var(--label-font-size) * var(--ui-scale));
  color: var(--text-secondary);
  white-space: nowrap;
}

.lang-selector select,
.locale-footer-grid select {
  height: 36px;
  min-width: 0;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: white;
  padding: 0 12px;
  font-size: calc(var(--control-font-size) * var(--ui-scale));
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-selector select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.1);
}

/* Tool Body */
.tool-body {
  padding: 36px 32px 48px;
}

.form-group {
  margin-bottom: 24px;
}

.input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* 粘贴、清空按钮成组靠右 */
.input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0;
}

.paste-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #1e88e5 0%, #1976d2 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(30, 136, 229, 0.3);
}

.paste-btn:hover {
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(30, 136, 229, 0.4);
}

.paste-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(30, 136, 229, 0.3);
}

.paste-btn svg {
  flex-shrink: 0;
}

.clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(100, 116, 139, 0.3);
}

.clear-btn:hover {
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(100, 116, 139, 0.4);
}

.clear-btn:active {
  transform: translateY(0);
}

.clear-btn svg {
  flex-shrink: 0;
}

.form-textarea {
  width: 100%;
  height: 280px;
  min-height: 280px;
  max-height: 280px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: white;
  padding: 16px;
  font-size: 14px;
  color: var(--text-primary);
  resize: none;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: break-word;
  word-wrap: break-word;
  transition: all 0.2s ease;
  font-family: inherit;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.1);
}

.form-textarea::placeholder {
  color: #94a3b8;
}


.form-select {
  height: 42px;
  width: 100%;
  max-width: 320px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: white;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.1);
}

/* Export Buttons */
.export-section {
  margin-bottom: 24px;
}

.export-section-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.export-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.export-label-inline {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-right: 4px;
  flex-shrink: 0;
}

.export-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.export-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 136, 229, 0.15);
}

.export-btn:active:not(:disabled) {
  transform: translateY(0);
}

.export-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  background: #f1f5f9;
}

.export-btn-active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  box-shadow: 0 2px 8px rgba(30, 136, 229, 0.35);
}

.export-btn-active:hover:not(:disabled) {
  background: #1976d2;
  border-color: #1976d2;
  color: white;
}

.export-btn-primary {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  margin-left: 8px;
}

.export-btn-primary:hover:not(:disabled) {
  background: #1976d2;
  border-color: #1976d2;
  color: white;
}

/* 开始格式化：单独一行、大按钮、居中 */
.start-format-row {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
}

.export-btn-start-format {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px;
  background: linear-gradient(135deg, #1e88e5 0%, #1976d2 100%);
  border: none;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(30, 136, 229, 0.35);
}

.export-btn-start-format:hover:not(:disabled) {
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(30, 136, 229, 0.4);
}

.export-btn-start-format:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* 转换中遮罩 + 旋转动画 */
.converting-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.converting-overlay.hidden {
  display: none !important;
}

.converting-overlay-inner {
  background: white;
  border-radius: 16px;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-lg);
  min-width: 260px;
}

.converting-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: converting-spin 0.9s linear infinite;
}

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

.converting-message {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

/* 下载区 */
.download-area {
  margin-top: 16px;
  padding: 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
}

.download-area.hidden {
  display: none !important;
}

.download-area-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 8px;
}

.download-rightclick-hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.format-error-hint {
  margin-top: 12px;
  font-size: 14px;
  color: #b91c1c;
  font-weight: 500;
}

.format-error-hint.hidden {
  display: none !important;
}

.format-success-hint {
  font-size: 14px;
  color: var(--success-color, #0d9488);
  font-weight: 500;
  margin: 8px 0 4px 0;
}

.format-success-hint.hidden {
  display: none;
}

/* Word Options Panel */
.options-panel {
  background: #f8fafc;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.options-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
}

.radio-label input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-color);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-color);
}

.hint-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* Status Bar */
.status-bar {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-top: 12px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.download-link:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.hidden {
  display: none !important;
}

/* Download Section */
.download-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.section-label {
  font-size: calc(12px * var(--ui-scale));
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.download-os-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.download-os-tab {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.download-os-tab:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.download-os-tab.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.download-linux-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin: -6px 0 12px 0;
  line-height: 1.5;
}

.download-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.download-btn:hover {
  background: #f8fafc;
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* Language Footer Links */
.lang-footer {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.locale-current {
  margin-top: 12px;
  font-size: calc(13px * var(--ui-scale));
  color: var(--text-secondary);
  line-height: var(--body-line-height);
}

.lang-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.lang-links a:hover {
  color: var(--primary-color);
}

.lang-links .current-lang {
  color: var(--primary-color);
  font-weight: 500;
}

@media (max-width: 768px) {
  .locale-selector-grid,
  .locale-footer-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }
}

/* Custom Format Modal */
.custom-format-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.custom-format-modal {
  background: white;
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

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

.custom-format-modal-inner {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.custom-format-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.custom-format-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.custom-format-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.custom-format-modal-close:hover {
  background: #f5f5f5;
  color: var(--text-primary);
}

.custom-format-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.custom-format-fieldset {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.custom-format-legend {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0 8px;
}

.custom-format-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.custom-format-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.custom-format-label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 120px;
  flex-shrink: 0;
}

.custom-format-input {
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  padding: 0 10px;
  font-size: 13px;
  color: var(--text-primary);
}

.custom-format-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(30, 136, 229, 0.1);
}

.custom-format-input-text {
  flex: 1;
}

.custom-format-input-select {
  min-width: 120px;
}

.custom-format-input-num {
  width: 80px;
}

.custom-format-unit {
  font-size: 12px;
  color: var(--text-secondary);
}

.custom-format-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  background: #f9fafb;
}

.custom-format-modal-ok {
  padding: 10px 24px;
  background: linear-gradient(135deg, #1e88e5 0%, #1976d2 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.custom-format-modal-ok:hover {
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 136, 229, 0.3);
}

.custom-format-inline-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: white;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.custom-format-inline-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* Footer Styles */
.footer {
  background-color: var(--footer-bg);
  margin-top: auto;
  padding: 50px 20px 30px;
}

.footer .container {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-content {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 30px;
}

.footer-brand-section {
  max-width: 280px;
}

.footer-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
  margin-bottom: 16px;
}

.footer-desc {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.7;
  margin-bottom: 20px;
}

.footer-social {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.social-icon {
  width: 66px;
  height: 66px;
  border: 1px solid #374151;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  background: transparent;
  text-decoration: none;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}

.social-icon:hover {
  border-color: #4b5563;
  background: rgba(148, 163, 184, 0.08);
  transform: translateY(-2px);
}

.social-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.social-icon:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 3px;
}

.footer-section h4 {
  margin-bottom: 20px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section ul li {
  margin-bottom: 12px;
}

.footer-section ul li a {
  text-decoration: none;
  color: #94a3b8;
  font-size: 14px;
  transition: color 0.3s;
}

.footer-section ul li a:hover {
  color: #3b82f6;
}

.contact-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  font-size: 14px;
}

.contact-icon-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

.footer-bottom {
  padding: 20px 0;
  border-top: 1px solid #374151;
  text-align: center;
}

.copyright-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  color: #64748b;
  font-size: 13px;
}

.copyright-links a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.3s;
}

.copyright-links a:hover {
  color: #3b82f6;
}

.separator {
  color: #475569;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .nav {
    gap: 12px;
    margin-left: 20px;
  }
  
  .search-box {
    width: 180px;
  }
  
  .header-container {
    padding: 0 20px;
  }
}

@media (max-width: 992px) {
  .nav {
    gap: 10px;
    margin-left: 16px;
  }
  
  .search-box {
    width: 140px;
  }
  
  .nav-link {
    font-size: 13px;
    padding: 8px 2px;
  }
  
  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }
  
  .footer-brand-section {
    grid-column: span 2;
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 60px;
  }

  .header {
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  }

  .content-wrapper {
    margin-top: 0;
  }
  
  .nav,
  .search-box {
    display: none;
  }

  .nav.nav-mobile-open {
    display: flex !important;
    position: fixed;
    top: calc(var(--header-height) + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    z-index: 999;
    margin: 0;
    padding: 12px 16px 20px;
    max-height: calc(100vh - var(--header-height) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 8px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    white-space: normal;
    background: #fff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    border-bottom: 1px solid var(--border-color);
  }

  .nav.nav-mobile-open .nav-link {
    padding: 12px 4px;
    font-size: 15px;
    border-bottom: 1px solid #f1f5f9;
  }

  .nav.nav-mobile-open .nav-item-wrapper {
    flex-wrap: wrap;
    border-bottom: 1px solid #f1f5f9;
    padding: 4px 0;
  }

  .nav.nav-mobile-open .nav-item-wrapper .nav-link {
    flex: 1 1 auto;
    border-bottom: none;
  }

  .nav.nav-mobile-open .category-dropdown-toggle {
    padding: 10px;
    margin-left: 0;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }
  
  .header-right {
    gap: 8px;
  }
  
  .header-container {
    padding: 0 16px;
  }
  
  .header-search-btn {
    display: flex;
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
  .header-login-btn {
    padding: 8px 16px;
    font-size: 13px;
    height: 36px;
  }
  
  .main-content {
    min-height: auto;
    padding: 6px 16px 12px 16px;
  }

  .tool-container {
    min-height: auto;
  }
  
  .tool-header {
    padding: 20px 24px;
  }
  
  .tool-title {
    font-size: 22px;
  }
  
  .tool-body {
    padding: 24px;
  }

  .locale-selector-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .tool-title-section {
    flex-wrap: wrap;
  }

  .lang-selector {
    margin-left: 0;
    justify-content: flex-start;
  }
  
  .export-buttons {
    gap: 8px;
  }
  
  .export-btn {
    padding: 8px 16px;
    font-size: 13px;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 24px;
  }
  
  .footer-brand-section {
    grid-column: span 1;
  }
  
  .footer-social,
  .contact-list li {
    justify-content: center;
  }
  
  .custom-format-modal {
    margin: 16px;
    max-height: calc(100vh - 32px);
  }
  
  .custom-format-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  
  .custom-format-label {
    min-width: auto;
  }
  
  .custom-format-input {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .tool-title-section {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .tool-title {
    font-size: 20px;
  }
  
  .tool-body {
    padding: 20px;
  }
  
  .form-textarea {
    height: 200px;
    min-height: 200px;
    max-height: 200px;
    overflow-x: hidden;
    overflow-y: auto;
  }
  
  .options-panel {
    padding: 16px;
  }
  
  .radio-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* Language Selector - Simple Version (No Search) */
.lang-native-hidden {
  display: none !important;
}

.lang-select-simple {
  position: relative;
  display: inline-block;
  z-index: 10001;
  min-width: 140px;
}

.lang-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 140px;
  height: 36px;
  padding: 0 12px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-select-trigger:hover {
  border-color: var(--primary-color);
}

.lang-select-trigger[aria-expanded="true"] {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.1);
}

.lang-select-trigger-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-select-trigger-arrow {
  margin-left: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.lang-select-trigger[aria-expanded="true"] .lang-select-trigger-arrow {
  transform: rotate(180deg);
}

.lang-select-panel {
  position: absolute;
  top: 100%;
  left: 0;
  width: 240px;
  max-height: min(320px, calc(100vh - 120px));
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 10002;
  overflow: hidden;
  margin-top: 4px;
}

.lang-select-panel.hidden {
  display: none;
}

.lang-select-list {
  max-height: 300px;
  overflow-y: auto !important;
  overflow-x: hidden;
  padding: 4px;
  scrollbar-width: auto;
  scrollbar-color: #94a3b8 #f1f5f9;
  overscroll-behavior: contain;
}

.lang-select-list::-webkit-scrollbar {
  width: 12px !important;
  display: block !important;
  -webkit-appearance: auto;
}

.lang-select-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
}

.lang-select-list::-webkit-scrollbar-thumb {
  background: #64748b;
  border-radius: 7px;
  border: 2px solid #f1f5f9;
  min-height: 40px;
}

.lang-select-list::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.lang-select-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  text-align: left;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.lang-select-item:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.lang-select-item.active {
  background: var(--primary-color);
  color: white;
}

.lang-select-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}
