/* Je Respire — Frontend styles */

/* ------------------------------------------------------------------ chart */

.jerespire-chart-block {
  margin: 2rem 0;
  font-family: inherit;
}

.jerespire-chart-title {
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  color: #1e293b;
  margin: 0 0 1rem;
  letter-spacing: 0.01em;
}

.jerespire-chart-container {
  position: relative;
  width: 100%;
}

.jerespire-chart-container canvas {
  max-height: 260px;
  width: 100% !important;
}

/* Legend */

.jerespire-chart-legend {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding: 0 0.25rem;
}

.jerespire-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.4;
}

.jerespire-legend-line {
  display: inline-block;
  flex-shrink: 0;
  width: 24px;
  height: 3px;
  border-radius: 2px;
}

.jerespire-legend-data {
  background-color: #2563eb;
}

.jerespire-legend-threshold {
  background-color: #ef4444;
}

/* Messages */

.jerespire-error,
.jerespire-no-data {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  margin: 1rem 0;
}

.jerespire-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.jerespire-no-data {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
  text-align: center;
}

/* ------------------------------------------------------------------ subscribe */

.jerespire-subscribe-wrap {
  margin: 1.5rem 0;
  text-align: center;
}

.jerespire-btn {
  display: inline-block;
  background-color: #1a2e4a;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.6rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  letter-spacing: 0.02em;
}

.jerespire-btn:hover,
.jerespire-btn:focus {
  background-color: #243d60;
  outline: none;
}

.jerespire-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #9ca3af !important;
}

.jerespire-subscribe-form-wrap {
  margin-top: 1rem;
}

.jerespire-subscribe-school {
  font-size: 0.9rem;
  color: #475569;
  margin-bottom: 0.75rem;
}

.jerespire-subscribe-fields {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.jerespire-email-input {
  padding: 0.6rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  font-size: 0.9rem;
  min-width: 240px;
  outline: none;
  transition: border-color 0.2s;
}

.jerespire-email-input:focus {
  border-color: #2563eb;
}

.jerespire-subscribe-message {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  min-height: 1.4em;
}

.jerespire-subscribe-message--success {
  color: #15803d;
}

.jerespire-subscribe-message--error {
  color: #b91c1c;
}

/* ------------------------------------------------------------------ unsubscribe */

.jerespire-unsubscribe-wrap {
  margin: 2rem 0;
}

.jerespire-notice {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.jerespire-notice--success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.jerespire-notice--info {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.jerespire-notice--error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.jerespire-confirm-box {
  text-align: center;
  padding: 1.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: inline-block;
}

.jerespire-confirm-message {
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  color: #1e293b;
}

.jerespire-confirm-form {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ manage subscriptions */

.jerespire-manage-subscriptions-wrap {
  margin: 1.5rem 0;
}

.jerespire-manage-form {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

#jr-email {
  padding: 0.6rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  font-size: 0.9rem;
  min-width: 240px;
  outline: none;
  transition: border-color 0.2s;
}

#jr-email:focus {
  border-color: #2563eb;
}

.jerespire-btn--primary {
  background-color: #ec4899;
}

.jerespire-btn--primary:hover,
.jerespire-btn--primary:focus {
  background-color: #db2777;
}

.jerespire-btn--danger {
  background-color: #b91c1c;
}

.jerespire-btn--danger:hover,
.jerespire-btn--danger:focus {
  background-color: #991b1b;
}

.jerespire-btn--secondary {
  background-color: #6b7280;
}

.jerespire-btn--secondary:hover,
.jerespire-btn--secondary:focus {
  background-color: #4b5563;
}

.jerespire-btn--small {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.jerespire-loading {
  text-align: center;
  padding: 2rem 1rem;
  color: #64748b;
}

.jerespire-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid #e2e8f0;
  border-top-color: #ec4899;
  border-radius: 50%;
  animation: jerespire-spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

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

.jerespire-subscriptions {
  margin-top: 1.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.jerespire-subscriptions h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  color: #1e293b;
}

#jr-schools-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.jr-school-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  gap: 1rem;
}

.jr-school-name {
  flex: 1;
  font-size: 0.95rem;
  color: #1e293b;
  font-weight: 500;
}

/* Modal */

.jerespire-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.jerespire-modal-content {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: 8px;
  max-width: 400px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.jerespire-modal-content p {
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  color: #1e293b;
}

.jerespire-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.jerespire-modal-actions .jerespire-btn {
  flex: 1;
}
