/* =========================================
   GLOBAL
========================================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f3f7fc;
  color: #10213d;
  line-height: 1.5;
}

button,
input,
select {
  font-family: inherit;
}


/* =========================================
   HEADER
========================================= */

header {
  background: #063d91;
  color: white;
  padding: 16px 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

header b {
  font-size: 24px;
  white-space: nowrap;
}

header nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

header button {
  background: transparent;
  color: white;
  border: 0;
  padding: 11px 16px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}

header button:hover {
  background: rgba(255, 255, 255, 0.15);
}


/* =========================================
   BUTTONS
========================================= */

button {
  padding: 11px 16px;
  border: 0;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.primary {
  background: #075bd8;
  color: white;
}

.primary:hover {
  background: #064eb9;
}

.secondary-button {
  background: #eaf3ff;
  color: #075bd8;
  border: 1px solid #b8d2f7;
}

.secondary-button:hover {
  background: #dcecff;
}


/* =========================================
   PAGES
========================================= */

.page {
  display: none;
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 18px;
  min-height: 70vh;
}

.page.active {
  display: block;
}

.hidden {
  display: none !important;
}


/* =========================================
   CARDS
========================================= */

.card {
  background: white;
  padding: 28px;
  border-radius: 14px;
  box-shadow: 0 5px 25px rgba(16, 33, 61, 0.12);
}

.center {
  max-width: 700px;
  margin: 70px auto;
  text-align: center;
  line-height: 2;
}


/* =========================================
   APPLICATION LAYOUT
========================================= */

.columns {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 22px;
  align-items: start;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.full {
  grid-column: 1 / -1;
}


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

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-weight: bold;
  margin: 12px 0;
}

input,
select {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccd6e5;
  border-radius: 8px;
  background: white;
  color: #10213d;
  font-size: 15px;
  outline: none;
}

input:focus,
select:focus {
  border-color: #075bd8;
  box-shadow: 0 0 0 3px rgba(7, 91, 216, 0.1);
}

input[readonly] {
  background: #f5f8fc;
  color: #10213d;
  cursor: default;
}

input[type="file"] {
  padding: 10px;
}

.check {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  font-weight: normal;
}

.check input {
  width: auto;
  margin-top: 5px;
  flex-shrink: 0;
}


/* =========================================
   LOAN PREVIEW
========================================= */

.loan-preview-box {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid #c9ddfa;
  border-radius: 12px;
  background: #f5f9ff;
}

.loan-preview-box h2 {
  margin-top: 0;
  margin-bottom: 5px;
  color: #06459f;
}

.loan-preview-note {
  margin-top: 0;
  margin-bottom: 15px;
  color: #667085;
  font-size: 14px;
}

#loanStartDate,
#loanEndDate {
  font-weight: bold;
  color: #063d91;
}

#totalAmount {
  font-size: 22px;
  font-weight: bold;
  color: #d60000;
  border: 2px solid #075bd8;
  background: white;
}


/* =========================================
   NOTICES AND RESULTS
========================================= */

.notice,
.result {
  padding: 18px;
  background: #eef6ff;
  border-radius: 9px;
  margin: 18px 0;
  border: 1px solid #d4e6ff;
}

.result h3 {
  margin-top: 0;
  color: #063d91;
}

.error-message {
  color: #c62828;
  font-weight: bold;
}


/* =========================================
   SIGNATURE PAD
========================================= */

.signature-section {
  margin: 28px 0;
  padding: 26px;
  background: #f7faff;
  border: 1px solid #c9ddfa;
  border-radius: 14px;
}

.signature-section h2 {
  margin-top: 0;
  color: #06459f;
}

.signature-section p {
  color: #667085;
}

.signature-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 240px;
  background: white;
  border: 2px dashed #075bd8;
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
}

#signatureCanvas {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.signature-placeholder {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  color: #b6c4d9;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1px;
  pointer-events: none;
}

.signature-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}


/* =========================================
   TRACK APPLICATION
========================================= */

.track-card {
  max-width: 850px;
  margin: 40px auto;
}

.track-card h1 {
  font-size: 38px;
  margin-top: 0;
}

.row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.row input {
  flex: 1;
  min-width: 0;
}

#trackResult {
  margin-top: 20px;
}

#trackResult .result {
  background: #eef6ff;
  padding: 24px;
}


