body {
  font-family: "Poppins", Arial, sans-serif;
  background: #f8f9fa;
  color: #1a1a1a;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 750px;
  margin: 32px auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(44, 77, 143, 0.07);
  padding: 36px 32px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.form-section,
.preview-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

h1,
h2,
h3 {
  color: #2a4d8f;
  font-weight: 600;
  margin-bottom: 12px;
}

.form-label {
  font-weight: 500;
  color: #2a4d8f;
  margin-bottom: 4px;
  font-size: 1rem;
}

input,
select,
textarea {
  font-family: "Poppins", Arial, sans-serif;
  width: 100%;
  padding: 0.7em 1em;
  border: 1.5px solid #dbe2ef;
  border-radius: 8px;
  background: #f5f8ff;
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  margin-bottom: 10px;
  transition: border 0.2s;
  box-sizing: border-box;
}

/* Responsive Quill Editor */
.ql-container {
  font-size: clamp(0.95rem, 2.5vw, 1.15rem) !important;
}

@media (max-width: 900px) {
  .container {
    padding: 24px 10px 18px 10px;
    max-width: 98vw;
  }
  input, select, textarea, .ql-container {
    font-size: clamp(0.9rem, 3vw, 1.05rem) !important;
    padding: 0.6em 0.8em;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 10px 2vw 10px 2vw;
    max-width: 100vw;
    border-radius: 0;
  }
  input, select, textarea, .ql-container {
    font-size: clamp(0.85rem, 4vw, 1rem) !important;
    padding: 0.5em 0.5em;
  }
  h1, h2, h3 {
    font-size: clamp(1.1rem, 4vw, 1.4rem);
  }
}

input:focus,
select:focus,
textarea:focus {
  border: 1.5px solid #2a4d8f;
  outline: none;
}

.form-row {
  display: flex;
  gap: 18px;
}

.form-row > div {
  flex: 1;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2a4d8f;
  margin-top: 18px;
  margin-bottom: 8px;
}

.highlight {
  background: #fffbe7;
  color: #2a4d8f;
  padding: 2px 6px;
  border-radius: 5px;
  font-weight: 500;
}

.payout-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  margin-bottom: 10px;
}

.payout-table th,
.payout-table td {
  border: 1.5px solid #e2e6f3;
  padding: 8px 14px;
  text-align: left;
  font-size: 1rem;
}

.payout-table th {
  background: #f5f8ff;
  color: #2a4d8f;
  font-weight: 600;
}

.payout-table td {
  background: #fff;
}

.note {
  font-size: 0.97rem;
  color: #d18b00;
  margin-top: 8px;
  font-style: italic;
}

.terms-list {
  margin-left: 22px;
  margin-top: 8px;
  margin-bottom: 8px;
}

.terms-list li {
  margin-bottom: 8px;
  font-size: 0.98rem;
}

.signature-block {
  margin-top: 20px;
  margin-bottom: 10px;
}

.signature-label {
  color: #2a4d8f;
  font-weight: 500;
  margin-bottom: 6px;
}

.signature-pad {
  background: #f7faff;
  border: 1.5px solid #e2e6f3;
  border-radius: 8px;
  padding: 8px;
  width: 100%;
  max-width: 340px;
}

