html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Your custom Constitution background with "We the People" visible - Fixed file extension */
  background: linear-gradient(rgba(248, 249, 250, 0.85), rgba(248, 249, 250, 0.85)), 
              url('/images/constitution-background.jfif');
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
}

/* Patriotic color scheme */
:root {
  --patriot-red: #dc3545;
  --patriot-blue: #002868;
  --patriot-white: #ffffff;
  --patriot-gold: #bf9000;
}

/* Navigation with flag colors */
.navbar {
  background: linear-gradient(135deg, var(--patriot-blue) 0%, var(--patriot-red) 100%) !important;
  border-bottom: 3px solid var(--patriot-gold);
}

.navbar-brand, .nav-link {
  color: var(--patriot-white) !important;
  font-weight: 600;
}

.nav-link:hover {
  color: var(--patriot-gold) !important;
}

/* Constitution-themed card styling */
.constitution-card {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(0, 40, 104, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.constitution-card .card-header {
  background: linear-gradient(135deg, var(--patriot-blue) 0%, var(--patriot-red) 100%);
  color: var(--patriot-white);
  border-bottom: 3px solid var(--patriot-gold);
}

/* Patriotic buttons */
.btn-patriot {
  background: linear-gradient(135deg, var(--patriot-blue) 0%, var(--patriot-red) 100%);
  border: 2px solid var(--patriot-gold);
  color: var(--patriot-white);
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-patriot:hover {
  background: linear-gradient(135deg, var(--patriot-red) 0%, var(--patriot-blue) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 40, 104, 0.3);
  color: var(--patriot-white);
}

/* American flag decoration */
.flag-decoration {
  position: relative;
}

.flag-decoration::before {
  content: "????";
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 2rem;
  z-index: 10;
}

/* Constitution text styling */
.constitution-text {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  color: var(--patriot-blue);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* Amendment full text - improved readability for a wide audience */
.amendment-fulltext {
  /* Use a highly readable sans-serif stack */
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  /* Slightly larger for better legibility */
  font-size: 1.125rem;
  /* More generous line-height for older readers */
  line-height: 1.6;
  /* Use normal (non-italic) style for readability */
  font-style: normal;
  /* Keep color consistent with theme */
  color: var(--patriot-blue);
  /* Preserve blank lines and wrap long text */
  white-space: pre-wrap;
}

/* Amendment description styling - slightly larger for readability */
.amendment-description {
  font-size: 1.1rem;
  line-height: 1.7;
  font-weight: 500;
  color: #1f2a44;
  margin: 0;
}

@media (min-width: 768px) {
  .amendment-description {
    text-align: justify;
  }
}

.description-panel {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(233, 236, 243, 0.9) 100%);
  border-left: 4px solid var(--patriot-gold);
  border-radius: 0 12px 12px 0;
  padding: 1rem 1.25rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.description-icon {
  font-size: 1.5rem;
  margin-top: 0.2rem;
  opacity: 0.7;
}

/* Purpose statement styling */
.purpose-statement {
 margin-bottom:1.5rem;
 padding-top:1.5rem;
}
.purpose-statement h2 {
 margin-bottom:0.5rem;
}

/* Footer styling */
.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
  background: linear-gradient(135deg, var(--patriot-blue) 0%, var(--patriot-red) 100%);
  color: var(--patriot-white);
  border-top: 3px solid var(--patriot-gold);
}

.footer a {
  color: var(--patriot-gold);
}

/* Card enhancements */
.card {
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 40, 104, 0.15);
}

/* Senator cards - Blue theme */
.border-primary {
  border-color: var(--patriot-blue) !important;
}

.bg-primary {
  background: linear-gradient(135deg, var(--patriot-blue) 0%, #0056b3 100%) !important;
}

/* Representative cards - Red theme */
.border-success {
  border-color: var(--patriot-red) !important;
}

.bg-success {
  background: linear-gradient(135deg, var(--patriot-red) 0%, #c82333 100%) !important;
}

/* Alert styling */
.alert-success {
  background: linear-gradient(135deg, rgba(0, 40, 104, 0.1) 0%, rgba(220, 53, 69, 0.1) 100%);
  border: 2px solid var(--patriot-gold);
  color: var(--patriot-blue);
  backdrop-filter: blur(8px);
}

.alert-info {
  background: linear-gradient(135deg, rgba(0, 40, 104, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
  border: 2px solid var(--patriot-blue);
  color: var(--patriot-blue);
  backdrop-filter: blur(8px);
}

/* Map styling */
#map {
  border-radius: 8px;
  border: 3px solid var(--patriot-gold);
  min-height: 400px;
  background: linear-gradient(135deg, rgba(0, 40, 104, 0.05) 0%, rgba(220, 53, 69, 0.05) 100%);
}

/* Responsive improvements */
@media (max-width: 768px) {
  .btn-lg {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  body {
    background-attachment: scroll;
  }
}

/* Supporters page styles */
.state-list .state-item a {
 color: var(--patriot-blue);
 font-weight:600;
}

.supporter-list .supporter-name {
 /* Use a cursive/signature-like font stack */
 font-family: 'Brush Script MT', 'Pacifico', 'Dancing Script', 'Segoe Script', cursive;
 font-size:1.25rem;
 color: #111;
 margin-left:0.5rem;
}

/* Left-align the state list and add spacing */
.state-list .state-item {
 justify-content: flex-start;
}

/* Make the state list sit more to the left visually */
@media (min-width:768px) {
 .state-list {
 margin-left:-1.5rem;
 }
}

/* Adjust supporter list item alignment */
.supporter-list .list-group-item {
 display:flex;
 justify-content:space-between;
 align-items:center;
}

/* Make full name area centered on small screens, right-aligned on larger */
.supporter-list .list-group-item div {
 text-align:center;
}

@media (min-width:768px) {
 .supporter-list .list-group-item div {
 text-align:right;
 }
}

/* Supporter paper styling - make list look like a sheet of paper */
.supporter-paper {
 background: #fffef8; /* off-white paper color */
 border: 1px solid rgba(0,0,0,0.08);
 border-radius: 6px;
 box-shadow: 0 12px 30px rgba(0,0,0,0.12);
 padding: 1.5rem;
 position: relative;
 /* faint horizontal ruled lines every 2rem */
 background-image: repeating-linear-gradient(
 to bottom,
 rgba(0,0,0,0.03) 0,
 rgba(0,0,0,0.03) 1px,
 transparent 1px,
 transparent 2rem
 );
}

/* folded-corner decoration */
.supporter-paper::after {
 content: '';
 position: absolute;
 right: 12px;
 top: 12px;
 width: 40px;
 height: 40px;
 background: linear-gradient(135deg, rgba(0,0,0,0.03) 0%, rgba(0,0,0,0.0) 100%);
 transform: rotate(45deg);
 border-radius: 2px;
 box-shadow: 0 2px 6px rgba(0,0,0,0.08);
 opacity: 0.8;
}

/* Theme tags - decorative labels that don't look like buttons */
.theme-tag {
display: inline-block;
  padding: 0.5rem 1rem;
  margin: 0.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: 'Times New Roman', serif;
  font-style: italic;
  color: var(--patriot-blue);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.9) 100%);
  border: 2px solid var(--patriot-gold);
  border-radius: 0;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  text-shadow: 0.5px 0.5px 1px rgba(255, 255, 255, 0.8);
  position: relative;
  cursor: default;
  pointer-events: none;
}

.theme-tag::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, rgba(191, 144, 0, 0.2) 0%, transparent 50%, rgba(191, 144, 0, 0.2) 100%);
  border-radius: 0;
  z-index: -1;
}

.theme-tag.tag-primary {
  color: var(--patriot-blue);
  border-color: rgba(0, 40, 104, 0.4);
}

.theme-tag.tag-accent {
  color: var(--patriot-red);
  border-color: rgba(220, 53, 69, 0.4);
}

/* Deep Dive Section Styling */
.section-header {
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--patriot-gold);
  position: relative;
}

.section-header::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 100px;
  height: 3px;
  background: linear-gradient(90deg, var(--patriot-blue) 0%, var(--patriot-red) 100%);
}

