/* ============================================================
   TOOLS SHARED STYLES — Currency Exchange + World Clock
   Previously duplicated as inline <style> blocks in both pages;
   consolidated here. Rules that differ between the two pages are
   scoped under body.currency-page / body.clock-page.
   ============================================================ */

:root {
  --navy-deep: #081f5c;
  --navy: #081f5c;
  --navy-light: #134B8C;
  --orange: #081f5c;
  --orange-bright: #ffffff;
  --orange-dark: #2b2b2b;
  --paper: #ffffff;
  --paper-dim: #f8f6f0;
  --ink: #15181C;
  --ink-soft: #454C55;
  --stencil: #8E97A3;
  --line: rgba(10, 37, 64, 0.12);
  --white: #FFFFFF;
  --radius: 8px;
  --radius-sm: 6px;
  --nav-h: 64px;
  --transition: 0.25s ease;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.12);
  --cream: #f8f6f0;
  --text-dark: #1a2332;
  --text-muted: #6b7a8f;
  --border-light: #e8e8e8;
  --success: #2a9d5c;
  --warn: #e0902a;
  --off: #9aa5b1;
}

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

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cream);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.currency-page { font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif; }

/* ====== MINI HEADER ====== */
.mini-header {
  background: var(--navy-deep);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mini-header .nav {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
body.currency-page .mini-header .nav { max-width: 1200px; }
@media (min-width: 640px) { .mini-header .nav { padding: 0 24px; } }
.mini-header .nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.mini-header .nav-logo img { height: 50px; width: auto; }
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  border: 1px solid rgba(255,255,255,0.12);
}
.back-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.back-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ====== PAGE LAYOUT ====== */
.page-wrapper {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  width: 100%;
}
body.currency-page .page-wrapper { max-width: 1200px; }
@media (min-width: 640px) { .page-wrapper { padding: 32px 24px 60px; } }
.page-header { margin-bottom: 28px; }
@media (min-width: 640px) { .page-header { margin-bottom: 36px; } }
.page-header h1 {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 500;
  color: var(--navy-deep);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
body.currency-page .page-header h1 { font-weight: 500; }
.page-header .stats {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  background: #fff;
  padding: 6px 16px;
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.page-header p {
  color: var(--text-muted);
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  margin-top: 4px;
}

/* ====== API STATUS ====== */
.api-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 6px 14px;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.api-status .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.api-status .dot.live { background: var(--success); animation: pulse-dot 1.5s ease-in-out infinite; }
.api-status .dot.warn { background: var(--warn); animation: pulse-dot 1.5s ease-in-out infinite; }
.api-status .dot.mock { background: var(--orange); }
.api-status .dot.error { background: #e74c3c; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ====== CONVERTER GRID / CARD ====== */
.converter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 32px;
}
@media (min-width: 900px) {
  .converter-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}
.converter-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  animation: fadeInUp 0.5s ease forwards;
}
@media (min-width: 640px) { .converter-card { padding: 32px 28px; } }
.converter-card:nth-child(2) { animation-delay: 0.1s; }
.converter-card h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 20px;
  color: var(--navy-deep);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
body.currency-page .converter-card h2 { font-weight: 500; }
.converter-card h2 .badge {
  font-size: 0.6rem;
  font-weight: 500;
  background: var(--orange);
  color: #fff;
  padding: 2px 12px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}

/* ====== FORM ====== */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafafa;
  color: var(--text-dark);
  -webkit-appearance: none;
  appearance: none;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--orange);
  outline: none;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.10);
  background: #fff;
}
.form-group input { font-size: 1.2rem; font-weight: 500; }
.form-group select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%236b7a8f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* ====== SEARCHABLE COMBOBOX ====== */
.combo-wrap { position: relative; }
.combo-wrap input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafafa;
  color: var(--text-dark);
  cursor: pointer;
}
body.currency-page .combo-wrap input[type="text"] { padding-left: 42px; }
.combo-wrap input[type="text"]:focus {
  border-color: var(--orange);
  outline: none;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.10);
  background: #fff;
  cursor: text;
}
.combo-flag {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.15rem;
  pointer-events: none;
  line-height: 1;
}
.combo-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow-y: auto;
  z-index: 60;
  display: none;
}
.combo-dropdown.open { display: block; }
.combo-item {
  padding: 10px 14px;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
}
.combo-item:last-child { border-bottom: none; }
.combo-item .ci-flag { font-size: 1.1rem; flex-shrink: 0; }
.combo-item .ci-code { font-weight: 500; flex-shrink: 0; }
.combo-item .ci-name { color: var(--text-muted); font-size: 0.78rem; margin-left: auto; text-align: right; }
.combo-item .ci-city { font-weight: 500; }
.combo-item .ci-country { color: var(--text-muted); font-size: 0.78rem; margin-left: auto; }
.combo-item:hover, .combo-item.active { background: #fff8ec; }
.combo-empty { padding: 12px 14px; color: var(--text-muted); font-size: 0.85rem; }

/* ====== CURRENCY EXCHANGE — SWAP + CONVERT + RESULTS ====== */
.swap-container { display: flex; justify-content: center; margin: -4px 0 6px; }
.swap-btn {
  background: var(--orange);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.swap-btn:hover { transform: scale(1.1) rotate(180deg); background: var(--orange-dark); }
.swap-btn:active { transform: scale(0.95); }

.btn-convert {
  width: 100%;
  padding: 14px;
  background: var(--orange);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
  margin-top: 4px;
}
.btn-convert:hover { background: var(--orange-dark); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }
.btn-convert:active { transform: translateY(0); }
.btn-convert:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.results-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 16px; }
@media (max-width: 480px) { .results-grid { grid-template-columns: 1fr; } }
@media (min-width: 481px) and (max-width: 768px) { .results-grid { grid-template-columns: 1fr 1fr; } }
.result-item {
  background: #f8f9fa;
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
  border: 2px solid transparent;
  transition: border-color 0.3s, transform 0.2s, box-shadow 0.2s;
  cursor: default;
  position: relative;
  animation: fadeInUp 0.4s ease forwards;
}
.result-item:nth-child(2) { animation-delay: 0.05s; }
.result-item:nth-child(3) { animation-delay: 0.1s; }
.result-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.result-item.highlight { border-color: var(--orange); background: #fffaf0; }
.result-item .currency-flag { font-size: 1.4rem; display: block; margin-bottom: 2px; }
.result-item .currency-code { font-size: 0.65rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.result-item .amount { font-size: 1.4rem; font-weight: 500; color: var(--navy-deep); margin: 4px 0 2px; }
.result-item.highlight .amount { color: var(--orange); }
.result-item .rate-info { font-size: 0.65rem; color: var(--text-muted); }
.result-currency-select {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 60px;
  appearance: auto;
  -webkit-appearance: auto;
}
.result-currency-select:hover { border-color: var(--orange); color: var(--orange); }
.result-currency-select:focus { outline: none; border-color: var(--orange); }
.conversion-info {
  margin-top: 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 8px 16px;
  background: #f8f9fa;
  border-radius: 20px;
  font-weight: 500;
}

/* ====== WORLD CLOCK — SHOWCASE ====== */
.clock-showcase {
  text-align: center;
  background: #f8f9fa;
  border-radius: var(--radius-sm);
  padding: 22px 14px 18px;
  margin-top: 6px;
  border: 2px solid transparent;
  transition: border-color 0.3s;
}
.clock-showcase.highlight { border-color: var(--orange); background: #fffaf0; }
.clock-showcase .cs-city { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.clock-showcase .cs-time { font-size: clamp(2rem, 6vw, 2.6rem); font-weight: 500; color: var(--navy-deep); margin: 6px 0 2px; letter-spacing: -0.01em; }
.clock-showcase.highlight .cs-time { color: var(--orange); }
.clock-showcase .cs-date { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.clock-showcase .cs-offset {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--navy-deep);
  background: #eef2f7;
  padding: 4px 12px;
  border-radius: 20px;
}
.cs-status-tag {
  display: inline-block;
  margin-top: 10px;
  margin-left: 6px;
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 12px;
  border-radius: 20px;
  color: #fff;
}
.cs-status-tag.business { background: var(--success); }
.cs-status-tag.edge { background: var(--warn); }
.cs-status-tag.off { background: var(--off); }
.cs-src-tag {
  display: inline-block;
  margin-top: 10px;
  margin-left: 6px;
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 20px;
  color: var(--text-muted);
  background: #eef2f7;
}
.cs-src-tag.api { color: #1e6e42; background: #e5f5ec; }
.cs-src-tag.fallback { color: #a3660f; background: #fdf0dc; }
.diff-note {
  text-align: center;
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 8px 16px;
  background: #f8f9fa;
  border-radius: 20px;
  font-weight: 500;
}

/* ====== RATE / DATA TABLE ====== */
.rate-table-section { background: #fff; border-radius: var(--radius); padding: 24px 20px; box-shadow: var(--shadow); animation: fadeInUp 0.5s ease 0.1s both; }
@media (min-width: 640px) { .rate-table-section { padding: 32px 28px; } }
.rate-table-section h2 { font-family: 'Poppins', sans-serif; font-size: 1.1rem; font-weight: 500; color: var(--navy-deep); margin-bottom: 16px; }
body.currency-page .rate-table-section h2 { font-weight: 500; }
.rate-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.rate-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; min-width: 600px; }
body.currency-page .rate-table { min-width: 400px; }
.rate-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f8f9fa;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}
body.clock-page .rate-table th { position: sticky; top: 0; z-index: 10; }
.rate-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); white-space: nowrap; }
.rate-table tr:hover td { background: #fafafa; }
.rate-table tr.highlight td { background: #fffaf0; }
.rate-table .currency-name { font-weight: 500; }
.rate-table .rate-value { font-weight: 500; }
.rate-table .rate-value.loading { color: var(--text-muted); font-style: italic; font-weight: 400; }
.rate-update-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 12px; text-align: right; }

.status-chip {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 10px;
  border-radius: 20px;
  color: #fff;
}
.status-chip.business { background: var(--success); }
.status-chip.edge { background: var(--warn); }
.status-chip.off { background: var(--off); }
.status-chip.pending { background: var(--stencil); }
.src-chip {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 20px;
}
.src-chip.api { color: #1e6e42; background: #e5f5ec; }
.src-chip.fallback { color: #a3660f; background: #fdf0dc; }
.src-chip.pending { color: var(--text-muted); background: #eef2f7; }

/* ====== SEARCH / FILTER ====== */
.currency-search { position: relative; margin-bottom: 12px; }
.currency-search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafafa;
}
.currency-search input:focus { border-color: var(--orange); outline: none; box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.10); background: #fff; }
.currency-search .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.9rem; pointer-events: none; }
.filter-controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-controls select {
  padding: 8px 14px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  background: #fafafa;
  cursor: pointer;
}
.filter-controls select:focus { border-color: var(--orange); outline: none; }

/* ====== LOAD ALL / EMBED ====== */
.load-all-row { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.btn-load-all {
  background: #fff;
  border: 2px solid var(--orange);
  color: var(--orange);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 10px 22px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
body.currency-page .btn-load-all { font-weight: 500; }
.btn-load-all:hover { background: var(--orange); color: #fff; }
.btn-load-all:disabled { opacity: 0.6; cursor: not-allowed; }
body.currency-page .btn-load-all:disabled { opacity: 0.55; cursor: default; background: #fff; color: var(--orange); }
.load-all-progress { font-size: 0.75rem; color: var(--text-muted); }

.clock-embed-section { background: #fff; border-radius: var(--radius); padding: 24px 20px; box-shadow: var(--shadow); margin-bottom: 32px; animation: fadeInUp 0.5s ease both; }
@media (min-width: 640px) { .clock-embed-section { padding: 32px 28px; } }
.clock-embed-section h2 { font-family: 'Poppins', sans-serif; font-size: 1.1rem; font-weight: 500; color: var(--navy-deep); margin-bottom: 16px; text-align: center; }
.clock-embed-frame { position: relative; width: 100%; margin: 0 auto; padding-top: 54.1667%; border-radius: var(--radius-sm); overflow: hidden; }
.clock-embed-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.country-group-header { background: var(--navy-deep) !important; color: #fff !important; font-weight: 500; cursor: pointer; }
.country-group-header td { padding: 8px 12px !important; background: var(--navy-deep) !important; color: #fff !important; font-weight: 500; }
.country-group-header:hover td { background: var(--navy) !important; }

/* ====== FOOTER / WHATSAPP / MISC ====== */
.footer-mini { text-align: center; padding: 20px 16px; font-size: 0.75rem; color: var(--text-muted); border-top: 1px solid var(--border-light); margin-top: 20px; }
.footer-mini a { color: var(--orange); text-decoration: none; }

.whatsapp-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  width: 54px; height: 54px;
  background: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(37,211,102,0.45);
  transition: transform var(--transition), box-shadow var(--transition);
}
.whatsapp-fab:hover { transform: scale(1.1); box-shadow: 0 10px 32px rgba(37,211,102,0.55); }
.whatsapp-fab svg { width: 28px; height: 28px; color: #fff; }
@media (max-width: 480px) {
  .whatsapp-fab { width: 50px; height: 50px; bottom: 16px; right: 16px; }
  .whatsapp-fab svg { width: 26px; height: 26px; }
}

/* flag-icons library rendering fixes */
.fi { border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.06); }
.rate-flag { margin-right: 6px; vertical-align: -2px; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: var(--orange); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--orange-dark); }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .converter-card, .result-item, .rate-table-section, .clock-embed-section {
    animation: none;
  }
}


/* ====== BILLER BRO SHORTCUT (mini header) ====== */
.mini-actions { display: flex; align-items: center; gap: 10px; }
.mini-header .nav-billerbro { display: inline-flex; line-height: 0; border-radius: 9px; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.mini-header .nav-billerbro img { width: 34px; height: 34px; border-radius: 9px; display: block; box-shadow: 0 0 0 1px rgba(255,255,255,0.28); }
.mini-header .nav-billerbro:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(229, 145, 47, 0.4); }
