/* =============================================
   International Fonts Configuration (i18n)
   ============================================= 
   This file contains language-specific font
   configurations for consistent styling across
   English, Simplified Chinese, and Traditional Chinese
   ============================================= */

/* ===== ENGLISH (en) ===== */
html[lang="en"] {
  --font-family-primary: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  --font-weight-normal: 400;
  --font-weight-bold: 600;
  --line-height-normal: 1.5;
  --line-height-large: 1.6;
  --letter-spacing-normal: 0.3px;
}

html[lang="en"] body,
html[lang="en"] input,
html[lang="en"] select,
html[lang="en"] button,
html[lang="en"] textarea,
html[lang="en"] label,
html[lang="en"] table {
  font-family: var(--font-family-primary);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-normal);
}

html[lang="en"] h1,
html[lang="en"] h2,
html[lang="en"] h3,
html[lang="en"] h4,
html[lang="en"] h5,
html[lang="en"] h6,
html[lang="en"] label {
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-normal);
}

/* ===== SIMPLIFIED CHINESE (zh-CN) ===== */
html[lang="zh-CN"] {
  --font-family-primary: '微软雅黑', 'Microsoft YaHei', 'SimHei', '黑体', sans-serif;
  --font-weight-normal: 400;
  --font-weight-bold: 600;
  --line-height-normal: 1.6;
  --line-height-large: 1.8;
  --letter-spacing-normal: 0.5px;
  --font-size-adjustment: 1;
}

html[lang="zh-CN"] body,
html[lang="zh-CN"] input,
html[lang="zh-CN"] select,
html[lang="zh-CN"] button,
html[lang="zh-CN"] textarea,
html[lang="zh-CN"] label,
html[lang="zh-CN"] table,
html[lang="zh-CN"] p,
html[lang="zh-CN"] span,
html[lang="zh-CN"] div {
  font-family: var(--font-family-primary);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-normal);
}

html[lang="zh-CN"] h1,
html[lang="zh-CN"] h2,
html[lang="zh-CN"] h3,
html[lang="zh-CN"] h4,
html[lang="zh-CN"] h5,
html[lang="zh-CN"] h6,
html[lang="zh-CN"] label {
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.3px;
  line-height: var(--line-height-large);
}

html[lang="zh-CN"] button,
html[lang="zh-CN"] input[type="submit"],
html[lang="zh-CN"] input[type="button"],
html[lang="zh-CN"] input[type="reset"] {
  padding: 12px 10px;
  line-height: 1.4;
  word-break: keep-all;
}

html[lang="zh-CN"] th,
html[lang="zh-CN"] td {
  padding: 12px 10px;
  line-height: var(--line-height-large);
}

/* ===== TRADITIONAL CHINESE (zh-HK) ===== */
html[lang="zh-HK"] {
  --font-family-primary: '微软雅黑', 'Microsoft YaHei', '標楷體', sans-serif;
  --font-weight-normal: 400;
  --font-weight-bold: 600;
  --line-height-normal: 1.6;
  --line-height-large: 1.8;
  --letter-spacing-normal: 0.5px;
}

html[lang="zh-HK"] body,
html[lang="zh-HK"] input,
html[lang="zh-HK"] select,
html[lang="zh-HK"] button,
html[lang="zh-HK"] textarea,
html[lang="zh-HK"] label,
html[lang="zh-HK"] table,
html[lang="zh-HK"] p,
html[lang="zh-HK"] span,
html[lang="zh-HK"] div {
  font-family: var(--font-family-primary);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-normal);
}

html[lang="zh-HK"] h1,
html[lang="zh-HK"] h2,
html[lang="zh-HK"] h3,
html[lang="zh-HK"] h4,
html[lang="zh-HK"] h5,
html[lang="zh-HK"] h6,
html[lang="zh-HK"] label {
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.3px;
  line-height: var(--line-height-large);
}

html[lang="zh-HK"] button,
html[lang="zh-HK"] input[type="submit"],
html[lang="zh-HK"] input[type="button"],
html[lang="zh-HK"] input[type="reset"] {
  padding: 12px 10px;
  line-height: 1.4;
  word-break: keep-all;
}

html[lang="zh-HK"] th,
html[lang="zh-HK"] td {
  padding: 12px 10px;
  line-height: var(--line-height-large);
}

/* ===== COMMON ADJUSTMENTS FOR ALL LANGUAGES ===== */

/* Prevent text overflow in buttons */
button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  word-break: keep-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Form elements consistency */
input,
select,
textarea {
  font-family: inherit;
}

/* Modal content adjustments */
.modal-content {
  font-family: inherit;
  line-height: inherit;
}

/* Table consistency */
table {
  font-family: inherit;
}

/* Prevent CJK characters from breaking in unwanted places */
html[lang="zh-CN"] .form-group.buttons-row button,
html[lang="zh-HK"] .form-group.buttons-row button {
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
  padding: 12px 16px;
  min-width: 90px;
}

/* Link styles for consistency */
a {
  font-family: inherit;
}

html[lang="zh-CN"] a,
html[lang="zh-HK"] a {
  word-break: break-all;
}

/* Print styles */
@media print {
  html[lang="en"] {
    font-size: 12pt;
  }
  
  html[lang="zh-CN"],
  html[lang="zh-HK"] {
    font-size: 11pt;
    line-height: 1.5;
  }
}

/* Responsive font adjustments */
@media (max-width: 768px) {
  html[lang="en"] body {
    font-size: 14px;
    line-height: 1.5;
  }
  
  html[lang="zh-CN"] body,
  html[lang="zh-HK"] body {
    font-size: 14px;
    line-height: 1.6;
  }
  
  html[lang="en"] input,
  html[lang="en"] select,
  html[lang="en"] button {
    font-size: 14px;
  }
  
  html[lang="zh-CN"] input,
  html[lang="zh-CN"] select,
  html[lang="zh-CN"] button,
  html[lang="zh-HK"] input,
  html[lang="zh-HK"] select,
  html[lang="zh-HK"] button {
    font-size: 14px;
    padding: 10px 8px;
  }
}

@media (max-width: 600px) {
  html[lang="en"] body {
    font-size: 13px;
  }
  
  html[lang="zh-CN"] body,
  html[lang="zh-HK"] body {
    font-size: 13px;
    letter-spacing: 0.3px;
  }
}
