/* ================================================
   AllCalculate.com — assets/css/global.css
   Global styles shared by every calculator page
   ================================================ */

:root {
  --bg:      #f7f5f0;
  --surface: #ffffff;
  --ink:     #1a1814;
  --ink-2:   #6b6760;
  --ink-3:   #9a9890;
  --border:  #e8e5df;
  --border-2:#d0cec5;
  --radius:  14px;
  --radius-sm:10px;
  --shadow:  0 2px 12px rgba(26,24,20,.07);
  --shadow-lg:0 8px 40px rgba(26,24,20,.13);
}

*  { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* ── PAGE WRAPPER ── */
.ac-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 72px;
}
.ac-page-wide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 72px;
}

/* ── AD SLOTS ── */
.ac-ad-slot       { margin-bottom: 20px; }
.ac-ad-placeholder {
  background: var(--surface);
  border: 1.5px dashed var(--border-2);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  color: var(--ink-3);
  font-size: .72rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── CALCULATOR CARD ── */
.calc-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.calc-header {
  padding: 22px 24px 18px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.calc-header::before {
  content: attr(data-icon);
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 4.5rem;
  opacity: .12;
  line-height: 1;
}
.calc-header h1 {
  font-family: "DM Serif Display", serif;
  font-size: 1.5rem;
  margin-bottom: 4px;
  position: relative;
}
.calc-header p {
  color: rgba(255,255,255,.75);
  font-size: .875rem;
  position: relative;
}
.calc-body { padding: 22px 24px; }

/* ── FORM ELEMENTS ── */
.fg { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.fg label { font-size: .78rem; font-weight: 600; color: var(--ink-2); letter-spacing: .2px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.row4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 580px) { .row2,.row3,.row4 { grid-template-columns: 1fr; } }

.iu { position: relative; }
.iu input { padding-right: 52px; }
.ut {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: .78rem; color: var(--ink-3); font-weight: 500; pointer-events: none;
}

input[type=number], input[type=text], input[type=date], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--ink);
  outline: none;
  transition: border-color .2s, background .2s;
  -webkit-appearance: none;
  appearance: none;
  min-height: 46px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--page-accent, #d4521a);
  background: var(--surface);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 7L11 1' stroke='%236b6760' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* ── TABS ── */
.ac-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.ac-tabs::-webkit-scrollbar { display: none; }
.ac-tab {
  padding: 10px 18px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--ink-2);
  border: none;
  background: none;
  font-family: "DM Sans", sans-serif;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  position: relative;
  bottom: -2px;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}
.ac-tab.active {
  color: var(--page-accent, #d4521a);
  border-bottom-color: var(--page-accent, #d4521a);
  font-weight: 600;
}

/* ── PRESET BUTTONS ── */
.presets { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; align-items: center; }
.presets-label { font-size: .72rem; color: var(--ink-3); white-space: nowrap; }
.preset-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: .78rem;
  font-weight: 500;
  font-family: "DM Sans", sans-serif;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .15s;
  min-height: 36px;
  -webkit-tap-highlight-color: transparent;
}
.preset-btn:hover, .preset-btn:active {
  background: var(--page-accent-light, #fdf0e8);
  border-color: var(--page-accent, #d4521a);
  color: var(--page-accent, #d4521a);
}

/* ── CALC BUTTON ── */
.calc-btn {
  width: 100%;
  padding: 14px;
  background: var(--page-accent, #d4521a);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: "DM Sans", sans-serif;
  cursor: pointer;
  transition: filter .2s;
  margin-top: 6px;
  min-height: 50px;
  -webkit-tap-highlight-color: transparent;
}
.calc-btn:hover  { filter: brightness(.9); }
.calc-btn:active { filter: brightness(.8); }

/* ── RESULT CARDS ── */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.result-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  display: none;
  animation: acFadeUp .3s ease;
}
.result-card.show { display: block; }
.result-card.main {
  background: var(--page-accent, #d4521a);
  border-color: var(--page-accent, #d4521a);
}
@keyframes acFadeUp {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}
.rc-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 5px;
}
.result-card.main .rc-label { color: rgba(255,255,255,.7); }
.rc-value {
  font-family: "DM Serif Display", serif;
  font-size: 1.5rem;
  color: var(--page-accent, #d4521a);
  line-height: 1.1;
  word-break: break-all;
}
.result-card.main .rc-value { color: #fff; font-size: 1.9rem; }
.rc-sub { font-size: .76rem; color: var(--ink-2); margin-top: 3px; }
.result-card.main .rc-sub { color: rgba(255,255,255,.65); }

/* ── PROGRESS BAR ── */
.pbar-wrap { margin-bottom: 10px; }
.pbar-label { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 500; margin-bottom: 4px; }
.pbar-track { height: 10px; background: var(--border); border-radius: 100px; overflow: hidden; }
.pbar-fill  { height: 100%; border-radius: 100px; transition: width .7s ease; }

/* ── FORMULA BOX ── */
.formula-box {
  background: var(--page-accent-light, #fdf0e8);
  border-left: 3px solid var(--page-accent, #d4521a);
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  margin: 12px 0;
  font-family: monospace;
  font-size: .9rem;
  color: var(--page-accent, #d4521a);
  line-height: 1.7;
}

/* ── DATA TABLE ── */
.data-table-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-top: 18px;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}
.data-table-wrap.show { display: block; }
.data-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.data-table th {
  padding: 10px 14px;
  background: var(--bg);
  font-weight: 600;
  font-size: .75rem;
  color: var(--ink-2);
  text-align: left;
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }

/* ── INFO BOX ── */
.info-box {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.info-box h2 { font-family: "DM Serif Display", serif; font-size: 1.4rem; margin-bottom: 12px; }
.info-box h3 { font-family: "DM Serif Display", serif; font-size: 1.05rem; margin: 18px 0 8px; }
.info-box p  { color: var(--ink-2); font-size: .88rem; line-height: 1.8; margin-bottom: 10px; }

/* ── FAQ ── */
.faq-item { border-bottom: 1px solid var(--border); padding: 13px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-q {
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  -webkit-tap-highlight-color: transparent;
}
.faq-icon {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--page-accent-light, #fdf0e8);
  color: var(--page-accent, #d4521a);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
  transition: transform .2s;
}
.faq-q.open .faq-icon { transform: rotate(45deg); }
.faq-a {
  font-size: .85rem;
  color: var(--ink-2);
  margin-top: 10px;
  line-height: 1.7;
  display: none;
}
.faq-a.open { display: block; }

/* ── TOGGLE SWITCH ── */
.toggle-wrap {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px;
  margin-bottom: 18px;
  width: fit-content;
}
.toggle-btn {
  padding: 7px 18px;
  border: none;
  border-radius: 100px;
  font-family: "DM Sans", sans-serif;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  color: var(--ink-2);
  background: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 38px;
}
.toggle-btn.active {
  background: var(--page-accent, #d4521a);
  color: #fff;
}

/* ── FOOTER ── */
.ac-footer {
  background: #1a1814;
  color: #a0a098;
  padding: 44px 20px 28px;
  font-family: "DM Sans", sans-serif;
  margin-top: 40px;
}
.ac-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid #2a2820;
}
.ac-footer-logo {
  font-family: "DM Serif Display", serif;
  font-size: 1.35rem;
  color: #fff;
  margin-bottom: 10px;
}
.ac-footer-logo span { color: #d4521a; }
.ac-footer-desc { font-size: .82rem; line-height: 1.7; max-width: 220px; }
.ac-footer-col h4 {
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  margin-bottom: 14px;
  letter-spacing: .8px;
  text-transform: uppercase;
}
.ac-footer-col a {
  display: block;
  color: #a0a098;
  text-decoration: none;
  font-size: .82rem;
  margin-bottom: 9px;
  transition: color .15s;
}
.ac-footer-col a:hover { color: #d4521a; }
.ac-footer-bottom {
  max-width: 1200px;
  margin: 20px auto 0;
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  flex-wrap: wrap;
  gap: 8px;
}
@media (max-width: 960px) { .ac-footer-inner { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 600px) { .ac-footer-inner { grid-template-columns: 1fr 1fr; } }
@media (max-width: 400px) { .ac-footer-inner { grid-template-columns: 1fr; } }

/* ── RESPONSIVE HELPERS ── */
@media (max-width: 480px) {
  .calc-header h1  { font-size: 1.25rem; }
  .rc-value        { font-size: 1.3rem; }
  .result-card.main .rc-value { font-size: 1.6rem; }
  .calc-body       { padding: 18px 16px; }
  .info-box        { padding: 18px 16px; }
}

/* Global FAQ toggle function */
