/* Demo participante — AsambleaVirtual.cl */

:root {
  --bg: #eef2f8;
  --card: #ffffff;
  --border: #dbe3ef;
  --text: #334155;
  --muted: #64748b;
  --dark: #0f2744;
  --navy: #1a337e;
  --navy-dark: #152a66;
  --primary: #1a337e;
  --primary-hover: #152a66;
  --soft: #e8f0fc;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --success-border: #86efac;
  --error: #dc2626;
  --radius: 12px;
  --shadow: 0 8px 28px rgba(15, 39, 68, 0.08);
  --max: 520px;
}

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

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.demo-badge {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 100;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.demo-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.demo-header__inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.demo-logo img {
  height: 36px;
  width: auto;
}

.demo-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.demo-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.demo-screen {
  display: none;
}

.demo-screen.is-active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

/* —— Acceso —— */
.access-hero {
  text-align: center;
  margin-bottom: 20px;
}

.access-step {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 8px;
}

.access-title {
  font-size: 1.35rem;
  color: var(--dark);
  margin: 0 0 10px;
  line-height: 1.3;
}

.access-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.access-card {
  padding: 0;
  overflow: hidden;
}

.access-card__grid {
  display: flex;
  flex-direction: column;
}

.access-info {
  background: linear-gradient(180deg, var(--soft) 0%, #f4f8ff 100%);
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--navy);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
}

.badge-live__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.35);
}

.access-info__title {
  font-size: 1.05rem;
  color: var(--navy);
  margin: 0 0 8px;
  line-height: 1.35;
}

.access-info__community {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.access-info__meta {
  margin: 0 0 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

.access-form-wrap {
  padding: 20px;
}

.access-greeting {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 1rem;
}

.access-hint {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--muted);
}

.demo-code-box {
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--soft);
  border: 1px dashed #93b4e8;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--navy);
}

.demo-code-box strong {
  font-size: 1.1rem;
  letter-spacing: 0.08em;
}

.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 8px;
}

.field-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  color: var(--dark);
}

.field-input:focus {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
  border-color: #60a5fa;
}

.field-input.is-error {
  border-color: var(--error);
}

.field-error {
  color: var(--error);
  font-size: 0.88rem;
  margin: -6px 0 12px;
}

