/* ============================================================
   SOUTHERN SUN FINANCE — Global Stylesheet
   Sections:
   1. CSS Variables (design tokens)
   2. Body & Background
   3. Header & Info Bar
   4. Flash Message
   5. Data Input Card  (focused input screens)
   6. Data Panel       (data-heavy / results screens)  ← NEW
   7. Shared Table Styles
   8. Buttons
   9. Form Helpers
   10. Bubbles Background
   11. Utilities
============================================================ */


/* ============================================================
   1. CSS VARIABLES — single place to change colours/sizes
============================================================ */
:root {
  --color-primary:       #23689B;   /* brand blue — header bar, accents */
  --color-primary-dark:  #1a4f75;   /* darker blue for hover states */
  --color-primary-light: #e8f4fd;   /* pale blue — row highlights, info bg */

  --color-text-main:     #1a2a3a;   /* near-black — all body text */
  --color-text-muted:    #5a6a7a;   /* muted — labels, secondary text */
  --color-text-heading:  #12344d;   /* dark navy — card/panel titles */

  --color-bg-card:       rgba(255, 255, 255, 0.93);  /* card background */
  --color-bg-panel:      rgba(255, 255, 255, 0.96);  /* panel background */
  --color-bg-table-head: #f0f6fb;   /* table header row */
  --color-bg-row-hover:  rgba(35, 104, 155, 0.06);   /* row hover */

  --color-border:        #d0dce8;   /* standard border */
  --color-border-light:  #e8eff5;   /* lighter border for table rows */

  --color-total-row:     #c0392b;   /* red — maximum loan totals row */

  --color-btn-blue:      #4a90e2;
  --color-btn-red:       #e74c3c;
  --color-btn-green:     #1aab44;   /* darkened from #0de944 — better contrast */

  --radius-card:         14px;
  --radius-input:        8px;
  --radius-btn:          8px;

  --font-main: "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-size-body:      0.875rem;  /* 14px — professional, compact */
  --font-size-label:     0.8rem;    /* 12.8px — field labels */
  --font-size-table:     0.8125rem; /* 13px — table cells */
  --font-size-heading:   1.25rem;   /* card/panel titles */
}


/* ============================================================
   2. BODY & BACKGROUND
============================================================ */
body {
  margin: 0;
  font-family: var(--font-main);
  font-size: var(--font-size-body);
  color: var(--color-text-main);
  line-height: 1.55;

  background: linear-gradient(-45deg, #e3f2fd, #b9e6fa, #89cff0, #3a8dde);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  background-attachment: fixed;

  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;

  /* removed overflow:hidden — it was clipping the panel on data screens */
  overflow-x: hidden;
  position: relative;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Soft lighting overlay */
body::before {
  content: "";
  position: fixed;
  top: 0; right: 0;
  width: 100%; height: 100%;
  background: radial-gradient(circle at top right, rgba(255,255,255,0.25), transparent 60%);
  pointer-events: none;
  z-index: 0;
}


/* ============================================================
   3. HEADER & INFO BARS
============================================================ */
.navbar {
  width: 100vw !important;
  margin-left: calc(-50vw + 50%);
  padding-left: 20px !important;
  padding-right: 20px !important;
  align-self: stretch;
  box-sizing: border-box;
}

.heading {
  position: sticky;
  top: 0;
  z-index: 1030;
  background-color: #ffffff;
  height: 70px;                      /* reduced from 95px — less wasted space */
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  width: 100%;
  box-sizing: border-box;
}

.heading img.sslogo {
  height: 46px;                      /* scaled with new header height */
  margin-right: 14px;
}

.heading .company-info {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-heading);
  letter-spacing: 0.01em;
}

.heading .header-icons a {
  color: inherit;
  margin-left: 15px;
  font-size: 22px;
  transition: color 0.25s ease;
  text-decoration: none;
}

.header-icons a .house-icon {
  color: #c0392b;
  transition: color 0.25s ease;
}
.header-icons a .house-icon:hover {
  color: #6c3483;
}

.header-icons a .logout-icon {
  color: #1aab44;
  transition: color 0.25s ease;
}
.header-icons a .logout-icon:hover {
  color: var(--color-primary);
}

/* Info bar — gold price strip and similar banners */
.heading-info-bar,
.info-bar {
  position: sticky;
  top: 70px;                       /* sits flush below the sticky header */
  text-align: center;
  background-color: var(--color-primary);
  width: 100%;
  min-height: 36px;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 36px;
  letter-spacing: 0.12em;
  z-index: 1028;
}


/* ============================================================
   4. FLASH MESSAGE
============================================================ */
#alertMessage {
  position: fixed;
  margin-top: 70px;                /* below sticky header(70) — above info-bar */
  width: 100%;
  text-align: center;
  padding: 8px 0;
  z-index: 2000;
}