/* =========================================
   TABLES
========================================= */

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px;
  border: 1px solid #dce3ed;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f4f7fb;
  color: #10213d;
  font-size: 14px;
}

td {
  font-size: 14px;
}

.scroll {
  overflow-x: auto;
  margin-top: 20px;
}


/* =========================================
   ADMIN
========================================= */

.admin-card {
  max-width: 1200px;
  margin: 0 auto;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.admin-topbar h1 {
  margin-top: 0;
  margin-bottom: 5px;
}

.admin-topbar p {
  margin-top: 0;
  color: #667085;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin: 25px 0;
}

.stat-card {
  background: #f5f9ff;
  border: 1px solid #d5e5fa;
  border-radius: 12px;
  padding: 18px;
}

.stat-card span {
  display: block;
  color: #667085;
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 8px;
}

.stat-card strong {
  display: block;
  color: #063d91;
  font-size: 28px;
}


/* =========================================
   ADMIN TABS
========================================= */

.admin-tabs {
  display: flex;
  gap: 8px;
  margin: 25px 0 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #dce3ed;
}

.admin-tab {
  background: #eef2f7;
  color: #344054;
}

.admin-tab:hover {
  background: #dfe7f2;
}

.active-admin-tab {
  background: #075bd8;
  color: white;
}

.active-admin-tab:hover {
  background: #064eb9;
}

.admin-panel {
  margin-top: 20px;
}

.admin-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.admin-section-heading h2 {
  margin-bottom: 4px;
}

.admin-section-heading p {
  margin-top: 0;
  color: #667085;
}


/* =========================================
   ADMIN TABLE
========================================= */

.admin-table {
  min-width: 950px;
}

.admin-table select {
  min-width: 160px;
  padding: 8px;
}

.admin-table button {
  white-space: nowrap;
}


/* =========================================
   STATUS BADGES
========================================= */

.status-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
}

.status-pending {
  background: #fff4cc;
  color: #7a5900;
}

.status-active {
  background: #dcfce7;
  color: #166534;
}

.status-paid {
  background: #dbeafe;
  color: #1e40af;
}

.status-delayed {
  background: #fee2e2;
  color: #b91c1c;
}

.status-declined {
  background: #f2f4f7;
  color: #475467;
}


/* =========================================
   DOCUMENT LINKS
========================================= */

#docLinks {
  margin-top: 25px;
}

#docLinks a {
  display: inline-block;
  margin: 5px 0;
  color: #075bd8;
  font-weight: bold;
  text-decoration: none;
}

#docLinks a:hover {
  text-decoration: underline;
}


/* =========================================
   FOOTER
========================================= */

footer {
  text-align: center;
  padding: 35px 25px;
  color: #667085;
}


/* =========================================
   TABLET
========================================= */

@media (max-width: 1000px) {

  .dashboard-stats {
    grid-template-columns: repeat(3, 1fr);
  }

}


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

@media (max-width: 800px) {

  header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  header b {
    text-align: center;
  }

  header nav {
    justify-content: center;
  }

  header button {
    padding: 9px 11px;
  }

  .page {
    margin-top: 20px;
    padding: 0 10px;
  }

  .card {
    padding: 20px;
  }

  .columns,
  .grid {
    grid-template-columns: 1fr;
  }

  .full {
    grid-column: auto;
  }

  .row {
    flex-direction: column;
  }

  .row button {
    width: 100%;
  }

  .track-card h1 {
    font-size: 30px;
  }

  .signature-section {
    padding: 18px;
  }

  .signature-canvas-wrapper {
    height: 210px;
  }

  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-topbar,
  .admin-section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-tabs {
    flex-direction: column;
  }

  .admin-tab {
    width: 100%;
  }

}


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

@media (max-width: 480px) {

  header nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .signature-canvas-wrapper {
    height: 180px;
  }

  #totalAmount {
    font-size: 19px;
  }

}

/* =========================================
   BORROWER RECORD
========================================= */

.borrower-record {
  margin-top: 20px;
  color: #10213d;
}

.borrower-record-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #dce3ed;
}

.borrower-record-header h2 {
  margin: 0 0 8px;
  color: #063d91;
}

.borrower-record-header p {
  margin: 0;
  color: #667085;
}

.borrower-record-section {
  margin-top: 25px;
  padding: 22px;
  background: #f8fbff;
  border: 1px solid #dce8f7;
  border-radius: 12px;
}