.section-header h2 {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  color: var(--patriot-blue);
  font-weight: bold;
  font-size: 1.75rem;
  margin-bottom: 0;
}

/* Document box for Deep Dive content */
.document-box {
  padding: 2rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
}

.document-box h1 {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  color: var(--patriot-blue);
  font-weight: bold;
  font-size: 2.5rem;
  margin-bottom: 2rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* Section title styling */
.section-title {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  color: var(--patriot-blue);
  font-weight: bold;
  font-size: 1.75rem;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--patriot-gold);
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--patriot-blue) 0%, var(--patriot-red) 100%);
}

/* Sub-title styling */
.sub-title {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  color: var(--patriot-blue);
  font-weight: 600;
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

/* Special styling when sub-title is used as descriptive text */
.sub-title.ballot-description {
  font-size: 1.05rem;
  font-weight: 500;
  font-style: normal;
  color: #555;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

/* Section introduction/description - subtle emphasis */
.section-intro {
  font-size: 1.15rem;
  line-height: 1.8;
  color: var(--patriot-blue);
  font-weight: 500;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, rgba(0, 40, 104, 0.04) 0%, rgba(255, 255, 255, 0.8) 100%);
  border-left: 4px solid var(--patriot-gold);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* Paragraph styling within document box */
.document-box p {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 1rem;
  color: #333;
}

/* Table styling for examples */
.document-box .table {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.document-box .table th {
  background-color: rgba(0, 40, 104, 0.1);
  color: var(--patriot-blue);
  font-weight: 600;
  border-color: var(--patriot-gold);
}

.document-box .table td {
  border-color: rgba(0, 40, 104, 0.15);
}

.document-box .table-light th {
  background: linear-gradient(135deg, rgba(0, 40, 104, 0.08) 0%, rgba(220, 53, 69, 0.05) 100%);
}

/* Callout boxes for important information */
.callout {
  background: linear-gradient(135deg, rgba(0, 40, 104, 0.08) 0%, rgba(220, 53, 69, 0.05) 100%);
  border-left: 5px solid var(--patriot-gold);
  padding: 1.25rem;
  margin: 1.5rem 0;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.callout strong {
  color: var(--patriot-blue);
  font-size: 1.1rem;
}

/* Example boxes for mathematical demonstrations */
.example-box {
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--patriot-blue);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: 0 4px 12px rgba(0, 40, 104, 0.15);
}

.example-box h5 {
  color: var(--patriot-blue);
  font-weight: bold;
  margin-bottom: 1rem;
  font-family: 'Times New Roman', serif;
  font-style: italic;
}

.example-box p {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

/* Enhanced list styling for Deep Dive content */
.card-body ul:not(.list-group) {
  padding-left: 1.5rem;
}

.card-body ul:not(.list-group) li {
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.card-body ol li {
  margin-bottom: 0.75rem;
  line-height: 1.6;
  padding-left: 0.5rem;
}

/* Ballot table styling */
.table-bordered.text-center.align-middle {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.table-bordered.text-center.align-middle th:first-child,
.table-bordered.text-center.align-middle td.text-start {
  text-align: left !important;
  font-weight: 500;
  background-color: rgba(248, 249, 250, 0.5);
}

.table-bordered.text-center.align-middle td {
  min-width: 40px;
  height: 45px;
  vertical-align: middle;
  font-weight: 600;
  color: var(--patriot-blue);
}

.table-bordered.text-center.align-middle td:has(X) {
  background-color: rgba(0, 40, 104, 0.1);
  color: var(--patriot-blue);
  font-size: 1.2rem;
}

/* Party candidate list styling */
.row .col-md-3 h6,
.row .col-md-4 h6 {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  color: var(--patriot-blue);
  font-weight: bold;
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--patriot-gold);
}

.row .col-md-3,
.row .col-md-4 {
  margin-bottom: 2rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  line-height: 1.8;
}

.row .col-md-3 br,
.row .col-md-4 br {
  content: "";
  display: block;
  margin-bottom: 0.25rem;
}

/* Simple ballot table for party selection */
.table-bordered.text-center tr td {
  padding: 1rem 0.5rem;
  font-weight: 500;
  vertical-align: middle;
}

.table-bordered.text-center tr td:contains("(X)") {
  background-color: rgba(0, 40, 104, 0.1);
  font-weight: 700;
  color: var(--patriot-blue);
}

/* Highlight cells with (X) */
.table-bordered td {
  position: relative;
}

/* Extended calculation table with more columns */
.table-bordered.table-sm.text-center th {
  background-color: rgba(0, 40, 104, 0.1);
  color: var(--patriot-blue);
  font-weight: 600;
  padding: 0.5rem 0.25rem;
  vertical-align: middle;
  min-width: 45px;
  font-size: 0.85rem;
}

.table-bordered.table-sm.text-center tbody tr {
  background-color: white !important;
}

.table-bordered.table-sm.text-center tbody tr td {
  background-color: transparent !important;
  font-weight: normal;
  color: #212529;
}

.table-bordered.table-sm.text-center tbody tr:last-child {
  background-color: white !important;
  border-top: 1px solid #dee2e6;
}

.table-bordered.table-sm.text-center tbody tr:last-child td {
  background-color: transparent !important;
  font-weight: normal;
  color: #212529;
}

/* Override any nth-child styling for this table */
.table-bordered.table-sm.text-center tbody tr:nth-of-type(odd) {
  background-color: white !important;
}

.table-bordered.table-sm.text-center tbody tr:nth-of-type(even) {
  background-color: white !important;
}

.table-bordered.table-sm.text-center tbody tr:not(:last-child) {
  background-color: white !important;
}

/* Headings within examples */
.document-box h4 {
  font-family: 'Times New Roman', serif;
  color: var(--patriot-blue);
  font-weight: 600;
  font-size: 1.35rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

/* Ballot description paragraph */
.ballot-description {
  font-size: 1.05rem;
  font-weight: 500;
  color: #555;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  font-style: italic;
}

/* Table footnote styling */
.table-note {
  font-size: 0.9rem;
  color: #666;
  font-style: italic;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.table-note sup {
  font-weight: bold;
  color: var(--patriot-blue);
}

/* Table header superscript markers */
th sup {
  font-weight: bold;
  color: var(--patriot-blue);
  font-size: 0.75em;
}

/* Equation note superscript */
figure p sup {
  font-weight: bold;
  color: var(--patriot-blue);
}

.bg-body-tertiary {
  background-color: rgba(248, 249, 250, 0.5) !important;
}

/* Section container styling */
section.container.my-4 {
  margin-top: 2rem !important;
  margin-bottom: 2rem !important;
}

/* List group styling for Deep Dive lists */
.list-group-item {
  border-left: 3px solid transparent;
  transition: border-color 0.2s ease;
}

.list-group-item:hover {
  border-left-color: var(--patriot-gold);
  background-color: rgba(0, 40, 104, 0.02);
}

/* Enhanced card for calculated table section */
.card.shadow-sm {
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
}

.card .card-body h2.h4 {
  font-family: 'Times New Roman', serif;
  color: var(--patriot-blue);
  font-weight: bold;
}

.document-box .card .card-body {
  padding: 0 !important;
}

/* Override any card-body padding inside shadow-sm cards within document-box */
.document-box .card.shadow-sm .card-body {
  padding: 0 !important;
}

/* Success badge for extra seats */
.badge.text-bg-success {
  background-color: #28a745 !important;
  color: white !important;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  font-weight: 500;
  border-radius: 4px;
  vertical-align: middle;
  display: inline-block;
}

/* Badge styling for total seats display */
.badge.text-bg-secondary {
  background-color: var(--patriot-blue) !important;
  color: white !important;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  font-weight: 500;
}

/* Table with remainder badges - ensure consistent styling */
.table-bordered.table-hover tbody tr {
  background-color: white !important;
}

.table-bordered.table-hover tbody tr:hover {
  background-color: rgba(0, 40, 104, 0.03) !important;
}

/* Totals row styling */
.table-bordered.table-hover tbody tr.table-light {
  background-color: rgba(248, 249, 250, 1) !important;
}

.table-bordered.table-hover tbody tr.table-light:hover {
  background-color: rgba(248, 249, 250, 1) !important;
}

.table-bordered th[scope="row"] {
  font-weight: 600;
  color: var(--patriot-blue);
  text-align: left;
  background-color: transparent !important;
}

.table-bordered td.text-end {
  font-variant-numeric: tabular-nums;
  background-color: transparent !important;
}

.table-bordered .small.text-muted {
  font-size: 0.8rem;
  font-style: italic;
}

/* Ensure all table cells have consistent background - override Bootstrap defaults */
.table-bordered.table-hover tbody tr:not(.table-light) td,
.table-bordered.table-hover tbody tr:not(.table-light) th {
  background-color: transparent !important;
}

/* Remove any striped table styling if it exists */
.table-bordered.table-hover tbody tr:nth-of-type(odd) {
  background-color: white !important;
}

.table-bordered.table-hover tbody tr:nth-of-type(even) {
  background-color: white !important;
}

/* Ensure the actual seats column maintains alignment */
.table-bordered td.text-end .fw-semibold {
  display: inline-block;
  min-width: 2rem;
  text-align: right;
}

/* PDF Viewer Styling */
.pdf-viewer-container {
  margin-top: 2rem;
}

.pdf-embed-wrapper {
  border: 2px solid var(--patriot-blue);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 40, 104, 0.15);
  background: white;
}

.pdf-embed {
  display: block;
  border: none;
}

.pdf-viewer-container .alert {
  background: linear-gradient(135deg, rgba(0, 40, 104, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
  border: 2px solid var(--patriot-blue);
  color: var(--patriot-blue);
}

.pdf-viewer-container .alert-link {
  color: var(--patriot-red);
  font-weight: 600;
  text-decoration: underline;
}

.pdf-viewer-container .alert-link:hover {
  color: var(--patriot-blue);
}

/* Responsive PDF embed */
@media (max-width: 768px) {
  .pdf-embed {
    height: 600px;
  }
}