:root {
  --primary-color: #1b7232;
  --primary-hover: #415f49;
  --primary-focus: #062400;
  --secondary-color: #101828;
  --muted-color: #484858;
  --bg-page: #ecfaf3;
  --bg-card: #ffffff;
  --bg-table-head: #f5f8fa;
  --bg-ref-box: #d3d9d5;
  --bg-badge-paid: #ecfdf3;
  --border-light: #f5f8fa;
  --border-table: #b8c4ce;
  --font-sans: "Poppins", "Inter", system-ui, -apple-system, sans-serif;
  --font-btn: "Inter", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  letter-spacing: 0.25px;
  min-height: 100vh;
  color: var(--secondary-color);
  background-color: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: var(--font-btn);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 1px;
  background: none;
  border: none;
  cursor: pointer;
}

ul {
  list-style: none;
}

h1, h2, h3 {
  font-family: var(--font-sans);
  color: var(--secondary-color);
}

/* Layout */
.web-layout {
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}

.web-layout.payment-bg {
  background-color: var(--bg-page);
  background-image: url("assets/fg-bg-large.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 60%;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

/* Navbar */
.nav {
  background-color: var(--bg-card);
  width: 100%;
  border-bottom: 1px solid var(--border-light);
  min-height: 72px;
  position: relative;
}

.nav-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo img {
  max-height: 40px;
  width: auto;
  display: block;
}

.nav-actions-web {
  display: none;
}

.nav-actions-mobile {
  display: flex;
  align-items: center;
}

.mobile-menu-btn {
  padding: 8px;
  color: #16281a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
}

.mobile-nav {
  position: absolute;
  top: 72px;
  left: 0;
  width: 100%;
  padding: 32px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  transform: translateX(-150vw);
  transition: transform 0.3s ease-in-out;
  z-index: 50;
}

.mobile-nav.open {
  transform: translateX(0);
}

.mobile-nav li {
  width: 80%;
  max-width: 320px;
}

.nav-link-group {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-btn-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  display: inline-block;
  padding: 4px;
  color: var(--muted-color);
  font-size: 1rem;
  font-weight: 600;
  line-height: 24px;
  width: 100%;
  text-align: center;
  transition: color 0.15s ease;
}

.nav-link:hover,
.nav-link:focus {
  color: var(--secondary-color);
}

.nav-btn {
  border-radius: 8px;
  background-color: var(--primary-color);
  border: 2px solid transparent;
  color: #ffffff;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  padding: 12px 22px;
  transition: background-color 0.2s ease-in-out;
  white-space: nowrap;
}

.nav-btn:hover {
  background-color: var(--primary-hover);
}

.nav-btn:focus {
  background-color: var(--primary-focus);
  border-color: var(--primary-focus);
}

.nav-btn-alt {
  background-color: #ffffff;
  color: var(--primary-color);
}

.nav-btn-alt:hover {
  background-color: #fcfcff;
}

.nav-btn-alt:focus {
  background-color: #f2f2fc;
  border-color: #f2f2fc;
}

.coat-of-arms {
  display: flex;
  justify-content: center;
  align-items: center;
}

.coat-of-arms img {
  max-height: 40px;
  width: auto;
  display: block;
}

/* Main Page Wrapper */
.page-wrapper {
  padding: 24px 0 48px;
}

.page-header {
  padding: 0 16px;
}

.header-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}

.btn-text {
  font-family: var(--font-btn);
  color: var(--primary-color);
  letter-spacing: 0.5px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  transition: background-color 0.15s ease, transform 0.2s ease;
}

.btn-text:hover {
  background-color: var(--bg-table-head);
}

.btn-text:focus-visible {
  background-color: var(--bg-table-head);
  border-color: #24422c;
  outline: none;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  font-size: 1.2rem;
}

.btn-icon svg {
  width: 1em;
  height: 1em;
}

.btn-back {
  width: fit-content;
  padding: 12px 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 24px;
  color: var(--secondary-color);
}

.btn-back .btn-icon {
  margin-right: 8px;
}

.btn-back:hover,
.btn-back:focus-visible {
  transform: scale(1.05);
  background-color: transparent;
  border-color: transparent;
}

/* Main White Card */
.details-card {
  background-color: var(--bg-card);
  padding: 30px 20px;
  width: 100%;
  max-width: 1182px;
  margin: 32px auto;
}

.details-header {
  padding: 0 12px;
  display: grid;
  gap: 32px;
}

.details-mda {
  display: grid;
  justify-items: center;
  align-items: center;
  gap: 32px;
}

.details-mda .heading {
  font-size: 20px;
  font-style: normal;
  font-weight: 600;
  line-height: 32px;
  width: 100%;
  text-align: center;
}

.details-action-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 32px;
  justify-content: center;
  align-items: center;
}

