:root {
  --bg-primary: #f8fafc;
  --bg-surface: rgba(255, 255, 255, 0.92);
  --bg-card: rgba(255, 255, 255, 0.94);
  --bg-accent: rgba(241, 245, 249, 0.85);
  --border-color: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;

  --badge-failed-bg: #fee2e2;
  --badge-failed-txt: #991b1b;
  --badge-negative-bg: #ffedd5;
  --badge-negative-txt: #9a3412;
  --badge-mixed-bg: #fef3c7;
  --badge-mixed-txt: #92400e;
  
  --spacing-unit: 1rem;
  --card-padding: 1.25rem;
  --font-size-base: 1rem;
}

body.theme-dark {
  --bg-primary: #0b1329;
  --bg-surface: rgba(17, 30, 56, 0.92);
  --bg-card: rgba(24, 40, 73, 0.92);
  --bg-accent: rgba(30, 49, 88, 0.85);
  --border-color: #2e4370;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --primary-color: #3b82f6;
  --primary-hover: #60a5fa;

  --badge-failed-bg: #451010;
  --badge-failed-txt: #fca5a5;
  --badge-negative-bg: #431407;
  --badge-negative-txt: #fdba74;
  --badge-mixed-bg: #452402;
  --badge-mixed-txt: #fde68a;
}

body.density-dense {
  --spacing-unit: 0.5rem;
  --card-padding: 0.75rem;
  --font-size-base: 0.875rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
/*
body {
  font-family: 'Assistant', 'Noto Sans Arabic', 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  font-size: var(--font-size-base);
  transition: background-color 0.2s, color 0.2s;
}
*/
/* Background setup with ilgov37.jpg */
body {
  font-family: 'Assistant', 'Noto Sans Arabic', 'Inter', sans-serif;
  color: var(--text-main);
  line-height: 1.5;
  font-size: var(--font-size-base);
  min-height: 100vh;
  position: relative;
  background-color: var(--bg-primary);
  transition: background-color 0.2s, color 0.2s;
}

/* Pseudo-element holding the background image */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url('../ilgov37.jpg');
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center top;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Theme tints over the background photo to ensure high contrast and readability */
body.theme-light::before {
  opacity: 0.18;
}

body.theme-dark::before {
  opacity: 0.12;
}

/* PORTRAIT MODE: Limit the image strictly to the top third */
@media (orientation: portrait) {
  body::before {
    height: 33.333vh;
    bottom: auto;
    background-position: center 15%;
    /* Gradient fade at the bottom edge of the top third */
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0) 100%);
  }
}

/* LANDSCAPE MODE: Full screen subtle backdrop */
@media (orientation: landscape) {
  body::before {
    height: 100vh;
    background-position: center 25%;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 40%, rgba(0, 0, 0, 0.4) 100%);
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 40%, rgba(0, 0, 0, 0.4) 100%);
  }
}

/* Headers 
.app-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}
*/

/* Backdrop blur on header, cards, and banners */
.app-header {
  background-color: var(--bg-surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.card, .summary-banner {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary-color);
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.controls-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.control-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.control-select, .search-input, .topic-select {
  background-color: var(--bg-accent);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.6rem;
  border-radius: 0.375rem;
  font-size: 0.85rem;
  outline: none;
}

/* Main Layout */
.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--spacing-unit);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: center;
  justify-content: space-between;
}

.search-and-topic-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1 1 450px;
}

.search-box {
  flex: 1 1 240px;
}

.search-input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
}

.topic-box {
  flex: 0 1 200px;
}

.topic-select {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
}

.status-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-chip {
  background: var(--bg-accent);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}

.filter-chip.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

/* Summary Banner */
.summary-banner {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: var(--card-padding);
  margin-bottom: 1.5rem;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.summary-body.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.summary-body {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Grid & Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--spacing-unit);
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: var(--card-padding);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 0.35rem;
  white-space: nowrap;
}

.badge-failed { background: var(--badge-failed-bg); color: var(--badge-failed-txt); }
.badge-negative { background: var(--badge-negative-bg); color: var(--badge-negative-txt); }
.badge-mixed { background: var(--badge-mixed-bg); color: var(--badge-mixed-txt); }

.card-headline-stats {
  list-style: none;
  margin: 0.5rem 0 1rem;
}

.card-headline-stats li {
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: var(--text-main);
  position: relative;
  padding-inline-start: 1.1rem;
}

.card-headline-stats li::before {
  content: "•";
  position: absolute;
  inset-inline-start: 0;
  color: var(--primary-color);
  font-weight: bold;
}

.bottom-line-box {
  background-color: var(--bg-accent);
  border-inline-start: 3px solid var(--primary-color);
  padding: 0.6rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-style: italic;
}