/* ============================================================
   5. DATA INPUT CARD
   Use for: login, branch select, single-item entry,
            confirmation screens, PIN/password entry.
============================================================ */
.data-input-container {
  min-width: 22vw;
  width: fit-content;
  max-width: 68vw;
  background-color: var(--color-bg-card);
  margin: 5vh auto 1.5vh auto;
  height: auto;
  text-align: center;
  border-radius: var(--radius-card);
  padding: 36px 32px;
  box-shadow: 0 2px 18px rgba(0, 0, 0, 0.09);

  /* toned-down hover — no jumping while user types */
  transition: box-shadow 0.25s ease;
}

.data-input-container:hover {
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.13);
  transform: translateY(0px) scale(1.02);
  /* removed translateY + scale — disruptive on form containers */
}

/* Logo inside card */
.data-input-container img {
  width: 38px;
  margin-bottom: 14px;
}

/* Card title */
.data-input-container .top-box-text {
  font-size: var(--font-size-heading);
  font-weight: 600;
  color: var(--color-text-heading);
  margin-bottom: 22px;
  letter-spacing: 0.01em;
}

/* Text inputs inside card */
.data-input-container input[type="text"],
.data-input-container input[type="number"],
.data-input-container input[type="date"],
.data-input-container input[type="tel"],
.data-input-container input[type="password"],
.data-input-container select {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-input);
  border: 1px solid var(--color-border);
  font-size: var(--font-size-body);
  font-family: var(--font-main);
  color: var(--color-text-main);
  background-color: #ffffff;
  margin-bottom: 16px;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.data-input-container input:focus,
.data-input-container select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(35, 104, 155, 0.15);
}

/* Buttons inside card */
.data-input-container button {
  min-width: 110px;
  width: auto;
  padding: 10px 20px;
  border-radius: var(--radius-btn);
  border: none;
  font-family: var(--font-main);
  font-size: var(--font-size-body);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background-color 0.22s ease, transform 0.22s ease;
}

/* Buttons inside card (button elements and .button class e.g. on <a> tags) */

.data-panel .button {
  min-width: 100px;
  width: auto;
  padding: 1px 10px;
  border-radius: var(--radius-btn);
  border: none;
  font-family: var(--font-main);
  font-size: var(--font-size-body);
  font-weight: 400;
  cursor: pointer;
  margin-bottom: 3px;
  transition: background-color 0.22s ease, transform 0.22s ease;
  display: inline-block;
  text-decoration: none;
}

/* Table inside card */
.data-input-container .table-responsive {
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

.data-input-container table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.data-input-container table thead tr:first-child th:first-child { border-top-left-radius: var(--radius-card); }
.data-input-container table thead tr:first-child th:last-child  { border-top-right-radius: var(--radius-card); }
.data-input-container table tbody tr:last-child td:first-child  { border-bottom-left-radius: var(--radius-card); }
.data-input-container table tbody tr:last-child td:last-child   { border-bottom-right-radius: var(--radius-card); }

.data-input-container table.table-striped tbody tr:hover {
  background-color: var(--color-bg-row-hover);
  transition: background-color 0.2s ease;
}

.data-input-container table th,
.data-input-container table td {
  font-size: var(--font-size-table);
  text-align: center;
  vertical-align: middle;
}


/* ============================================================
   6. DATA PANEL   ← NEW
   Use for: results tables, loan type selection, customer search
            results, transaction history, any screen with 4+
            columns of data.
============================================================ */
.data-panel {
  width: 97vw;
  max-width: 1600px;
  margin: 0 auto 2vh auto;
  background-color:  #9CD5FF;
  border-radius: var(--radius-card);
  padding: 18px 24px 22px 24px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  text-align: center;                  /* panels are left-aligned by default */
}

/* Logo inside card */
.data-panel img {
  width: 38px;
  margin-bottom: 7px;
}

/* Panel title bar */
.data-panel .panel-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-heading);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--color-primary-light);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

/* Table inside panel */
.data-panel .table-responsive {
  overflow-x: auto;                  /* graceful horizontal scroll on narrow screens */
  border-radius: 8px;
  overflow-y: visible;
}