.details-ref {
  background-color: var(--bg-ref-box);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 13px 16px 16px;
  width: 100%;
}

.details-ref p:first-of-type {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--secondary-color);
}

.details-ref p:last-of-type {
  font-size: 0.875rem;
  color: var(--muted-color);
}

.btn-copy {
  padding: 10px;
  color: var(--secondary-color);
}

.details-receipt-btn .btn-big {
  padding: 1rem 2rem;
  white-space: nowrap;
}

.details-receipt-btn .btn-icon {
  margin-right: 8px;
}

.icon-desktop,
.label-desktop {
  display: none;
}

.icon-mobile,
.label-mobile {
  display: inline-flex;
}

/* Details Body */
.details-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  margin-top: 32px;
}

.details-body h2 {
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 28px;
  margin-bottom: 16px;
}

.details-bill-grid {
  display: grid;
}

.details-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
}

.details-row p:first-of-type {
  font-size: 0.875rem;
  color: var(--muted-color);
  white-space: nowrap;
}

.details-row .row-value {
  font-size: 0.875rem;
  color: var(--secondary-color);
  font-weight: 500;
  padding: 8px 0;
  text-align: right;
  word-break: break-word;
}

.status-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: capitalize;
  min-width: max-content;
}

.status-paid {
  background-color: var(--bg-badge-paid);
  color: var(--primary-color);
}

/* Payment & Tables */
.payment-wrapper {
  display: grid;
  border-bottom: 1px solid var(--border-table);
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.bill-receipt {
  width: 100%;
  color: var(--secondary-color);
  font-weight: 400;
  font-size: 0.875rem;
  border-spacing: 0;
  border-collapse: separate;
  border-top: 1px solid var(--border-table);
  border-bottom: 1px solid var(--border-table);
}

.bill-receipt thead {
  display: none;
}

.bill-receipt tr {
  display: flex;
  flex-flow: column;
  row-gap: 8px;
  border-top: 1px solid var(--border-table);
}

.bill-receipt tr:first-child {
  border-top: none;
}

.bill-receipt th,
.bill-receipt td {
  color: inherit;
  font-weight: inherit;
  font-size: inherit;
  padding: 16px 8px;
}

.bill-receipt td.col-desc {
  width: 100%;
}

.desc-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.mobile-header {
  margin-right: 8px;
  color: var(--muted-color);
}

.col-narration {
  text-align: left;
}

.col-narration span {
  font-weight: 500;
  margin-right: 4px;
}

/* Summary Table */
.bill-summary {
  color: var(--secondary-color);
  font-weight: 400;
  font-size: 0.875rem;
  width: 100%;
  border-spacing: 2px;
  border-collapse: separate;
  margin-top: 8px;
}

.bill-summary th {
  text-align: left;
  color: var(--muted-color);
  font-weight: inherit;
  font-size: inherit;
  padding: 16px 8px;
}

.bill-summary td {
  text-align: right;
  color: var(--secondary-color);
  font-weight: inherit;
  font-size: inherit;
  padding: 16px 8px;
}

.bill-summary tr.summary-bold th,
.bill-summary tr.summary-bold td {
  font-weight: 600;
  font-size: 1rem;
  color: var(--secondary-color);
}

.bill-summary tr.summary-total th,
.bill-summary tr.summary-total td {
  line-height: 28px;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--secondary-color);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: #ffffff;
  color: var(--secondary-color);
  border-left: 4px solid var(--primary-color);
  padding: 14px 18px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(16, 24, 40, 0.15);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Floating Chat Button */
.chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.25);
  transition: background-color 0.2s ease, transform 0.2s ease;
  z-index: 900;
}