/* Buttons */
.btn {
  padding: 0.45rem 0.85rem;
  border-radius: 0.375rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background-color: var(--primary-color);
  color: #fff;
  width: 100%;
}

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

.btn-secondary {
  background: var(--bg-accent);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-doc-link {
  background-color: var(--primary-color);
  color: #fff;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  font-weight: 700;
  display: inline-block;
  text-align: center;
}

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

.btn-text {
  background: none;
  border: none;
  color: var(--primary-color);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal-dialog {
  background-color: var(--bg-card);
  border-radius: 0.75rem;
  max-width: 850px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.about-dialog {
  max-width: 780px;
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Detail Modal Sections */
.detail-section {
  margin-bottom: 1.25rem;
}

.detail-section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.table-responsive {
  overflow-x: auto;
  margin: 0.75rem 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th, .data-table td {
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.6rem;
  text-align: start;
}

.data-table th {
  background-color: var(--bg-accent);
  font-weight: 700;
}

.arguments-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.5rem;
}

.argument-card {
  padding: 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.85rem;
}

.arg-supporters {
  background-color: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.arg-critics {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.arg-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
}

/* Feedback Iframe in About Modal */
.form-embed-wrapper {
  margin: 1rem 0;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: #ffffff;
}

.feedback-iframe {
  width: 100%;
  height: 480px;
  border: none;
  display: block;
}

.form-fallback {
  padding: 0.5rem;
  text-align: center;
  background-color: var(--bg-accent);
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .arguments-grid {
    grid-template-columns: 1fr;
  }
  .header-container {
    flex-direction: column;
    align-items: stretch;
  }
  .search-and-topic-group {
    flex-direction: column;
  }
  .topic-box, .search-box {
    flex: 1 1 100%;
  }
}

/* QR Code & Share Block in About Modal */
.about-share-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-around;
  gap: 1.25rem;
  background-color: var(--bg-accent);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.about-doc-link-col {
  flex: 1 1 240px;
  display: flex;
  justify-content: center;
}

.about-doc-link-col .btn-doc-link {
  margin-bottom: 0;
}

.qr-code-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qr-code-img {
  width: 110px;
  height: 110px;
  object-fit: contain;
  background-color: #ffffff;
  padding: 0.35rem;
  border-radius: 0.375rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.qr-code-caption {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Share & QR Modal */
.share-dialog {
  max-width: 420px;
  text-align: center;
}

.share-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 1rem;
}

.qr-code-wrapper-prominent {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.qr-code-img-large {
  width: 190px;
  height: 190px;
  max-width: 70vw;
  max-height: 70vw;
  object-fit: contain;
  background-color: #ffffff;
  padding: 0.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
}

.share-actions-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.share-actions-group .btn {
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
}

.copy-toast {
  background-color: #10b981;
  color: #ffffff;
  padding: 0.4rem 0.8rem;
  border-radius: 0.375rem;
  font-size: 0.85rem;
  font-weight: 700;
  transition: opacity 0.2s ease;
}

.copy-toast.hidden {
  display: none;
}

/* Ensure About modal QR also always displays cleanly */
.qr-code-wrapper {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  margin: 0.75rem auto;
}

.qr-code-img {
  width: 130px;
  height: 130px;
  object-fit: contain;
  background: #ffffff;
  padding: 0.35rem;
  border-radius: 0.5rem;
}
/* Mini-Infographic Component */
.infographic-container {
  background: var(--bg-accent);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.75rem 0.85rem;
  margin: 0.75rem 0 1rem;
}

.info-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.info-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.info-highlight {
  font-size: 0.85rem;
  font-weight: 800;
}

.info-svg {
  width: 100%;
  height: 80px;
  display: block;
}

/* Donut & Status layouts */
.flex-donut, .flex-status {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.donut-svg-wrapper {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
}

.donut-svg {
  width: 100%;
  height: 100%;
}

.donut-details, .status-details {
  display: flex;
  flex-direction: column;
}

.info-main-label {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
}

.info-sub-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Horizontal Bars */
.hbar-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hbar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.hbar-name {
  width: 60px;
  color: var(--text-muted);
  font-weight: 600;
}

.hbar-track {
  flex: 1;
  height: 7px;
  background-color: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.hbar-fill {
  height: 100%;
  border-radius: 4px;
}

.hbar-val {
  width: 35px;
  text-align: end;
  font-weight: 700;
  color: var(--text-main);
}

/* Compare Row */
.compare-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-top: 0.25rem;
}

.compare-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 0.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  min-width: 80px;
}

.compare-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.compare-val {
  font-size: 1.15rem;
  font-weight: 800;
}

.compare-vs {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
}

/* Status Number Box */
.status-num-box {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.35rem;
  font-weight: 900;
  flex-shrink: 0;
}

/* Detail Modal Infographic Placement */
.detail-infographic-banner {
  margin-bottom: 1.25rem;
}