.access-footnote {
  margin: 16px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.icon-info {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-style: italic;
  font-weight: 700;
}

/* —— Botones —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--navy);
  color: #fff;
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-outline {
  background: #fff;
  color: var(--navy);
  border: 2px solid var(--navy);
}

.btn-outline:hover {
  background: var(--soft);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: #f8fafc;
}

.btn-link {
  background: none;
  border: none;
  color: var(--navy);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 12px;
  font-family: inherit;
  text-decoration: underline;
}

.btn-zoom__icon {
  font-size: 0.85rem;
}

/* —— Panel —— */
.badge-success {
  display: inline-block;
  background: var(--success-bg);
  color: #166534;
  border: 1px solid var(--success-border);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.badge-success--inline {
  margin-top: 10px;
}

.panel-status__title {
  font-size: 1.4rem;
  color: var(--navy);
  margin: 0 0 6px;
}

.panel-status__assembly {
  margin: 0 0 6px;
  font-weight: 600;
  color: var(--dark);
}

.panel-status__time {
  margin: 0 0 18px;
  font-size: 0.85rem;
  color: var(--muted);
}

.data-grid {
  margin: 0;
  display: grid;
  gap: 14px;
}

.data-grid__item dt {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.data-grid__item dd {
  margin: 0;
  font-weight: 600;
  color: var(--dark);
}

.status-live {
  color: #dc2626;
  font-weight: 600;
}

.card-title {
  font-size: 1.05rem;
  color: var(--dark);
  margin: 0 0 8px;
}

.card-text {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* —— Votación —— */
.vote-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 8px;
}

.badge-open {
  display: inline-block;
  background: var(--soft);
  color: var(--navy);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.vote-title {
  font-size: 1.15rem;
  color: var(--navy);
  margin: 0 0 10px;
  line-height: 1.35;
}

.vote-question {
  margin: 0 0 18px;
  color: var(--text);
  font-size: 0.95rem;
}

.vote-options {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vote-option__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
}

.vote-option__label:hover {
  border-color: #93b4e8;
  background: #fafcff;
}

.vote-option__text {
  font-weight: 500;
  color: var(--dark);
}

.vote-option__label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.vote-option__radio {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #94a3b8;
  flex-shrink: 0;
  position: relative;
}

.vote-option__label input:checked + .vote-option__radio {
  border-color: var(--navy);
}

.vote-option__label input:checked + .vote-option__radio::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--navy);
}

.vote-option__label:has(input:checked) {
  border-color: var(--navy);
  background: var(--soft);
}

.vote-footnote {
  margin: 14px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

/* —— Comprobante —— */
.receipt-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.receipt-kicker {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.receipt-title {
  font-size: 1.35rem;
  color: var(--navy);
  margin: 4px 0 0;
}

.receipt-id {
  font-size: 0.8rem;
  font-weight: 700;
  color: #166534;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  padding: 6px 12px;
  border-radius: 6px;
}

.receipt-divider {
  border: none;
  border-top: 2px solid var(--navy);
  margin: 18px 0;
}

.receipt-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 0;
}

.receipt-grid__item dt {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.receipt-grid__item dd {
  margin: 0;
  font-weight: 600;
  color: var(--dark);
}

.receipt-highlight {
  color: var(--navy);
  font-size: 1.05rem;
}

.receipt-footer-note {
  margin: 20px 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}

/* —— Pantalla final: panel + resultados —— */
.results-page-header {
  margin-bottom: 16px;
}

.panel-page-title {
  font-size: 1.35rem;
  color: var(--navy);
  margin: 0 0 10px;
  line-height: 1.3;
}

.badge-results {
  display: inline-block;
  background: var(--soft);
  color: var(--navy);
  border: 1px solid #93b4e8;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 6px;
}

.results-panel-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.results-panel-stack .card {
  margin-bottom: 16px;
}

.results-panel-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-votes-done {
  background: linear-gradient(180deg, #f0fdf4 0%, #fff 100%);
  border-color: var(--success-border);
}

.panel-votes-done .card-title {
  margin-top: 8px;
}

.votes-done-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.votes-done-list__item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.votes-done-list__title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.35;
}

.votes-done-list__meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.votes-done-list__badge {
  display: inline-block;
  width: fit-content;
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #166534;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  padding: 3px 8px;
  border-radius: 4px;
}

.results-section {
  margin: 8px 0 16px;
  padding-top: 8px;
  border-top: 2px solid var(--border);
}

.results-section__title {
  font-size: 1.15rem;
  color: var(--navy);
  margin: 0 0 6px;
}

.results-section__lead {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

#screen-results .panel-status__title {
  font-size: 1.4rem;
  margin: 0 0 6px;
}

.results-block__title {
  font-size: 1rem;
  color: var(--navy);
  margin: 0 0 6px;
}

.results-block__vote {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--muted);
}

.result-row {
  margin-bottom: 14px;
}

.result-row__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.result-row__label {
  font-weight: 500;
  color: var(--dark);
}

.result-row__pct {
  font-weight: 700;
  color: var(--navy);
}

.result-bar {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.result-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--navy), #3b5cb8);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.result-row--winner {
  padding: 10px 12px;
  margin: 0 -12px 14px;
  background: var(--soft);
  border-radius: 8px;
}

.badge-winner,
.badge-yours {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.badge-winner {
  background: var(--navy);
  color: #fff;
}

.badge-yours {
  background: var(--success-bg);
  color: #166534;
  border: 1px solid var(--success-border);
}

/* —— CTA —— */
.cta-card {
  text-align: center;
  background: linear-gradient(180deg, #fff 0%, var(--soft) 100%);
}

.cta-card__title {
  font-size: 1.15rem;
  color: var(--navy);
  margin: 0 0 10px;
}

.cta-card__text {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.92rem;
}

.cta-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* —— Footer —— */
.demo-footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 28px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.btn-link--footer {
  display: block;
  margin: 8px auto 0;
}

/* —— Modal —— */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 39, 68, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  width: min(400px, 100%);
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.modal-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: var(--navy);
  padding-right: 28px;
}

.modal-body {
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 20px;
}

.modal-body p {
  margin: 0 0 10px;
}

.modal-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.modal-vote-preview {
  background: var(--soft);
  padding: 10px 12px;
  border-radius: 8px;
}

.modal-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
}

.hidden {
  display: none !important;
}

/* —— Loading overlay —— */
.demo-loading {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.demo-loading.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.demo-loading__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: min(320px, 92vw);
  text-align: center;
}

.demo-loading__text {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
}

.demo-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: demo-spin 0.75s linear infinite;
}

@keyframes demo-spin {
  to {
    transform: rotate(360deg);
  }
}

body.is-busy {
  overflow: hidden;
}

body.is-busy .demo-main,
body.is-busy .demo-header,
body.is-busy .demo-footer {
  pointer-events: none;
  user-select: none;
}

.vote-card.is-busy .vote-options {
  opacity: 0.55;
  pointer-events: none;
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* —— Desktop —— */
@media (min-width: 720px) {
  .access-title {
    font-size: 1.6rem;
  }

  .access-card__grid {
    flex-direction: row;
  }

  .access-info {
    flex: 1;
    border-bottom: none;
    border-right: 1px solid var(--border);
  }

  .access-form-wrap {
    flex: 1;
  }

  .receipt-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .modal-actions {
    flex-direction: row;
    justify-content: flex-end;
  }

  .modal-actions .btn-outline {
    order: -1;
  }

  .cta-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .cta-actions .btn {
    flex: 0 1 auto;
  }

  .results-panel-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: stretch;
  }

  .results-panel-actions .card {
    margin-bottom: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .results-panel-actions .btn-block {
    margin-top: auto;
  }

  .data-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
