
:root {
  --agro-primary: #007572;
  --agro-accent: #029e9a;
  --agro-ink: #253b53;
}
body {
  background: #eef3f5;
  color: var(--agro-ink);
}
.navbar.bg-primary, .footer.bg-primary {
  background: var(--agro-ink) !important;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.navbar-brand::after {
  content: 'AgroCoin Explorer';
  color: #fff;
  font-weight: 600;
  font-size: 18px;
}
a { color: var(--agro-primary); }
a:hover { color: var(--agro-accent); }
.navbar-dark .navbar-nav .nav-link { color: #e1e9ed; }
.navbar-dark .navbar-nav .active .nav-link,
.navbar-dark .navbar-nav .nav-link:hover { color: #83e3db; }
.card, .panel {
  border: 1px solid #dce6eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 16px #0f293b0a;
}
.card-header, .panel-heading {
  background: #e3ebee;
  color: var(--agro-ink);
}
.btn-primary, .bg-primary,
.page-item.active .page-link {
  background-color: var(--agro-primary) !important;
  border-color: var(--agro-primary) !important;
}
.btn-primary:hover { background-color: var(--agro-accent) !important; }
.table { color: var(--agro-ink); }
.table thead th { border-bottom-color: var(--agro-accent); }
.form-control:focus {
  border-color: var(--agro-accent);
  box-shadow: 0 0 0 .2rem #029e9a25;
}

body { padding: 85px 20px 24px; font-family: system-ui,sans-serif; }
.agro-summary .card { height: 100%; }
.agro-summary .card-body { font-size: 22px; }
.agro-summary .small { font-size: 13px; }
.agro-footer { padding: 24px 0; color: #253b53; }
.agro-footer span { margin-right: 16px; color: #253b53; }
@media(max-width:767px) { body { padding: 75px 12px 20px; } }

/* Responsive AgroCoin explorer */
*, *::before, *::after {
  box-sizing: border-box;
}
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.card, .card-body, .card-header,
.row > [class*="col-"] {
  min-width: 0;
}
.card-header, .card-body p {
  overflow-wrap: anywhere;
}
.agro-summary {
  margin-left: 0;
  margin-right: 0;
}
.agro-summary > [class*="col-"] {
  padding-left: 6px;
  padding-right: 6px;
}
.agro-summary .card-body {
  font-size: clamp(19px, 4.5vw, 26px);
  font-weight: 600;
  line-height: 1.4;
}
.agro-summary .card-header {
  font-size: 14px;
  line-height: 1.4;
}
.agro-summary .small {
  font-weight: 400;
}
.table-responsive {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-responsive table {
  margin-bottom: 0;
}
#block-rows td:nth-child(2),
#rich-rows td:nth-child(2),
#address-history td:nth-child(2) {
  overflow-wrap: anywhere;
  min-width: 180px;
  max-width: 280px;
}
#block-rows td:last-child,
#address-history td:last-child {
  min-width: 150px;
}
pre {
  max-width: 100%;
  overflow-x: auto;
}
img {
  max-width: 100%;
}
form.d-flex .form-control {
  min-width: 0;
  flex: 1 1 0%;
}
form.d-flex .btn {
  flex-shrink: 0;
}
.navbar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.navbar-brand {
  margin-right: 0;
  min-width: 0;
}
.navbar-brand::after {
  font-size: clamp(14px, 4vw, 18px);
}
.navbar-toggler {
  flex-shrink: 0;
}
#home { order: 0; }
#richlist { order: 1; }
#network { order: 2; }
#info { order: 3; }

@media (max-width: 767px) {
  body {
    padding: 78px 12px 20px;
    font-size: 15px;
  }
  .agro-summary > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
    margin-bottom: 12px !important;
  }
  .card-body {
    padding: 16px;
  }
  .card-header {
    padding: 12px 16px;
  }
  .agro-summary .card-body {
    font-size: 24px;
    padding: 12px 16px;
  }
  .card-body > .row {
    margin-left: 0;
    margin-right: 0;
  }
  .card-body > .row > [class*="col-"] {
    padding-left: 0;
    padding-right: 0;
  }
  .navbar {
    padding: 6px 10px;
  }
  .navbar-brand img {
    width: 36px !important;
    height: 36px !important;
    flex-shrink: 0;
  }
  .navbar-collapse {
    max-height: 70vh;
    overflow-y: auto;
  }
  .table th, .table td {
    padding: 10px;
    font-size: 14px;
    vertical-align: top;
  }
  .agro-footer span {
    display: block;
    margin: 6px 0;
  }
}

@media (max-width: 767px) {
  .agro-summary .card-header {
    font-size: 12px;
    padding: 9px 12px;
  }
  .agro-summary .card-body {
    font-size: 20px;
    padding: 10px 12px;
  }
  .card-body p, .card-body .small {
    font-size: 13px;
    line-height: 1.5;
  }
  .agro-mobile-table,
  .agro-mobile-table tbody {
    display: block;
    width: 100% !important;
  }
  .agro-mobile-table thead {
    display: none;
  }
  .agro-mobile-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px 12px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #dce6eb;
    border-radius: 10px;
    background: #f7fafb;
  }
  .agro-mobile-table tbody td {
    display: block;
    min-width: 0 !important;
    max-width: none !important;
    padding: 0 !important;
    border: 0;
    font-size: 13px;
    line-height: 1.5;
    text-align: left !important;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .agro-mobile-table tbody td::before {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #526779;
    margin-bottom: 3px;
  }
  #rich-rows td:nth-child(2),
  #block-rows td:nth-child(2),
  #address-history td:nth-child(2) {
    grid-column: 1 / -1;
  }
  #rich-rows td:nth-child(1)::before { content: "Rank"; }
  #rich-rows td:nth-child(2)::before { content: "Address / Script"; }
  #rich-rows td:nth-child(3)::before { content: "Balance (AGRO)"; }
  #rich-rows td:nth-child(4)::before { content: "Share"; }
  #rich-rows td:nth-child(5)::before { content: "UTXOs"; }

  #block-rows td:nth-child(1)::before { content: "Height"; }
  #block-rows td:nth-child(2)::before { content: "Block Hash"; }
  #block-rows td:nth-child(3)::before { content: "Transactions"; }
  #block-rows td:nth-child(4)::before { content: "Timestamp"; }

  #address-history td:nth-child(1)::before { content: "Block"; }
  #address-history td:nth-child(2)::before { content: "Transaction"; }
  #address-history td:nth-child(3)::before { content: "Net Change (AGRO)"; }
  #address-history td:nth-child(4)::before { content: "Confirmations"; }
  #address-history td:nth-child(5)::before { content: "Timestamp"; }

  #peer-rows td:nth-child(1)::before { content: "Peer"; }
  #peer-rows td:nth-child(2)::before { content: "Protocol"; }
  #peer-rows td:nth-child(3)::before { content: "Direction"; }
  #peer-rows td:nth-child(4)::before { content: "Starting Height"; }
}