.borrower-record-section h3 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #063d91;
  border-bottom: 1px solid #dce8f7;
  padding-bottom: 12px;
}

.borrower-record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.borrower-record-field {
  min-width: 0;
  padding: 14px;
  background: white;
  border: 1px solid #e1e8f0;
  border-radius: 9px;
}

.borrower-record-full {
  grid-column: 1 / -1;
}

.borrower-record-label {
  display: block;
  margin-bottom: 7px;
  color: #667085;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

.borrower-record-value {
  color: #10213d;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.borrower-record-value a {
  color: #075bd8;
  text-decoration: none;
}

.borrower-record-value a:hover {
  text-decoration: underline;
}


/* =========================================
   PDF RECORD
========================================= */

.pdf-record-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px;
  background: white;
  border: 1px solid #b9d4f8;
  border-radius: 10px;
}

.pdf-record-box > div:first-child {
  min-width: 0;
  flex: 1;
}

.record-small-text {
  color: #667085;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.record-action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.record-link-button,
.record-copy-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 10px 15px;
  border: 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
}

.record-link-button {
  background: #075bd8;
  color: white;
}

.record-link-button:hover {
  background: #064eb9;
  text-decoration: none;
}

.record-copy-button {
  background: #e8f1ff;
  color: #063d91;
}

.record-copy-button:hover {
  background: #d8e8ff;
}


/* =========================================
   BORROWER DOCUMENTS
========================================= */

.borrower-documents-list {
  display: grid;
  gap: 10px;
}

.borrower-document-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 13px 15px;
  background: white;
  border: 1px solid #e1e8f0;
  border-radius: 9px;
}

.borrower-document-item span {
  font-weight: bold;
}


/* =========================================
   MOBILE BORROWER RECORD
========================================= */

@media (max-width: 800px) {

  .borrower-record-header {
    flex-direction: column;
  }

  .borrower-record-grid {
    grid-template-columns: 1fr;
  }

  .borrower-record-full {
    grid-column: auto;
  }

  .pdf-record-box {
    flex-direction: column;
    align-items: stretch;
  }

  .record-action-buttons {
    width: 100%;
  }

  .record-link-button,
  .record-copy-button {
    flex: 1;
  }

  .borrower-document-item {
    flex-direction: column;
    align-items: stretch;
  }

  .borrower-document-item .record-link-button {
    width: 100%;
  }

}

/* =========================================
   SIGNATURE PAD
========================================= */

.signature-section {
  margin-top: 24px;
  margin-bottom: 24px;
}

.signature-section h2 {
  margin-bottom: 8px;
}

.signature-help {
  margin-bottom: 12px;
  color: #667085;
}

.signature-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #ffffff;
  border: 2px dashed #b7c5d8;
  border-radius: 10px;
}

#signatureCanvas {
  display: block;
  width: 100%;
  height: 180px;
  cursor: crosshair;

  /*
    IMPORTANT:
    This prevents the page from scrolling
    while signing with a finger.
  */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.signature-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  color: #a0aec0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
}

.signature-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.secondary-button {
  padding: 10px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #1e293b;
  font-weight: 600;
  cursor: pointer;
}

.secondary-button:hover {
  background: #eaf0f7;
}

.signature-error {
  min-height: 20px;
  margin-top: 8px;
  color: #dc2626;
  font-size: 14px;
  font-weight: 600;
}


/* =========================================
   SIGNATURE PAD MOBILE
========================================= */

@media (max-width: 600px) {

  .signature-canvas-wrapper,
  #signatureCanvas {
    height: 160px;
  }

  .signature-actions {
    justify-content: stretch;
  }

  .secondary-button {
    width: 100%;
  }

}

/* =========================================
   MODERN HOME PAGE
========================================= */

.home-card {
  max-width: 1100px;
  margin: 70px auto;
  padding: 60px 45px;
  border-radius: 24px;
}

.home-title {
  margin: 0;
  font-size: 52px;
  line-height: 1.2;
  color: #10213d;
}

.home-subtitle {
  margin: 15px 0 30px;
  color: #52627a;
  font-size: 22px;
}

.home-title-line {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 18px auto;
}

.home-title-line span {
  width: 55px;
  height: 3px;
  border-radius: 10px;
  background: #2495f2;
}

.home-title-line b {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #1688ed;
}


