/* ==========================================================================
   Concurso de Presépios - Natal na Usina
   Estilos CSS Principais
   ========================================================================== */

:root {
  --primary-color: #0d6efd;
  --primary-hover: #0b5ed7;
  --secondary-color: #6c757d;
  --secondary-hover: #5c636a;
  --success-color: #198754;
  --danger-color: #dc3545;
  --dark-color: #212529;
  --light-bg: #f8f9fa;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-muted: #64748b;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --radius: 6px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--light-bg);
  color: var(--dark-color);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  flex: 1;
}

/* ==========================================================================
   Header
   ========================================================================== */
.header-section {
  text-align: center;
  margin-bottom: 32px;
  padding-top: 10px;
}

.header-logo-container {
  display: inline-block;
  margin-bottom: 16px;
}

.header-logo {
  max-height: 96px;
  max-width: 240px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.header-title {
  font-size: 1.55rem;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}

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

/* ==========================================================================
   Grid de Presépios (Cards)
   ========================================================================== */
.presepios-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 48px;
}

.presepio-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.presepio-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.presepio-img-wrapper {
  position: relative;
  width: 100%;
  padding-top: 75%; /* Proporção 4:3 */
  background: #500808; /* Tom avermelhado elegante de fundo igual às fotos */
  overflow: hidden;
  cursor: zoom-in;
}

.presepio-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}

.presepio-card:hover .presepio-img {
  transform: scale(1.03);
}

.presepio-content {
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  text-align: center;
}

.presepio-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 6px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.presepio-autor {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.presepio-actions {
  margin-top: auto;
}

.btn-votar {
  width: 100%;
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.btn-votar:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.btn-votar:active {
  transform: scale(0.98);
}

/* ==========================================================================
   Modal de Votação (Confirmar Votação)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 16px;
}

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

.modal-container {
  background: #ffffff;
  border-radius: 8px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #1e293b;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.modal-close-btn:hover {
  color: #334155;
  background-color: #f1f5f9;
}

.modal-body {
  padding: 20px 24px;
}

.modal-question {
  font-size: 1.15rem;
  color: #334155;
  margin-bottom: 4px;
}

.modal-presepio-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 24px;
  line-height: 1.3;
}

.form-group {
  margin-bottom: 8px;
}

.form-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  font-size: 1.05rem;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  color: #0f172a;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.2);
}

.form-control.is-invalid {
  border-color: var(--danger-color);
  background-color: #fff8f8;
}

.form-helper {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.modal-feedback {
  display: none;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.modal-feedback.danger {
  display: block;
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.modal-feedback.warning {
  display: block;
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px 20px;
  background-color: #ffffff;
}

.btn-cancelar {
  background-color: #5a6268;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 9px 20px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-cancelar:hover {
  background-color: #495057;
}

.btn-confirmar {
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 9px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.2s ease;
}

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

.btn-confirmar:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Spinner animado no botão confirmar */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Modal de Sucesso
   ========================================================================== */
.success-modal {
  text-align: center;
  padding: 24px 20px;
}

.success-icon-wrapper {
  width: 64px;
  height: 64px;
  background-color: #dcfce7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: #16a34a;
  font-size: 32px;
}

.success-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}

.success-desc {
  font-size: 0.95rem;
  color: #475569;
  margin-bottom: 24px;
  line-height: 1.5;
}

.btn-success-ok {
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 10px 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

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

/* ==========================================================================
   Footer & Patrocinadores
   ========================================================================== */
.footer-section {
  text-align: center;
  padding: 36px 20px 28px;
  margin-top: 40px;
  border-top: 1px solid var(--border-color);
  background-color: #ffffff;
}

.footer-sponsors-container {
  max-width: 1250px;
  margin: 0 auto 16px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-sponsors {
  max-width: 1180px;
  width: 100%;
  height: auto;
  margin: 0 auto;
  display: block;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}

.footer-text {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 12px;
  letter-spacing: 0.2px;
}

/* ==========================================================================
   Responsividade
   ========================================================================== */
@media (max-width: 900px) {
  .presepios-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
}

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

  .header-title {
    font-size: 1.3rem;
  }

  .modal-container {
    max-width: 100%;
  }

  .modal-presepio-name {
    font-size: 1.2rem;
  }

  .modal-footer {
    padding: 14px 16px 16px;
  }
}

/* ==========================================================================
   Lightbox / Ampliação da Imagem do Presépio
   ========================================================================== */
.presepio-img-wrapper {
  cursor: pointer;
}

.presepio-img {
  cursor: pointer;
}

.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(5, 5, 5, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex !important;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 20px;
  box-sizing: border-box;
}

.lightbox-overlay.active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.lightbox-container {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-overlay.active .lightbox-container {
  transform: scale(1);
}

.lightbox-image {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  background: #000;
}

.lightbox-caption {
  margin-top: 14px;
  text-align: center;
  color: #f8fafc;
}

.lightbox-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.lightbox-autor {
  font-size: 0.95rem;
  color: #cbd5e1;
}

.lightbox-close-btn {
  position: absolute;
  top: -44px;
  right: 0;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.lightbox-close-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.08);
}