.data-panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-table);
  table-layout: auto;
}

/* .data-panel table thead th {
  background-color: var(--color-bg-table-head);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 9px 12px;
  border-bottom: 2px solid var(--color-border);
  text-align: center;
  white-space: nowrap;
} */

/* .data-panel table thead th:first-child,
.data-panel table thead th:nth-child(2) {
  text-align: left;
} */

.data-panel table tbody td {
  padding: 8px 12px;
  color: var(--color-text-main);
  border-bottom: 1px solid var(--color-border-light);
  text-align: right;
  vertical-align: middle;
  font-size: 0.75rem;   /* ← add this line — 12px */
}

.data-panel table tbody td:first-child,
.data-panel table tbody td:nth-child(2) {
  text-align: left;
}

.data-panel table tbody tr:nth-child(odd) {
  background-color: rgba(0, 0, 0, 0.04);
}

.data-panel table tbody tr:hover {
  background-color: var(--color-bg-row-hover);
  transition: background-color 0.18s ease;
}

/* Maximum / totals row */
.data-panel table tbody tr.total-row td {
  color: var(--color-total-row);
  font-weight: 700;
  background-color: #fff5f5;
  border-top: 1px solid #f5c6c6;
  border-bottom: none;
}

/* LoanAddSelect: center-align Normal / Additional / Extra Maximum columns (5,6,7) */
#tblCategories th:nth-child(5),
#tblCategories th:nth-child(6),
#tblCategories th:nth-child(7),
#tblCategories td:nth-child(5),
#tblCategories td:nth-child(6),
#tblCategories td:nth-child(7) {
  text-align: center;
}

/* Panel action button row */
.data-panel .panel-actions {
  text-align: center;
  margin-top: 18px;
}


/* ============================================================
   7. SHARED TABLE STYLES
   These apply when a table is used outside of a card or panel.
============================================================ */
table.ss-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-table);
}

table.ss-table th {
  background-color: var(--color-bg-table-head);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 9px 12px;
  border-bottom: 2px solid var(--color-border);
}

table.ss-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text-main);
  vertical-align: middle;
}

table.ss-table tbody tr:hover {
  background-color: var(--color-bg-row-hover);
}


/* ============================================================
   8. BUTTONS
   Usage: add .buttonBlue / .buttonRed / .buttonGreen
   alongside Bootstrap's .btn class, or standalone.
============================================================ */

/* Shared base for all coloured buttons */
.buttonBlue,
.buttonRed,
.buttonGreen {
  font-family: var(--font-main);
  font-size: var(--font-size-body);
  font-weight: 600;
  border-radius: var(--radius-btn);
  padding: 10px 22px;
  cursor: pointer;
  transition: background-color 0.22s ease, color 0.22s ease,
              border-color 0.22s ease, transform 0.22s ease,
              box-shadow 0.22s ease;
  border: 1px solid transparent;
  width:auto;
}

