/* ================= MARGIN CALCULATOR PAGE ================= */

.calc-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ---- Hero ---- */
.calc-hero {
  padding: 64px 0 40px;
  text-align: center;
}

.calc-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 12px;
}

.calc-title {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 12px;
}

.calc-sub {
  font-size: 1rem;
  color: #555;
  max-width: 480px;
  margin: 0 auto 14px;
  line-height: 1.6;
}

.calc-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #888;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  border-radius: 99px;
  padding: 5px 14px;
  margin-top: 4px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgb(0, 200, 150);
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ---- Main inputs panel ---- */
.calc-panel {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.calc-all-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
}

/* Single unified box style */
.calc-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1;
  min-width: 110px;
  max-width: 160px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  background: #fafafa;
  padding: 10px 14px;
  text-align: center;
}

.calc-box-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: #999;
  white-space: nowrap;
}

.calc-box-val {
  font-size: 1rem;
  font-weight: 700;
  color: #111;
  letter-spacing: 0.3px;
}

/* Green derived boxes */
.calc-box-green {
  background: #e8faf3;
  border-color: #a8dfc4;
}


/* Capital input inside box */
.calc-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}


.calc-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #888;
}

.calc-input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
  background: #fff;
}

.calc-input-wrap:focus-within {
  border-color: rgb(0, 200, 150);
}

.calc-input-prefix {
  padding: 0 6px 0 10px;
  font-size: 0.9rem;
  color: #999;
  font-weight: 500;
  background: #f5f5f5;
  border-right: 1px solid #e0e0e0;
  height: 34px;
  display: flex;
  align-items: center;
}

.calc-input {
  border: none;
  outline: none;
  padding: 7px 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #111;
  width: 80px;
  font-family: inherit;
  background: #fff;
  text-align: center;
}

.calc-input::-webkit-outer-spin-button,
.calc-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.calc-input[type=number] { -moz-appearance: textfield; }

/* ---- Pill selectors ---- */
.pill-selector {
  display: flex;
  gap: 6px;
}

.pill-btn {
  padding: 10px 20px;
  border: 1.5px solid #e0e0e0;
  border-radius: 99px;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  height: 42px;
}

.pill-btn:hover {
  border-color: #bbb;
  color: #111;
}

.pill-btn.active {
  background: rgb(0, 200, 150);
  border-color: rgb(0, 200, 150);
  color: #000;
}



/* ---- Section label ---- */
.calc-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 10px;
  margin-top: 4px;
}

/* ---- Instrument row ---- */
.calc-inst-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.calc-inst-row .calc-inst-selector {
  margin-bottom: 0;
}

/* ---- Instrument pills ---- */
.calc-inst-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inst-pill {
  padding: 8px 18px;
  border: 1.5px solid #e0e0e0;
  border-radius: 99px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  color: #888;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  letter-spacing: 0.3px;
}

.inst-pill:hover {
  border-color: #bbb;
  color: #333;
}

.inst-pill.active {
  background: #111;
  border-color: #111;
  color: #fff;
}

/* ---- Status bar (slim) ---- */
.calc-status-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.prices-updated {
  font-size: 0.75rem;
  color: #aaa;
  white-space: nowrap;
}

.refresh-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 99px;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.refresh-btn:hover {
  border-color: rgb(0, 200, 150);
  color: rgb(0, 200, 150);
}

.refresh-btn svg {
  flex-shrink: 0;
  transition: transform 0.6s ease;
}

.refresh-btn.spinning svg {
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---- Table outer (scroll fade) ---- */
.calc-table-outer {
  position: relative;
}

.table-scroll-fade {
  position: absolute;
  top: 0;
  right: 0;
  width: 72px;
  height: calc(100% - 2px); /* avoids covering border */
  border-radius: 0 14px 14px 0;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.92) 70%);
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 2;
}

.table-scroll-fade.hidden {
  opacity: 0;
}

/* mobile scroll hint */
.table-scroll-hint {
  display: none; /* desktop: hidden */
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: #aaa;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-align: right;
  margin: 6px 4px 0 0;
  transition: opacity 0.25s;
}

.table-scroll-hint.hidden {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 700px) {
  .table-scroll-hint { display: flex; justify-content: flex-end; }
}

/* ---- Table ---- */
.calc-table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid #e5e5e5;
  background: #fff;
  /* hide native scrollbar on mobile for cleaner look */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.calc-table-wrap::-webkit-scrollbar {
  display: none;
}

.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.calc-table thead tr {
  background: #f7f7f7;
  border-bottom: 1px solid #e5e5e5;
}

.calc-table th {
  padding: 13px 18px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: #888;
  white-space: nowrap;
}

.calc-table th:not(:first-child) {
  text-align: right;
}

.calc-table td {
  padding: 14px 18px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.calc-table td:not(:first-child) {
  text-align: right;
}

.calc-table tbody tr:last-child td {
  border-bottom: none;
}

.calc-table tbody tr:hover {
  background: #fafafa;
}

/* Symbol cell */
.sym-cell {
  display: flex !important;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-align: left !important;
}

.sym-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgb(0, 200, 150);
  flex-shrink: 0;
}

/* Lot input */
.lot-input {
  width: 72px;
  padding: 7px 10px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: right;
  font-family: inherit;
  color: #111;
  outline: none;
  transition: border-color 0.15s;
}

.lot-input:focus {
  border-color: rgb(0, 200, 150);
}

.lot-input::-webkit-outer-spin-button,
.lot-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.lot-input[type=number] { -moz-appearance: textfield; }

/* Numeric cells */
.num-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #111;
}

.muted-cell {
  color: #aaa !important;
  font-weight: 400 !important;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.status-badge.ok {
  background: #e8faf3;
  color: rgb(0, 160, 110);
}

.status-badge.warn {
  background: #fff7e6;
  color: #b06000;
}

/* ---- Total row ---- */
.calc-total-row {
  background: #f7f7f7;
  border-top: 2px solid #e5e5e5 !important;
}

.calc-total-row td {
  border-bottom: none !important;
  padding-top: 16px !important;
  padding-bottom: 16px !important;
}

.calc-total-row .num-cell,
.calc-total-row strong {
  font-size: 0.95rem;
}

#total-limit {
  color: #888;
  font-weight: 400;
}

/* ---- Disclaimer ---- */
.calc-disclaimer {
  margin-top: 18px;
  font-size: 0.75rem;
  color: #aaa;
  text-align: center;
  line-height: 1.6;
}

/* ---- Fetch error state ---- */
.price-val.error {
  color: #e57373;
}

/* ---- Responsive ---- */
@media (max-width: 700px) {
  .calc-panel { padding: 20px 16px 16px; }
  .calc-inputs-row { gap: 18px; }
  .calc-input { width: 100px; }
  .calc-derived-row { padding: 14px 12px; gap: 0; }
  .derived-value { font-size: 1rem; }

  .calc-prices-bar { padding: 10px 14px; }
  .prices-title { display: none; }
  .rate-item { display: none; }

  .calc-table th,
  .calc-table td { padding: 12px 12px; }

  .lot-input { width: 60px; }
}