.button-primary {
  background: linear-gradient(90deg, #2a4d8f 70%, #3c7be6 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 28px;
  font-size: 1.08rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 10px;
}

.button-primary:disabled {
  background: #b5c2e0;
  cursor: not-allowed;
}

.logo-img {
  display: block;
  max-width: 240px;
  max-height: 160px;
  width: auto;
  height: auto;
  margin: 0 auto 8px auto;
  object-fit: contain;
}

.preview-section {
  border: 1.5px solid #e2e6f3;
  background: #f7faff;
  border-radius: 12px;
  padding: 24px 18px 16px 18px;
  box-shadow: 0 1px 5px rgba(44, 77, 143, 0.06);
}

.preview-section h2 {
  color: #2a4d8f;
  font-size: 1.18rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.preview-section .section-title {
  color: #3c7be6;
}

.footer {
  text-align: center;
  color: #444242;
  font-weight: 600;
  font-size: 0.98rem;
  margin-top: 24px;
  min-width: 100%;
}

.footer{
  display: flex;
  justify-content: space-evenly;
  align-items: center;
}

@media (max-width: 700px) {
  .container {
    padding: 16px 4px;
  }
}

@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .container {
    padding: 4px 2px;
  }

  .preview-section {
    padding: 12px 4px 10px 4px;
  }

  .footer{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .ql-bold{
    font-size: 10px !important;
  }
}

.hidden {
  display: none !important;
}

#submitBtn:hover {
  background: linear-gradient(90deg, #3c7be6 0%, #2a4d8f 100%);
  box-shadow: 0 7px 24px rgba(44, 77, 143, 0.17);
  transform: translateY(-2px) scale(1.03);
}

#submitBtn:active {
  background: #204073;
}

body {
  font-family: "Poppins", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #e8ecfc 0%, #f7f9fd 100%);
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 900px;
  margin: 48px auto 24px auto;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 22px;
  box-shadow: 0 6px 28px rgba(44, 77, 143, 0.13);
  padding: 36px 28px;
  display: flex;
  gap: 40px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-section {
  flex: 1;
}

.letter-section {
  flex: 2;
  background: #fff;
  border-radius: 18px;
  /* margin: 40px 200px; */
  padding: 32px 28px;
  min-width: 320px;
  width: 960px;
  margin: auto;
  box-sizing: border-box;
  box-shadow: 0 2px 12px rgba(44, 77, 143, 0.07);
  border: 1.5px solid #e2e6f3;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
}

input,
select {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 20px;
  border: 1.5px solid #e2e6f3;
  border-radius: 8px;
  font-size: 1.08rem;
  background: #f9fafd;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 3px rgba(44, 77, 143, 0.03);
  box-sizing: border-box;
}

input:focus,
select:focus {
  border-color: #3c7be6;
  outline: none;
  box-shadow: 0 0 0 2px #e8ecfc;
}

.letter {
  white-space: pre-line;
  font-size: 1.1rem;
  color: #222;
}

.letter-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: #2a4d8f;
  letter-spacing: 0.01em;
  text-align: center;
}

.agreement-block {
  margin: 20px 0;
  padding: 15px;
  background: #f9fafd;
  border: 1.5px solid #e2e6f3;
  border-radius: 8px;
}

.agreement-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agreement-row input[type="checkbox"] {
  width: auto;
  margin: 0;
  transform: scale(1.2);
}

.agreement-row label {
  margin: 0;
  font-weight: 500;
  color: #2a4d8f;
}

#signatureContainer {
  margin-top: 20px;
  padding: 20px;
  background: #f9fafd;
  border: 1.5px solid #e2e6f3;
  border-radius: 8px;
}

#signaturePad {
  border: 2px solid #2a4d8f;
  border-radius: 8px;
  background: #fff;
  cursor: crosshair;
  display: block;
  margin: 10px 0;
}

.signature-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.signature-buttons button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

#clearSignature {
  background: #e74c3c;
  color: white;
}

#clearSignature:hover {
  background: #c0392b;
}

#generatePreviewBtn {
  background: #3c7be6;
  color: white;
}

#generatePreviewBtn:hover {
  background: #2a4d8f;
}

#signatureError {
  color: #e74c3c;
  font-size: 0.9em;
  margin-top: 8px;
  display: none;
}

@media (max-width: 900px) {
  .container {
    flex-direction: column;
    gap: 24px;
    padding: 20px 4vw;
  }

  .form-section,
  .letter-section {
    min-width: 0;
    width: 100%;
  }

  .letter-section {
    padding: 20px;
  }
}

@media (max-width: 600px) {
  body {
    padding: 0;
    margin: 10px;
    background: #f8f9fa;
  }

  .container {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
  }

  .form-section,
  .letter-section {
    padding: 0 2vw;
    min-width: 0;
    width: 100%;
  }

  .letter-section {
    padding: 14px 2vw;
  }

  .letter-title {
    font-size: 1.05rem;
  }

  input,
  select,
  button {
    font-size: 1em;
    min-height: 44px;
    box-sizing: border-box;
  }

  #signaturePad {
    width: 100%;
    height: 120px;
  }

  .signature-buttons {
    flex-direction: column;
  }
}

@media (max-width: 500px) {
  .container {
    padding: 0;
    gap: 10px;
  }

  .form-section,
  .letter-section {
    padding: 0 1vw;
  }

  .letter-section {
    padding: 10px 1vw;
  }

  .agreement-block,
  #signatureContainer {
    padding: 8px 2vw 6px 2vw;
  }

  #signaturePad {
    height: 100px;
  }

  .letter-title {
    font-size: 0.98rem;
  }

  input,
  select,
  button {
    font-size: 0.98em;
    min-height: 38px;
  }
}
