/* ──────────────────────────────────────────────────────────────────────────
 * Growth Math web calculators — widget styling.
 * Scoped under #god-calc-root + .gm-* to avoid theme collisions.
 * ────────────────────────────────────────────────────────────────────────── */

#god-calc-root,
.god-calc-root {
  font-family: Montserrat, Arial, sans-serif;
  color: #2A2B4B;
  margin: 0 0 24px;
}

#god-calc-root .calc-loading,
.god-calc-root .calc-loading {
  padding: 40px;
  text-align: center;
  color: #999;
}

#god-calc-root .calc-err,
.god-calc-root .calc-err {
  padding: 24px;
  background: #FFF2D9;
  border-left: 3px solid #E0B233;
  border-radius: 4px;
}

/* Grid layout */
.gm-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 32px;
  background: linear-gradient(135deg, #F8F9FF 0%, #FFF5FB 100%);
  border-radius: 18px;
  padding: 28px;
  border: 1px solid #ECEEF8;
  box-shadow: 0 6px 24px rgba(65, 88, 208, 0.08);
}

/* Inputs column */
.gm-inputs {
  background: #fff;
  border-radius: 14px;
  padding: 24px 22px;
  border: 1px solid #ECEEF8;
}
.gm-form-title {
  font-size: 18px;
  font-weight: 800;
  color: #2A2B4B;
  margin-bottom: 4px;
  font-family: Montserrat, Arial, sans-serif;
}
.gm-form-sub {
  font-size: 13px;
  color: #666;
  margin-bottom: 18px;
  line-height: 1.5;
}