.chat-fab:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
}

.chat-fab svg {
  width: 24px;
  height: 24px;
}

/* Responsive Breakpoints */
@media screen and (min-width: 720px) {
  .container {
    width: 90%;
  }

  .nav-wrapper {
    padding-left: 0;
    padding-right: 0;
  }

  .logo img {
    max-height: 50px;
  }

  .page-header {
    padding: 0;
  }

  .details-card {
    padding: 32px;
    margin: 0 auto;
  }

  .details-row .row-value {
    padding: 8px 24px;
  }

  .bill-summary {
    width: 50%;
    justify-self: end;
    border-spacing: 0;
  }
}

@media screen and (min-width: 910px) {
  .logo img {
    max-height: 55px;
  }

  .nav-actions-web {
    display: inline-flex;
    align-items: center;
    gap: 24px;
  }

  .nav-actions-web > * {
    white-space: nowrap;
    display: flex;
  }

  .nav-actions-mobile,
  .mobile-nav {
    display: none;
  }

  .header-bar {
    flex-direction: row;
    justify-content: space-between;
  }

  .details-action-group {
    width: unset;
    flex-direction: row;
  }

  .details-body {
    padding: 0 12px;
  }

  .details-bill-grid {
    grid-template-columns: repeat(2, minmax(0, 373px));
    justify-content: space-between;
  }

  .payment-wrapper {
    border: 0;
  }

  .bill-receipt {
    border: 0;
  }

  .bill-receipt thead {
    display: table-header-group;
    background-color: var(--bg-table-head);
    color: var(--muted-color);
  }

  .bill-receipt th {
    color: var(--muted-color);
    text-align: right;
  }

  .bill-receipt th.col-desc {
    text-align: left;
    width: 40%;
  }

  .bill-receipt th.col-gifmis {
    text-align: center;
  }

  .bill-receipt tr {
    display: table-row;
    border-top: none;
  }

  .bill-receipt td.col-desc {
    width: unset;
  }

  .bill-receipt td:not(.col-desc):not(.col-narration) {
    text-align: right;
  }

  .bill-receipt td.col-gifmis {
    text-align: center;
  }

  .mobile-header {
    display: none;
  }

  .bill-summary {
    width: 33%;
  }
}

@media screen and (min-width: 1024px) {
  .details-header {
    grid-template-columns: 2fr 1.8fr;
    gap: 0;
    align-items: start;
  }

  .details-mda {
    align-items: start;
    justify-items: start;
    grid-template-rows: minmax(80px, auto) min-content;
    gap: 16px;
  }

  .details-mda .logo-medium {
    align-self: center;
  }

  .details-mda .heading {
    text-align: left;
  }

  .icon-desktop,
  .label-desktop {
    display: inline-flex;
  }

  .icon-mobile,
  .label-mobile {
    display: none;
  }
}

/* Print Styles */
@media print {
  .nav,
  .page-header,
  .details-receipt-btn,
  .btn-copy,
  .chat-fab,
  .toast-container {
    display: none !important;
  }

  .web-layout.payment-bg {
    background: #ffffff !important;
    background-image: none !important;
  }

  .details-card {
    padding: 0;
    margin: 0;
    max-width: 100%;
  }
}
