/* =========================
   CALCULATOR + RESULTS LAYOUT
========================= */

.calculator-layout {
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 2rem;
  align-items: start;
}

/* =========================
   CALCULATOR CARD
========================= */

.calculator-box {
  padding: 1.5rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.06);
}

/* =========================
   FORM
========================= */

.calculator-form {
  display: grid;
  gap: 1.1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
}

.form-field input {
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  border-radius: 10px;
  border: 1px solid #d1d5db;
}

.form-field input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* =========================
   BUTTON
========================= */

.primary-btn {
  margin-top: 0.75rem;
  padding: 0.7rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: #2563eb;
  color: #ffffff;
}

.primary-btn:hover {
  background: #1e4ed8;
}

/* =========================
   RESULTS CARD
========================= */

.calculator-results {
  padding: 1.4rem 1.5rem;
  background: #f8fafc;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  height: fit-content;
}

.calculator-results h2 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.results-grid {
  display: grid;
  gap: 1rem;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-label {
  font-size: 0.85rem;
  color: #475569;
}

.result-item strong {
  font-size: 1rem;
  font-weight: 600;
  color: #020617;
}

/* =========================
   CHART
========================= */

.chart-wrapper {
  margin-top: 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.chart-legend {
  display: flex;
  gap: 1.2rem;
  font-size: 0.85rem;
  color: #374151;
}

.legend-box {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  display: inline-block;
}

.legend-box.principal {
  background: #2563eb;
}

.legend-box.interest {
  background: #ef4444;
}

/* =========================
   ARTICLE
========================= */

.content-article {
  width: 90%;
  max-width: 1100px;
  margin-top: 3.5rem;
  line-height: 1.8;
  color: #1f2937;
}

.content-article h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.content-article h3 {
  font-size: 1.1rem;
  margin-top: 1.8rem;
  margin-bottom: 0.4rem;
}

.content-article p {
  font-size: 0.96rem;
  color: #374151;
}

/* =========================
   OVERLAY (PDF SAFE)
========================= */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1000;
}

.schedule-panel {
  background: #ffffff;
  width: 85%;
  max-width: 1100px;
  margin: 4vh auto;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

/* Header (not in PDF capture) */
.panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Scroll container */
.panel-body {
  overflow-y: auto;
  max-height: 65vh;
  padding: 0;
}

/* PDF content wrapper */
#pdfContent {
  padding: 1.25rem;
}

/* Summary */
.schedule-summary {
  background: #f8fafc;
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}

/* Table */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.schedule-table th,
.schedule-table td {
  padding: 10px;
  font-size: 14px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

/* Sticky header (no gap bleed) */
.schedule-table thead th {
  /* position: sticky;
  top: 0; */
  position: static;
  background: #ffffff;
  z-index: 5;
  box-shadow: inset 0 -1px 0 #e5e7eb;
}

/* Footer buttons */
.panel-actions {
  padding: 1rem 1.25rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 1rem;
}

/* =========================
   MOBILE FIXES
========================= */

@media (max-width: 900px) {

  .calculator-layout {
    grid-template-columns: 1fr;
  }

  .calculator-results {
    width: 100%;
  }

  /* Stack results + chart */
  .calculator-results > div {
    display: flex !important;
    flex-direction: column;
    gap: 1.2rem;
  }

  .results-grid {
    gap: 0.75rem;
  }

  .result-item {
    align-items: flex-start;
  }

  .chart-wrapper canvas {
    width: 180px !important;
    height: 180px !important;
  }

  .chart-legend {
    justify-content: center;
    font-size: 0.8rem;
  }

  #openScheduleBtn {
    width: 100%;
  }

  .content-article {
    width: 100%;
  }
}

@media (max-width: 768px) {

  .schedule-panel {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .panel-header {
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 20;
  }

  .panel-body {
    max-height: calc(100vh - 120px);
    overflow-x: auto;
  }

  #pdfContent {
    padding: 1rem;
  }

  .schedule-summary {
    font-size: 0.9rem;
    display: grid;
    gap: 0.5rem;
  }

  .schedule-table {
    min-width: 720px;
    font-size: 13px;
  }

  .schedule-table th,
  .schedule-table td {
    padding: 8px 6px;
    white-space: nowrap;
  }

  .panel-actions {
    position: sticky;
    bottom: 0;
    background: #ffffff;
    z-index: 30;
  }
}

/* =========================
   SELECT / DROPDOWN (EMI-LIKE)
========================= */
.calculator-form select {
  width: 100%;
  height: 48px;
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  line-height: 1.4;
  border-radius: 10px;
  border: 1px solid #cbd5f5;
  background-color: #dfe4ea;
  color: #0f172a;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;

  /* Custom arrow */
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 19px,
    calc(100% - 12px) 19px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

/* Hover */
.calculator-form select:hover {
  border-color: #2563eb;
}

/* Focus (keyboard + click) */
.calculator-form select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Disabled (future-proof) */
.calculator-form select:disabled {
  background-color: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

/* =========================
   QubeTools – MODERN CALCULATOR SKELETON
========================= */

.calculator-results {
  position: relative;
  overflow: hidden;
  background: #f8fafc;
}

/* Hide real content */
.calculator-results.is-loading * {
  visibility: hidden;
}

/* Skeleton overlay */
.calculator-results.is-loading::after {
  content: "";
  position: absolute;
  inset: 1.4rem 1.5rem;
  border-radius: 14px;
  z-index: 20;
  pointer-events: none;

  background:
    /* shimmer sweep */
    linear-gradient(
      110deg,
      rgba(79,108,255,0) 40%,
      rgba(79,108,255,0.18) 50%,
      rgba(79,108,255,0) 60%
    ),

    /* result rows */
    linear-gradient(#e6ebff 0 0) 0 0 / 100% 18px,
    linear-gradient(#e6ebff 0 0) 0 36px / 100% 18px,
    linear-gradient(#e6ebff 0 0) 0 72px / 100% 18px,

    /* action button */
    linear-gradient(#dfe6ff 0 0) 0 112px / 100% 44px,

    /* chart ring */
    radial-gradient(circle, #dfe6ff 98%, transparent 100%)
      right 40px / 220px 220px;

  background-repeat: no-repeat;
  background-size:
    220% 100%,
    100% 18px,
    100% 18px,
    100% 18px,
    100% 44px,
    220px 220px;

  animation:
    QubeTools-calculator-shimmer 1.6s linear infinite,
    QubeTools-calculator-breathe 2.4s ease-in-out infinite;
}

/* Shimmer motion */
@keyframes QubeTools-calculator-shimmer {
  0% {
    background-position:
      -120% 0,
      0 0,
      0 36px,
      0 72px,
      0 112px,
      right 40px;
  }
  100% {
    background-position:
      120% 0,
      0 0,
      0 36px,
      0 72px,
      0 112px,
      right 40px;
  }
}

/* Soft pulse */
@keyframes QubeTools-calculator-breathe {
  0%   { opacity: 0.85; }
  50%  { opacity: 1; }
  100% { opacity: 0.85; }
}

/* Mobile refinement */
@media (max-width: 900px) {
  .calculator-results.is-loading::after {
    background:
      linear-gradient(
        110deg,
        rgba(79,108,255,0) 40%,
        rgba(79,108,255,0.18) 50%,
        rgba(79,108,255,0) 60%
      ),
      linear-gradient(#e6ebff 0 0) 0 0 / 100% 16px,
      linear-gradient(#e6ebff 0 0) 0 32px / 100% 16px,
      linear-gradient(#dfe6ff 0 0) 0 72px / 100% 42px,
      radial-gradient(circle, #dfe6ff 98%, transparent 100%)
        center 120px / 180px 180px;

    background-size:
      220% 100%,
      100% 16px,
      100% 16px,
      100% 42px,
      180px 180px;
  }
}
/* =========================
   OVERLAY
========================= */

.overlay {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.55);
z-index: 9999;
display: flex;
justify-content: flex-end;
}

.overlay.hidden {
display: none;
}

.schedule-panel {
width: 75%;
max-width: 1100px;
height: 100%;
background: #ffffff;
padding: 1.5rem 1.7rem;
overflow-y: auto;
box-shadow: -20px 0 50px rgba(0,0,0,0.25);
}

.panel-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}

.close-btn {
border: none;
background: #ef4444;
color: #fff;
font-size: 1.1rem;
padding: 0.35rem 0.7rem;
border-radius: 8px;
cursor: pointer;
}

/* =========================
   PRELOADER
========================= */
#page-preloader {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================
   FORM GRID (NO SCROLL)
========================= */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* =========================
   DROPDOWN
========================= */
.calculator-form select {
  width: 100%;
  height: 48px;
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  border-radius: 10px;
  border: 1px solid #cbd5f5;
  background-color: #ffffff;
  appearance: none;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 20px,
    calc(100% - 12px) 20px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

/* =========================
   OVERLAY
========================= */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  display: flex;
  justify-content: flex-end;
}

.overlay.hidden {
  display: none;
}

.schedule-panel {
  width: 75%;
  max-width: 1100px;
  height: 100%;
  background: #ffffff;
  padding: 1.5rem 1.7rem;
  overflow-y: auto;
  box-shadow: -20px 0 50px rgba(0,0,0,0.25);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.close-btn {
  border: none;
  background: #ef4444;
  color: #fff;
  font-size: 1.1rem;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
}

/* =========================
   TABLE (STATIC THEAD)
========================= */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.schedule-table th,
.schedule-table td {
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: right;
}

.schedule-table th:first-child,
.schedule-table td:first-child {
  text-align: center;
}

.schedule-table thead {
  background: #f8fafc;
  position: static;
}

.schedule-table tbody tr:hover {
  background: #f1f5f9;
}

/* =========================
   CHART
========================= */
.chart-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.5rem;
}

.chart-legend {
  display: flex;
  gap: 1.2rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.legend-box {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 0.35rem;
}

.legend-box.principal {
  background: #2563eb;
}

.legend-box.interest {
  background: #ef4444;
}

/* =========================
   OVERLAY BUTTONS
========================= */
.panel-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.2rem;
}

.panel-actions .primary-btn {
  width: fit-content;
  padding: 0.55rem 1.2rem;
}
/* =========================
   SCHEDULE PANEL IMPROVEMENT
========================= */

.schedule-panel {
  width: 75%;
  max-width: 1100px;
  height: 100%;
  background: #ffffff;
  padding: 0;
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(0,0,0,0.25);
}

/* HEADER */
.panel-header {
  padding: 1.2rem 1.6rem;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.panel-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

/* CLOSE BUTTON */
.close-btn {
  border: none;
  background: #ef4444;
  color: #ffffff;
  font-size: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.close-btn:hover {
  background: #dc2626;
}

/* CONTENT AREA */
#pdfContent {
  flex: 1;
  overflow-y: auto;
  padding: 1.4rem 1.6rem;
}

/* =========================
   TABLE DESIGN
========================= */

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

/* HEADER */
.schedule-table thead {
  background: #f8fafc;
}

.schedule-table thead th {
  text-align: right;
  padding: 0.75rem 0.6rem;
  font-weight: 600;
  border-bottom: 2px solid #e5e7eb;
}

.schedule-table thead th:first-child {
  text-align: center;
}

/* BODY */
.schedule-table tbody td {
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: right;
  color: #334155;
}

.schedule-table tbody td:first-child {
  text-align: center;
  font-weight: 500;
}

/* ROW HOVER */
.schedule-table tbody tr:hover {
  background: #f1f5f9;
}

/* STRIPES */
.schedule-table tbody tr:nth-child(even) {
  background: #fafafa;
}

/* =========================
   ACTION BAR
========================= */

.panel-actions {
  padding: 1.2rem 1.6rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 0.8rem;
  justify-content: flex-start;
  background: #ffffff;
  position: sticky;
  bottom: 0;
}

/* BUTTONS */
.panel-actions .primary-btn {
  padding: 0.55rem 1.3rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 900px) {

  .schedule-panel {
    width: 100%;
  }

  #pdfContent {
    padding: 1rem;
  }

  .schedule-table {
    font-size: 0.85rem;
  }

  .panel-actions {
    justify-content: space-between;
  }

}
/* =========================
   SCHEDULE TABLE ALIGNMENT
========================= */

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}

.schedule-table th,
.schedule-table td {
  text-align: center;
  padding: 10px 8px;
  border-bottom: 1px solid #e5e7eb;
}

.schedule-table thead {
  background: #f8fafc;
}

.schedule-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.schedule-table tbody tr:hover {
  background: #f1f5f9;
}

/* =========================
   PDF STRUCTURE
========================= */

#pdfContent {
  padding: 20px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.pdf-header {
  text-align: center;
  margin-bottom: 16px;
}

.pdf-header h2 {
  margin: 0;
  font-size: 20px;
}

.pdf-header p {
  font-size: 13px;
  color: #555;
  margin-top: 6px;
}

.pdf-footer {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: #666;
}
.input-error{
border-color:#ef4444;
box-shadow:0 0 0 2px rgba(239,68,68,.15);
}

/* ==================================================
   Production Calculator Surface
================================================== */

.page-content > .section:first-child {
  margin-top: 0 !important;
}

.page-content > .section:first-child .section-header {
  position: relative;
  overflow: hidden;
  max-width: none !important;
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid #dfe7f2;
  border-radius: 24px;
  background:
    radial-gradient(520px 220px at 100% 0%, rgba(15, 118, 110, 0.12), transparent 72%),
    radial-gradient(480px 220px at 0% 100%, rgba(37, 99, 235, 0.12), transparent 72%),
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,251,255,0.9));
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

.page-content > .section:first-child .section-header::before {
  content: "Calculator";
  display: inline-flex;
  width: fit-content;
  margin-bottom: 12px;
  padding: 6px 10px;
  border: 1px solid #cbe2df;
  border-radius: 999px;
  background: #eefbf8;
  color: #0f5f59;
  font-size: 0.74rem;
  line-height: 1;
  font-weight: 820;
  text-transform: uppercase;
}

.page-content > .section:first-child .section-header h1 {
  max-width: 780px;
  font-size: 2.5rem !important;
  line-height: 1.04 !important;
}

.page-content > .section:first-child .section-header p {
  max-width: 760px;
  color: #5d6b82 !important;
  font-size: clamp(0.98rem, 1.8vw, 1.12rem) !important;
}

.calculator-layout {
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr) !important;
  gap: 18px !important;
  align-items: stretch !important;
}

.calculator-box,
.calculator-results {
  min-width: 0;
  padding: clamp(18px, 2.6vw, 24px) !important;
  border: 1px solid #dfe7f2 !important;
  border-radius: 18px !important;
  background:
    radial-gradient(320px 150px at 100% 0%, rgba(37, 99, 235, 0.06), transparent 70%),
    #ffffff !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 18px 42px rgba(15, 23, 42, 0.06) !important;
}

.calculator-results {
  background:
    radial-gradient(320px 150px at 100% 0%, rgba(15, 118, 110, 0.07), transparent 70%),
    #fbfdff !important;
}

.form-field {
  gap: 8px !important;
}

.form-field label {
  color: #334155 !important;
  font-size: 0.84rem !important;
  font-weight: 720 !important;
}

.calculator-form input,
.calculator-form select {
  min-height: 44px;
  border: 1px solid #cfd8e6 !important;
  border-radius: 12px !important;
  background-color: #ffffff !important;
  color: #101828 !important;
  box-shadow: none !important;
}

.calculator-form input:focus,
.calculator-form select:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13) !important;
  outline: 0 !important;
}

.primary-btn,
.tool-main-btn {
  min-height: 44px;
  border: 0 !important;
  border-radius: 10px !important;
  background: linear-gradient(135deg, #111827, #2563eb 58%, #0f766e) !important;
  color: #ffffff !important;
  font-weight: 780 !important;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.24) !important;
}

.primary-btn:hover,
.tool-main-btn:hover {
  background: linear-gradient(135deg, #0f766e, #1d4ed8 62%, #0f172a) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 18px 38px rgba(15, 118, 110, 0.28) !important;
}

.calculator-results h2 {
  color: #101828 !important;
  font-size: 1.1rem !important;
  font-weight: 780 !important;
}

.result-item {
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #e8eef6;
}

.result-item:last-child {
  border-bottom: 0;
}

.result-label {
  color: #5d6b82 !important;
  font-weight: 650;
}

.result-item strong {
  color: #101828 !important;
  font-weight: 820 !important;
}

.chart-wrapper {
  padding-top: 18px;
  border-top: 1px dashed #dfe7f2;
}

.content-article {
  width: min(900px, 100%) !important;
  margin: clamp(36px, 6vw, 72px) auto 0 !important;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid #dfe7f2;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.content-article h2,
.content-article h3 {
  color: #101828 !important;
}

.content-article p,
.content-article li {
  color: #475467 !important;
}

.schedule-panel {
  border-left: 1px solid #dfe7f2;
  background: #ffffff;
}

.panel-header,
.panel-actions {
  border-color: #dfe7f2 !important;
}

.close-btn {
  background: #dc2626 !important;
}

@media (max-width: 900px) {
  .calculator-layout {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 640px) {
  .page-content > .section:first-child .section-header,
  .calculator-box,
  .calculator-results,
  .content-article {
    border-radius: 16px !important;
  }

  .panel-actions {
    display: grid !important;
  }

  .panel-actions > * {
    width: 100% !important;
  }
}