/* =========================================
   HOME BUTTONS
========================================= */

.home-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin: 35px auto 50px;
}

.home-action {
  min-height: 120px;
  padding: 20px 22px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 18px;

  background: white;
  color: #075bd8;

  border: 2px solid #075bd8;
  border-radius: 18px;

  text-decoration: none;
  text-align: left;

  font-size: 20px;
  font-weight: bold;
  line-height: 1.25;

  cursor: pointer;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.home-action:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 25px rgba(7, 91, 216, 0.18);
  background: #f7fbff;
}

.home-action-main {
  background: linear-gradient(
    135deg,
    #1688ed,
    #075bd8
  );

  color: white;
  border-color: #075bd8;
  box-shadow: 0 10px 25px rgba(7, 91, 216, 0.25);
}

.home-action-main:hover {
  background: linear-gradient(
    135deg,
    #0f7fe4,
    #064eb9
  );

  color: white;
}

.home-action-icon {
  width: 55px;
  height: 55px;
  flex-shrink: 0;

  display: flex;
  justify-content: center;
  align-items: center;

  border-right: 1px solid currentColor;

  font-size: 32px;
  font-weight: bold;
}

.home-action-arrow {
  margin-left: auto;
  font-size: 36px;
  font-weight: normal;
}


/* =========================================
   HOME TERMS
========================================= */

.home-terms {
  margin-top: 15px;
}

.home-terms h2 {
  margin-bottom: 0;
  font-size: 38px;
  color: #10213d;
}

.home-terms p {
  margin-top: 25px;
  font-size: 20px;
  line-height: 2.2;
}


/* =========================================
   HOME TABLET
========================================= */

@media (max-width: 900px) {

  .home-card {
    padding: 45px 25px;
  }

  .home-actions {
    grid-template-columns: 1fr;
    max-width: 550px;
  }

  .home-action {
    min-height: 95px;
  }

}


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

@media (max-width: 600px) {

  .home-card {
    margin: 25px auto;
    padding: 35px 18px;
  }

  .home-title {
    font-size: 38px;
  }

  .home-subtitle {
    font-size: 18px;
  }

  .home-actions {
    margin-top: 28px;
    gap: 14px;
  }

  .home-action {
    width: 100%;
    min-height: 85px;
    padding: 15px;
    font-size: 17px;
    border-radius: 14px;
  }

  .home-action-icon {
    width: 45px;
    height: 45px;
    font-size: 26px;
  }

  .home-action-arrow {
    font-size: 30px;
  }

  .home-terms h2 {
    font-size: 30px;
  }

  .home-terms p {
    font-size: 17px;
    line-height: 2;
  }

}

/* COMPACT HOME DESIGN */

.home-card {
  max-width: 850px;
  padding: 40px 35px;
}

.home-title {
  font-size: 42px;
}

.home-subtitle {
  font-size: 18px;
}

.home-actions {
  gap: 14px;
  margin: 28px auto 35px;
}

.home-action {
  min-height: 85px;
  padding: 14px 16px;
  font-size: 16px;
  border-radius: 14px;
  gap: 12px;
}

.home-action-icon {
  width: 40px;
  height: 40px;
  font-size: 23px;
}

.home-action-arrow {
  font-size: 27px;
}

.home-terms h2 {
  font-size: 30px;
}

.home-terms p {
  font-size: 16px;
  line-height: 1.9;
}

/* EXTRA COMPACT HOME */

.home-card {
  max-width: 700px;
  margin: 35px auto;
  padding: 28px 25px;
}

.home-title {
  font-size: 34px;
}

.home-subtitle {
  margin: 8px 0 18px;
  font-size: 15px;
}

.home-title-line {
  margin: 10px auto;
}

.home-actions {
  gap: 10px;
  margin: 20px auto 25px;
}

.home-action {
  min-height: 65px;
  padding: 10px 12px;
  gap: 9px;
  border-radius: 10px;
  font-size: 13px;
}

.home-action-icon {
  width: 32px;
  height: 32px;
  font-size: 18px;
}

.home-action-arrow {
  font-size: 22px;
}

.home-terms h2 {
  font-size: 24px;
}

.home-terms p {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.7;
}

/* SLIGHTLY BIGGER TOP NAVIGATION */

header button {
  padding: 13px 20px;
  font-size: 20px;
  border-radius: 9px;
}
