:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #475569;
  --bg-gradient-start: #0f172a;
  --bg-gradient-end: #1e1b4b;
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --font-main: 'Outfit', sans-serif;
}

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

body {
  font-family: var(--font-main);
  background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Background animated objects */
.bg-shapes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.shape {
  position: absolute;
  filter: blur(80px);
  border-radius: 50%;
  animation: float 20s infinite alternate;
}

.shape-1 {
  width: 400px;
  height: 400px;
  background: rgba(37, 99, 235, 0.4);
  top: -100px;
  left: -100px;
}

.shape-2 {
  width: 500px;
  height: 500px;
  background: rgba(139, 92, 246, 0.3);
  bottom: -200px;
  right: -100px;
  animation-delay: -5s;
}

.shape-3 {
  width: 300px;
  height: 300px;
  background: rgba(16, 185, 129, 0.2);
  top: 40%;
  left: 60%;
  animation-delay: -10s;
}

@keyframes float {
  0% {
    transform: translateY(0) scale(1);
  }

  100% {
    transform: translateY(50px) scale(1.1);
  }
}

.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.app-header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-placeholder {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 100px;
  backdrop-filter: blur(10px);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, #60a5fa, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Glass panel */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transition: transform 0.3s ease;
}

.w-full {
  width: 100%;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
}

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

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.mt-4 {
  margin-top: 1.5rem;
}

.mb-4 {
  margin-bottom: 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 600px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.form-group small {
  display: block;
  margin-top: 0.25rem;
  color: #94a3b8;
  font-size: 0.8rem;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.2);
  color: white;
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s;
  outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: var(--primary-color);
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: inherit;
  font-size: 1rem;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.4);
  color: white;
}

.alert {
  padding: 1rem;
  border-radius: 0.75rem;
  margin-top: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-left: 4px solid var(--text-muted);
}

.alert.success {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.alert.danger {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.alert.warning {
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

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

.modal-content {
  background: var(--bg-gradient-start);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  transform: translateY(-20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.custom-modal-box {
  max-width: 450px;
  text-align: center;
}

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

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

.btn-close:hover {
  color: white;
}

.candidate-group {
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem;
  border-radius: 0.5rem;
}

.candidate-group h4 {
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.cand-input {
  width: 100%;
  margin-bottom: 0.5rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.flex-actions {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

/* Planchas UI */
.pl-item {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--glass-border);
}

.pl-item input {
  flex: 1;
}

.btn-remove {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: none;
  border-radius: 0.5rem;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  transition: 0.2s;
}

.btn-remove:hover {
  background: rgba(239, 68, 68, 0.4);
  color: white;
}

/* Acordeón de votación */
.block-section {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.block-header {
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.block-header h3 {
  font-size: 1.1rem;
}

.block-badge {
  background: var(--primary-color);
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
}

.block-body {
  padding: 1.5rem;
  display: none;
}

.block-body.open {
  display: block;
  animation: fadeIn 0.3s ease;
}

.voting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

/* Select styling (dark theme consistent) */
select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.2);
  color: white;
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23cbd5e1' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}

select:focus {
  border-color: var(--primary-color);
  background-color: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

select option {
  background: #1e293b;
  color: white;
}

/* Accordion chevron indicator */
.block-header::after {
  content: '▶';
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.block-header:has(+ .block-body.open)::after {
  transform: rotate(90deg);
}

/* Config header layout */
.config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Info small text */
.info-small {
  display: block;
  margin-top: 0.25rem;
  color: #94a3b8;
  font-size: 0.8rem;
}

/* Toast notifications */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font-main);
  color: var(--text-main);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
  max-width: 320px;
}

.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-hiding {
  opacity: 0;
  transform: translateX(100%);
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-info {
  border-left: 4px solid var(--primary-color);
}

.toast-warning {
  border-left: 4px solid var(--warning);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

/* Focus visible for keyboard accessibility */
.block-header:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

/* Imprimible */
.print-only {
  display: none;
}

/* Disclaimer (screen styles — must be outside @media print) */
.disclaimer-container {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--glass-border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.disclaimer-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  padding: 1rem;
  border-radius: 0.75rem;
  margin: 1.5rem 0;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  text-align: left;
}

.disclaimer-box svg {
  flex-shrink: 0;
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .no-print {
    display: none !important;
  }

  .print-only {
    display: block;
    color: black;
    background: white;
  }

  /* Show only the selected document */
  body[data-print-doc="acta"] #acta-imprimible {
    display: block !important;
  }

  body[data-print-doc="listado"] #listado-dignatarios {
    display: block !important;
  }

  body,
  html {
    background: white !important;
    color: black !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .bg-shapes {
    display: none !important;
  }

  .acta-container {
    padding: 2rem;
    font-family: Arial, sans-serif;
  }

  .acta-header {
    text-align: center;
    border-bottom: 2px solid black;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
  }

  .acta-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
  }

  .acta-table th,
  .acta-table td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: left;
  }

  .acta-table th {
    background: #f0f0f0;
  }

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

  .signature-box {
    border-top: 1px solid black;
    text-align: center;
    padding-top: 0.5rem;
  }

  /* Listado de dignatarios print styles */
  .listado-bloque {
    margin-bottom: 1.5rem;
    page-break-inside: avoid;
  }

  .listado-bloque h3 {
    background: #f0f0f0;
    padding: 0.5rem 0.75rem;
    border-left: 4px solid #2563eb;
    margin-bottom: 0.5rem;
    font-size: 1rem;
  }

  .listado-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
  }

  .listado-table th,
  .listado-table td {
    border: 1px solid #ccc;
    padding: 6px 10px;
    text-align: left;
    font-size: 0.9rem;
  }

  .listado-table th {
    background: #e5e7eb;
    font-weight: 600;
  }

  .listado-table tr:nth-child(even) {
    background: #f9fafb;
  }

  .listado-invalidado {
    background: #fef2f2;
    border: 2px solid #ef4444;
    color: #991b1b;
    padding: 0.75rem;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
    font-weight: bold;
    font-size: 0.9rem;
  }

  .print-disclaimer {
    display: block;
    font-size: 0.75rem;
    font-style: italic;
    color: #444;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    text-align: center;
  }
}