/* Field */
.gm-field {
  display: block;
  margin-bottom: 14px;
}
.gm-field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #3E3E3E;
  margin-bottom: 6px;
}
.gm-control {
  width: 100%;
  border: 1px solid #DCE3F2;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: Montserrat, Arial, sans-serif;
  color: #2A2B4B;
  background: #fff;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.gm-control:focus {
  outline: none;
  border-color: #517ADD;
  box-shadow: 0 0 0 3px rgba(81, 122, 221, .12);
}
.gm-control[type="number"] {
  -moz-appearance: textfield;
}
.gm-control[type="number"]::-webkit-inner-spin-button,
.gm-control[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
.gm-input-wrap {
  position: relative;
}
.gm-input-wrap .gm-control { padding-right: 56px; }
.gm-suffix {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #888;
  pointer-events: none;
}

select.gm-control {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23666' d='M6 8 0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Result column */
.gm-result {
  background: #fff;
  border-radius: 14px;
  padding: 28px 26px;
  border: 1px solid #ECEEF8;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.gm-primary {
  text-align: center;
  padding: 10px 0 6px;
  border-bottom: 1px solid #F0F0F5;
  padding-bottom: 18px;
}
.gm-primary-lbl {
  font-size: 13px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.gm-primary-val {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  line-height: 1;
  font-family: Montserrat, Arial, sans-serif;
  color: #4158D0;
}

.gm-secondary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gm-sec-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  padding: 6px 0;
  border-bottom: 1px dashed #F0F0F5;
  align-items: baseline;
}
.gm-sec-row:last-child { border-bottom: none; }
.gm-sec-lbl { color: #666; flex: 0 0 auto; }
.gm-sec-val { color: #2A2B4B; font-weight: 700; text-align: right; }
.gm-sec-full {
  flex-direction: column;
  gap: 4px;
  padding-top: 10px;
}
.gm-sec-full .gm-sec-val {
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.55;
}

.gm-chart-wrap {
  height: 220px;
  margin: 8px 0 4px;
  position: relative;
}
.gm-chart-wrap canvas { max-width: 100%; }

.gm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.gm-btn {
  border: 1px solid #DCE3F2;
  background: #fff;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #4158D0;
  cursor: pointer;
  font-family: Montserrat, Arial, sans-serif;
  transition: .15s;
}
.gm-btn:hover { border-color: #517ADD; background: #F5F7FF; }
.gm-btn-ghost {
  border-color: transparent;
  color: #888;
}
.gm-btn-ghost:hover { background: #F5F5F5; color: #4158D0; }

.gm-feedback {
  font-size: 12px;
  color: #22C25C;
  min-height: 16px;
  font-weight: 600;
}

/* Mobile */
@media (max-width: 820px) {
  .gm-grid {
    grid-template-columns: 1fr;
    padding: 18px;
    gap: 18px;
  }
  .gm-inputs, .gm-result {
    padding: 20px 18px;
  }
  .gm-primary-val {
    font-size: clamp(32px, 8vw, 44px);
  }
  .gm-chart-wrap { height: 180px; }
  .gm-actions .gm-btn { flex: 1 1 calc(50% - 4px); text-align: center; }
}

/* ── Trust strip: usage counter + rating + share + bookmark ────────── */
.gm-trust-strip {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.gm-trust-item {
  background: #fff;
  border: 1px solid #ECEEF8;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: Montserrat, Arial, sans-serif;
}

/* Usage */
.gm-trust-usage {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #F0F4FF 0%, #FFF 100%);
}
.gm-trust-icon { font-size: 22px; }
.gm-trust-num {
  font-size: 22px;
  font-weight: 800;
  color: #4158D0;
  line-height: 1;
}
.gm-trust-lbl {
  font-size: 12px;
  color: #666;
  line-height: 1.35;
  flex: 1;
}

/* Rating */
.gm-trust-rating {
  align-items: flex-start;
}
.gm-stars {
  display: flex;
  gap: 2px;
}
.gm-star {
  background: none;
  border: none;
  cursor: pointer;
  color: #DDD;
  font-size: 22px;
  padding: 0 2px;
  line-height: 1;
  transition: color .12s, transform .12s;
}
.gm-star:hover { transform: scale(1.15); }
.gm-star-filled { color: #FFC857; }
.gm-star-voted { color: #E89F00; }
.gm-rating-meta {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

/* Share */
.gm-trust-share { grid-column: 1 / -1; }  /* full width */
.gm-share-label {
  font-size: 13px;
  font-weight: 600;
  color: #2A2B4B;
  margin-bottom: 8px;
}
.gm-share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gm-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid #DCE3F2;
  border-radius: 8px;
  background: #fff;
  color: #4158D0;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: .12s;
  font-family: Montserrat, Arial, sans-serif;
}
.gm-share-btn:hover {
  border-color: #517ADD;
  background: #F5F7FF;
  text-decoration: none;
}
.gm-share-ico {
  font-size: 14px;
  font-weight: 700;
}
.gm-share-copy.gm-copied {
  background: #E1FAE3;
  border-color: #22C25C;
  color: #168F3D;
}
.gm-share-copy.gm-copied::after {
  content: ' ✓';
}

/* Bookmark hint */
.gm-trust-bookmark {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  background: #FFFBEB;
  border-color: #F5E5B5;
  font-size: 13px;
  color: #6D5610;
  position: relative;
  padding-right: 40px;
}
.gm-bookmark-ico { font-size: 18px; }
.gm-bookmark-txt { line-height: 1.4; }
.gm-kbd {
  display: inline-block;
  background: #FFF;
  border: 1px solid #E0CB80;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: 600;
  color: #6D5610;
  box-shadow: 0 1px 0 #E0CB80;
}
.gm-kbd-plus {
  font-weight: 700;
  margin: 0 4px;
}
.gm-bookmark-dismiss {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: #B8A055;
  line-height: 1;
  padding: 0 8px;
}
.gm-bookmark-dismiss:hover { color: #6D5610; }

@media (max-width: 600px) {
  .gm-trust-strip { grid-template-columns: 1fr; }
  .gm-share-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .gm-share-btn { justify-content: center; padding: 10px 8px; font-size: 12px; }
  .gm-share-copy { grid-column: 1 / -1; }
  .gm-trust-rating { align-items: center; text-align: center; }
  .gm-stars { justify-content: center; }
  .gm-rating-meta { text-align: center; }
  .gm-trust-usage { flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px; }
  .gm-trust-usage .gm-trust-icon { font-size: 20px; }
  .gm-trust-usage .gm-trust-num { font-size: 20px; }
  .gm-trust-usage .gm-trust-lbl { font-size: 11px; }
  .gm-trust-bookmark { font-size: 12px; padding-right: 36px; }
  .gm-kbd { padding: 1px 5px; font-size: 11px; }
  /* Calc widget grid + result on narrow */
  .gm-grid { padding: 14px; gap: 14px; }
  .gm-inputs, .gm-result { padding: 18px 14px; }
  .gm-primary-val { font-size: clamp(28px, 8vw, 38px); }
  .gm-actions { gap: 6px; }
  .gm-actions .gm-btn { font-size: 12px; padding: 8px 10px; }
  .gm-chart-wrap { height: 160px; }
}
@media (max-width: 380px) {
  .gm-share-row { grid-template-columns: 1fr 1fr; }
  .gm-actions .gm-btn { flex: 1 1 100%; }
}

/* Print — clean PDF when user hits "Save as PDF" */
@media print {
  body * { visibility: hidden; }
  #god-calc-root, #god-calc-root * { visibility: visible; }
  #god-calc-root {
    position: absolute; left: 0; top: 0; width: 100%;
  }
  .gm-actions, .gm-feedback, .gm-trust-strip { display: none !important; }
  .gm-grid {
    grid-template-columns: 1fr 1fr;
    background: #fff;
    box-shadow: none;
    border: 1px solid #ddd;
  }
  .gm-inputs, .gm-result {
    box-shadow: none;
    border: 1px solid #eee;
  }
}
