/* ==========================================================================
   forex-history.net — module stylesheet (2026 rewrite)
   Loaded by the currency module. Also styles the page shell elements
   (menu / footer / body) — the site is standalone and no longer uses the
   legacy CMS stylesheet. All module components are namespaced .fx-*
   ========================================================================== */

/* ----- minimal reset (the legacy global reset from the CMS is gone) ------ */
body, h1, h2, h3, h4, p, ul, ol, li, pre, blockquote { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img { border: 0; max-width: 100%; height: auto; }
input, select, button, textarea { font: inherit; }

/* ----- page shell ------------------------------------------------------- */
body {
  width: auto;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px 48px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: #17212b;
  background: #fafbfc;
  -webkit-text-size-adjust: 100%;
}

a { color: #1a56db; text-decoration: none; }
a:visited { color: #1a56db; }
a:hover { text-decoration: underline; }

.menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  height: auto;
  min-height: 0;
  margin: 12px 0 18px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #ffffff;
  background-image: none;
  text-align: left;
  font-weight: 500;
}

.menu ul { display: flex; flex-wrap: wrap; gap: 4px; }
.menu li { float: none; padding: 0; }
.menu a { display: inline-block; padding: 7px 13px; border-radius: 9px; color: #374151; font-size: 14px; }
.menu a:hover { background: #eef2ff; color: #1a56db; text-decoration: none; }

.language_menu { float: none; display: inline-flex; gap: 6px; align-items: center; }
.language_menu img { height: 18px; width: auto; border: 1px solid #e5e7eb; border-radius: 4px; }
.language_menu a { padding: 2px; }
.language_menu a:hover { background: #eef2ff; }

.footer {
  height: auto;
  margin: 24px 0 0;
  padding: 14px 10px;
  border: 0;
  border-top: 1px solid #e5e7eb;
  background: none;
  background-image: none;
  text-align: center;
  font-size: 12px;
  color: #6b7280;
}

/* logo image (legacy gif) — keep it small */
body > div:first-child img { max-height: 52px; width: auto; }

/* ----- module base ------------------------------------------------------ */
.fx {
  box-sizing: border-box;
  color: #17212b;
  line-height: 1.55;
}
.fx *, .fx *::before, .fx *::after { box-sizing: border-box; }
.fx p { margin: 0 0 10px; }
.fx a { color: #1a56db; }

/* forms: neutralize legacy parent form styling */
.fx form div {
  border: 0 none;
  margin: 0;
  padding: 0;
  overflow: visible;
  line-height: inherit;
}
.fx input, .fx select, .fx button { font-family: inherit; }

.fx-form {
  text-align: left;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px 16px 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.fx .fx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px 14px;
  align-items: end;
}

.fx .fx-field { min-width: 0; }
.fx .fx-field label,
.fx .fx-label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #6b7280;
}
.fx .fx-field input[type="text"],
.fx .fx-field input[type="number"],
.fx .fx-field input[type="date"],
.fx .fx-field select {
  width: 100%;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  background: #ffffff;
  color: #111827;
  font-size: 16px; /* >=16px prevents iOS zoom on focus */
  text-align: left;
  appearance: auto;
}
.fx .fx-field input:focus, .fx .fx-field select:focus {
  outline: none;
  border-color: #1a56db;
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.fx .fx-field-radios { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.fx .fx-field-radios .fx-label { width: 100%; }
.fx .fx-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  text-transform: none;
}
.fx .fx-radio input { width: auto; margin: 0; accent-color: #1a56db; }

.fx .fx-submit { display: flex; gap: 10px; margin-top: 14px; }

.fx .fx-btn {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid #1a56db;
  border-radius: 9px;
  background: #1a56db;
  color: #ffffff !important;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none !important;
  cursor: pointer;
}
.fx .fx-btn:hover { background: #1746b2; border-color: #1746b2; }
.fx .fx-btn-ghost {
  background: #ffffff;
  color: #1a56db !important;
  border: 1px solid #c7d2fe;
}
.fx .fx-btn-ghost:hover { background: #eef2ff; }
.fx .fx-btn-small { padding: 7px 13px; font-size: 13px; font-weight: 500; }

.fx-avail { margin: 10px 2px 2px; text-align: center; font-size: 12px; color: #6b7280; }

.fx-msg { margin: 12px 0; padding: 11px 14px; border-radius: 10px; font-size: 14px; }
.fx-msg-warn { background: #fff7ed; border: 1px solid #fdba74; color: #7c2d12; }

/* ----- chart ------------------------------------------------------------ */
.fx-chart { margin-top: 16px; }
.fx .fx-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 8px;
}
.fx-ranges { display: flex; gap: 6px; flex-wrap: wrap; }
.fx-chip {
  padding: 6px 14px;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  background: #eef2ff;
  color: #1a56db;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.fx-chip:hover { background: #dbe4ff; }
.fx-chart-meta { display: flex; gap: 8px; }

.fx-chart-canvas {
  position: relative;
  height: 420px;
  padding: 10px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
}
.fx-chart-canvas canvas { width: 100%; height: 100%; }

.fx-caption { margin: 8px 0 0; text-align: center; font-size: 13.5px; color: #374151; }

/* ----- matrix ----------------------------------------------------------- */
.fx-note {
  margin: 12px 0;
  padding: 2px 0 2px 12px;
  border-left: 3px solid #e5e7eb;
  font-size: 12.5px;
  color: #6b7280;
}
.fx-note .fx-hint { font-style: italic; }
.fx-hint { display: none; }
@media (hover: none) { .fx-hint { display: inline; } }

.fx-matrix-intro { font-size: 14px; color: #374151; }

/* matrix page: only the rate table uses the full window width — the page
   shell (logo / menu / footer) and the text blocks keep the exact normal-page column */
body.fx-page-matrix { max-width: none; }
body.fx-page-matrix > div:first-child,
body.fx-page-matrix .fx-form,
body.fx-page-matrix .fx-avail,
body.fx-page-matrix .fx-note,
body.fx-page-matrix .fx-msg,
body.fx-page-matrix .fx-matrix-intro { max-width: 1120px; margin-left: auto; margin-right: auto; }
body.fx-page-matrix .menu,
body.fx-page-matrix .footer { box-sizing: border-box; max-width: 1120px; margin-left: auto; margin-right: auto; }

.fx-tablewrap {
  max-width: 100%;
  margin-top: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
}

.fx-matrix {
  border-collapse: separate;
  border-spacing: 0;
  margin: 0 auto;
  font-size: 12px;
}
.fx-matrix th, .fx-matrix td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(23, 33, 43, 0.07);
  border-right: 1px solid rgba(23, 33, 43, 0.07);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.fx-matrix th { font-weight: 700; text-align: right; }

/* sticky header row + first column */
.fx-matrix tr:first-child th { position: sticky; top: 0; z-index: 2; }
.fx-matrix th[scope="row"] { position: sticky; left: 0; z-index: 1; text-align: left; }
.fx-matrix .fx-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 3;
  background: #f8fafc;
}

.fx-cell { cursor: pointer; }
.fx-cell:hover { outline: 2px solid rgba(26, 86, 219, 0.55); outline-offset: -2px; }
.fx-cell:focus-visible { outline: 3px solid #1a56db; outline-offset: -3px; }

.fx-avg { font-weight: 700; }

/* ----- converter -------------------------------------------------------- */
.fx-result {
  margin: 14px 0 6px;
  padding: 13px 16px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
}
.fx-convtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.fx-convtable th {
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  position: sticky;
  top: 0;
}
.fx-convtable td { padding: 7px 10px; border-bottom: 1px solid #f1f3f5; }
.fx-convtable tr:nth-child(even) td { background: #fafbfc; }
.fx-convcur { width: 60px; }
.fx-convname { color: #6b7280; }
.fx-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ----- legend ----------------------------------------------------------- */
.fx-legend-intro { margin-bottom: 14px; font-size: 13.5px; color: #374151; line-height: 1.65; }
.fx-legend-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.fx-legend-table th {
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #6b7280;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
}
.fx-legend-table td { padding: 7px 10px; border-bottom: 1px solid #f1f3f5; }
.fx-legend-table tr:nth-child(even) td { background: #fafbfc; }
.fx-legend-range { color: #6b7280; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ----- tooltip + detail panel ------------------------------------------ */
.fx-tipfloat {
  position: fixed;
  z-index: 300;
  display: none;
  max-width: 270px;
  padding: 8px 11px;
  border-radius: 9px;
  background: #111827;
  color: #ffffff;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
  pointer-events: none;
}

.fx-detail {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 250;
  max-width: 520px;
  margin: 0 auto;
  padding: 14px 16px 12px;
  border-radius: 14px;
  background: #111827;
  color: #ffffff;
  font-size: 14px;
  line-height: 1.55;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}
.fx-detail[hidden] { display: none; }
.fx-detail-close {
  position: absolute;
  top: 4px;
  right: 8px;
  border: 0;
  background: none;
  color: #9ca3af;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}
.fx-detail-close:hover { color: #ffffff; }
.fx-detail .fx-detail-title { margin-bottom: 6px; font-weight: 700; }
.fx-detail .fx-detail-row { display: flex; justify-content: space-between; gap: 14px; }
.fx-detail .fx-detail-row span:first-child { color: #9ca3af; }

/* ----- small screens ---------------------------------------------------- */
@media (max-width: 720px) {
  body { padding: 0 10px 40px; }
  .menu { padding: 8px; }
  .menu a { padding: 7px 9px; font-size: 13.5px; }
  .fx-chart-canvas { height: 300px; padding: 6px; }
  .fx .fx-grid { grid-template-columns: 1fr; }
  .fx .fx-submit .fx-btn { flex: 1; text-align: center; }
  .fx-matrix th, .fx-matrix td { padding: 5px 7px; }
}

/* keep sticky columns readable on short screens */
@media (max-height: 500px) {
  .fx-chart-canvas { height: 240px; }
}