/* Blue */
.buttonBlue { background-color: var(--color-btn-blue); color: #fff; }

.buttonBlue:hover,
.buttonBlue:focus {
  background-color: #fff;
  color: var(--color-btn-blue);
  border-color: var(--color-btn-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(74, 144, 226, 0.28);
  outline: none;
}
.buttonBlue:focus-visible { box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.35); }
.buttonBlue:active        { transform: translateY(0); box-shadow: none; }

/* Red */
.buttonRed { background-color: var(--color-btn-red); color: #fff; }

.buttonRed:hover,
.buttonRed:focus {
  background-color: #fff;
  color: var(--color-btn-red);
  border-color: var(--color-btn-red);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(231, 76, 60, 0.28);
  outline: none;
}
.buttonRed:focus-visible { box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.35); }
.buttonRed:active        { transform: translateY(0); box-shadow: none; }

/* Green — darkened for WCAG contrast on white text */
.buttonGreen { background-color: var(--color-btn-green); color: #fff; }

.buttonGreen:hover,
.buttonGreen:focus {
  background-color: #fff;
  color: var(--color-btn-green);
  border-color: var(--color-btn-green);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(26, 171, 68, 0.3);
  outline: none;
}
.buttonGreen:focus-visible { box-shadow: 0 0 0 4px rgba(26, 171, 68, 0.35); }
.buttonGreen:active        { transform: translateY(0); box-shadow: none; }

/* Remove browser default focus ring on all buttons */
button:focus { outline: none; box-shadow: none; }

/* Spinning loader — colourful conic-gradient ring */
.loader {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: conic-gradient(#e74c3c, #e67e22, #f1c40f, #2ecc71, #3498db, #9b59b6, #e74c3c);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #fff 0);
          mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #fff 0);
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Centered full-screen loader */
#loader {
  display: block;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  z-index: 9999;
  margin: 0;
}


/* ============================================================
   9. FORM HELPERS
============================================================ */

/* Info notice box inside a card */
.inputContainerInfo {
  background-color: var(--color-primary-light);
  border: 1px solid #c5ddf0;
  color: var(--color-primary);
  border-radius: var(--radius-input);
  font-size: 0.82rem;
  padding: 9px 12px;
  margin-bottom: 20px;
  text-align: center;
  line-height: 1.5;
}

.inputContainerInfoMore {
  color: var(--color-primary);
  font-size: 0.82rem;
  margin-top: -12px;
  margin-bottom: 8px;
  text-align: left;
}

.dataPanelContainerInfo {
  background-color: #91d4fd;
  border: 1px solid #5ab5f0;
  color: var(--color-primary);
  border-radius: 5px;
  font-size: 1rem;
  font-weight: bold;
  padding: 10px;
  margin: 0 auto 20px auto;
  max-width: 25vw;
  text-align: center;
  line-height: 1.5;
}


/* Field-level error message */
.error-message {
  color: var(--color-btn-red);
  font-size: 0.78rem;
  margin-top: 3px;
  min-height: 15px;
  text-align: left;
}

/* Red border on invalid inputs */
.input-error {
  border: 1px solid var(--color-btn-red) !important;
  background-color: #fff6f5 !important;
}

/* Password show/hide wrapper */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  display: inline-block !important;
  width: 100%;
  padding-right: 42px;
}

.toggle-password {
  position: absolute;
  right: 11px;
  color: #8a9ab0;
  cursor: pointer;
  transition: color 0.18s;
}

.toggle-password:hover { color: var(--color-primary); }

/* Sort button group (used above select dropdowns) */
.sort-group-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}


/* ============================================================
   10. BUBBLES BACKGROUND
============================================================ */
.bubbles-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  z-index: 1050;
  pointer-events: none;
}

.bubble {
  position: absolute;
  bottom: -80px;
  border-radius: 50%;
  opacity: 0.75;
  pointer-events: none;
  filter: blur(0.5px);
  z-index: 1060;
  box-shadow: inset -4px -4px 8px rgba(255,255,255,0.55);
  animation: rise infinite linear;
  transform: translateY(var(--yOffset, 0));
}

@keyframes rise {
  0%   { transform: translateY(var(--yOffset, 0)) translateY(0);      opacity: 0.75; }
  100% { transform: translateY(var(--yOffset, 0)) translateY(-110vh); opacity: 0.08; }
}

.bubble.glow {
  box-shadow:
    inset -4px -4px 8px rgba(255,255,255,0.55),
    0 0 18px 6px rgba(255,255,255,0.35);
}

/* --- Fish (day-themed background) --- */
.fish-swimmer {
  position: absolute;
  left: -160px;
  animation-name: swimAcross;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  pointer-events: none;
  z-index: 1055;
  will-change: left;
  transform: scaleX(-1);
}

@keyframes swimAcross {
  0%   { left: -160px; }
  100% { left: 108%; }
}

.fish-swimmer .fish-bob {
  animation: fishBob 6s ease-in-out infinite;
}

@keyframes fishBob {
  0%, 100% { margin-top: 0; }
  50%      { margin-top: 14px; }
}

.fish-swimmer .tail {
  transform-origin: right center;
  animation: tailSway 2.6s ease-in-out infinite;
}

@keyframes tailSway {
  0%, 100% { transform: rotate(6deg); }
  50%      { transform: rotate(-6deg); }
}

/* Soft bubble variant for combined fish+bubbles days */
.bubble.soft {
  opacity: 0.6;
  filter: blur(0.5px);
}


/* ============================================================
   11. UTILITIES
============================================================ */

/* Visually separates card from panel on the same page */
.section-connector {
  width: 3px;
  height: 18px;
  background-color: rgba(35, 104, 155, 0.25);
  border-radius: 2px;
  margin: 0 auto;
}

/* Page-level wrapper — keeps content above bubble layer */
.page-content {
  position: relative;
  z-index: 10;
  width: 100%;
}
