/* 환율조회 (exchange.php) */
.fx-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 22px; }
.fx-head .section-title { margin-bottom: 0; }
.fx-meta { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.fx-time b { color: var(--text-2); font-weight: normal; font-variant-numeric: tabular-nums; }
.fx-refresh {
    height: 32px; padding: 0 14px; border: 1px solid var(--line-input); border-radius: 6px;
    background: var(--surface); color: var(--text-3); font-size: 13px; cursor: pointer;
}
.fx-refresh:hover:not(:disabled) { border-color: var(--primary); color: var(--link); }
.fx-refresh:disabled { opacity: .5; cursor: wait; }

.fx-card { margin-top: 15px; background: var(--surface); border-radius: 12px; padding: 22px 26px; box-shadow: 0 2px 8px var(--shadow-color); }

.fx-scroll { overflow-x: auto; }
.fx-table { width: 100%; min-width: 1040px; border-collapse: collapse; }
.fx-table thead tr:first-child th { border-top: 1px solid var(--line); }
.fx-table th.grp { border-left: 1px solid var(--line); border-right: 1px solid var(--line); padding-bottom: 10px; }
.fx-table th.sub { border-left: 1px solid var(--line-soft); padding-top: 10px; }
.fx-table th {
    padding: 14px 12px; font-size: 14px; font-weight: normal; color: var(--muted);
    border-bottom: 1px solid var(--line); text-align: center; line-height: 1.35; white-space: nowrap;
}
.fx-table td { padding: 13px 12px; font-size: 16px; border-bottom: 1px solid var(--line-soft); text-align: center; font-variant-numeric: tabular-nums; }
.fx-table tbody tr:hover td { background: var(--hover-bg); }
.fx-table .l { text-align: left; }
.fx-table .r { text-align: right; }
.fx-table td.l { white-space: nowrap; }

.fx-flag { width: 27px; height: 18px; vertical-align: -3px; margin-right: 14px; border: 1px solid var(--line); border-radius: 2px; }
.fx-country small { font-size: 15px; color: var(--muted); }
.fx-rate { font-weight: bold; }

/* 국내 표기 관례: 상승 빨강 ▲, 하락 파랑 ▼ */
.fx-chg.up   { color: #e02424; }
.fx-chg.down { color: #1f6fd1; }
.fx-chg.flat { color: var(--muted); }
:root[data-theme="dark"] .fx-chg.up   { color: #ff6b6b; }
:root[data-theme="dark"] .fx-chg.down { color: #5ea8ff; }

.fx-error  { margin: 0 0 14px; padding: 11px 14px; background: var(--err-bg); border: 1px solid var(--err-line); border-radius: 6px; color: var(--err-text); font-size: 14px; }
.fx-notice { margin: 0 0 14px; padding: 11px 14px; background: var(--hover-bg); border: 1px solid var(--line); border-radius: 6px; color: var(--text-3); font-size: 14px; }
.fx-notes { margin: 16px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.8; color: var(--muted); }

/* 공통 스타일(style.css)이 좁은 화면에서 표의 1·4번째 열을 숨기므로 환율표는 다시 표시 */
@media (max-width: 900px) {
    table.fx-table th:nth-child(n), table.fx-table td:nth-child(n) { display: table-cell; }
}

@media (max-width: 640px) {
    .fx-card { padding: 16px 12px; }
    .fx-table th, .fx-table td { padding: 11px 6px; font-size: 14px; }
    .fx-country small { display: block; font-size: 12px; }
    .fx-flag { margin-right: 8px; }
}

/* 첫 열(국가명)은 가로로 밀어도 보이게 고정 */
@media (max-width: 1100px) {
    .fx-table td.l, .fx-table th.l { position: sticky; left: 0; z-index: 1; background: var(--surface); }
    .fx-table th.l { background: var(--th-bg); }
    .fx-table tbody tr:hover td.l { background: var(--hover-bg); }
}

/* ===== 환율 계산기 ===== */
.fxc { margin-top: 24px; }
.fxc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.fxc-title { margin: 0; padding-left: 10px; border-left: 3px solid var(--primary); font-size: 20px; line-height: 1.2; }
.fxc-tools { display: flex; gap: 6px; }
.fxc-btn-dark {
    height: 34px; padding: 0 14px; border: 0; border-radius: 4px; background: #1d2f5c; color: #fff;
    font-size: 14px; font-weight: bold; cursor: pointer;
}
.fxc-btn-dark:hover { background: #142247; }
:root[data-theme="dark"] .fxc-btn-dark { background: var(--primary); }
:root[data-theme="dark"] .fxc-btn-dark:hover { background: var(--primary-dark); }
.fxc-share { padding: 0 10px; display: inline-flex; align-items: center; }
.fxc-share svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.fxc-copied { margin: 10px 0 0; font-size: 13px; color: var(--ok-text); text-align: right; }

.fxc-box + .fxc-box { margin-top: 26px; }
.fxc-panel { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); overflow: hidden; }
.fxc-box.is-base .fxc-panel { border-color: #6b7cff; }
:root[data-theme="dark"] .fxc-box.is-base .fxc-panel { border-color: var(--link); }
.fxc-sel { position: relative; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.fxc-box.is-base .fxc-sel { border-bottom-color: #6b7cff; }
:root[data-theme="dark"] .fxc-box.is-base .fxc-sel { border-bottom-color: var(--link); }
.fxc-flag { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; line-height: 0; }
.fxc-flag .fx-flag { width: 36px; height: 24px; margin: 0; vertical-align: middle; }
.fxc-sel select {
    flex: 1; min-width: 0; height: 52px; padding: 0 40px 0 62px; border: 0; background: transparent; color: var(--text);
    font-size: 17px; font-family: inherit; cursor: pointer; appearance: none; -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted-3) 50%), linear-gradient(135deg, var(--muted-3) 50%, transparent 50%);
    background-position: right 20px center, right 14px center; background-size: 6px 6px; background-repeat: no-repeat;
}
.fxc-sel select:focus { outline: 0; background-color: var(--hover-bg); }
.fxc-sel select option { background: var(--surface); color: var(--text); }
.fxc-remove { flex: 0 0 auto; width: 34px; height: 34px; margin-right: 8px; border: 1px solid var(--line-input); border-radius: 4px; background: var(--surface); color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.fxc-remove:hover { color: var(--danger-text); border-color: var(--danger-text); }
.fxc-amount { display: flex; align-items: center; gap: 10px; padding: 0 14px; cursor: text; }
.fxc-sym { flex: 0 0 auto; min-width: 16px; font-size: 18px; font-weight: bold; color: var(--text-2); }
.fxc-amount input {
    flex: 1; min-width: 0; height: 50px; border: 0; background: transparent; color: var(--text);
    font-size: 20px; text-align: right; font-family: inherit; font-variant-numeric: tabular-nums;
}
.fxc-amount input:focus { outline: 0; }

.fxc-read { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 10px 2px; min-height: 22px; }
.fxc-time { font-size: 13px; color: var(--muted); }
.fxc-words { font-size: 17px; color: var(--text); text-align: right; }

.fxc-quick { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.fxc-quick button {
    min-width: 84px; height: 38px; padding: 0 12px; border: 0; border-radius: 3px;
    background: var(--th-bg); color: var(--text-2); font-size: 15px; cursor: pointer;
}
.fxc-quick button:hover { background: var(--hover-bg-2); color: var(--link); }
.fxc-quick .fxc-clear { min-width: 48px; }

@media (max-width: 640px) {
    .fxc-title { font-size: 18px; }
    .fxc-sel select { font-size: 15px; }
    .fxc-quick { display: grid; grid-template-columns: repeat(4, 1fr); }
    .fxc-quick button { min-width: 0; font-size: 14px; }
}

/* 환율계산기 페이지 */
.fxc-page { margin-top: 15px; max-width: 900px; }
.fxc-page .fxc-head { justify-content: flex-end; border-bottom: 0; padding-bottom: 0; margin-bottom: 14px; }
.fxc-note { max-width: 900px; margin: 14px 4px 0; font-size: 13px; color: var(--muted); }
.fxc-note a { color: var(--link); }
