/* Reset y base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background: url("assets/bg-login.jpg");
  background-size: fill;
  background-position: center;
  background-repeat: repeat;
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  color: rgb(0, 0, 0);
  margin-bottom: 30px;
  padding: 20px 0;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  text-align: center;
}

header h2 {
  font-size: 1.5rem;
  font-weight: 400;
  color: rgb(200, 200, 200);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);

  opacity: 0.9;
}

.content {
  flex: 1;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  padding: 40px;
  margin-bottom: 20px;
}

/* Success Container */
.success-container {
  text-align: center;
}

.certificate-header {
  margin-bottom: 30px;
}

.success-icon {
  font-size: 2rem;
  margin-bottom: 15px;
}

.certificate-header h3 {
  color: #046c1c;
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.certificate-header code {
  background: #faf9f8;
  padding: 8px 16px;
  border-radius: 6px;
  font-family: "Courier New", monospace;
  color: #be5c00;
  border: 1px solid #dee2e6;
}

/* Certificate Display */
.certificate-container {
  margin: 30px 0;
  padding: 20px;
  border: 3px solid #033505;
  border-radius: 12px;
  background: #f8f9fa;
  position: relative;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.certificate-image {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;

  /* Marco sofisticado estilo diploma clásico */
  border: 20px solid transparent;
  background:
    linear-gradient(white, white) padding-box,
    linear-gradient(45deg, #0e6b38, #1a8a4a, #094e27, #0d5c30) border-box;
  box-shadow:
    0 0 0 2px #042d17,
    0 0 0 6px #094e27,
    0 0 0 8px #042d17,
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 0 0 3px rgba(26, 138, 74, 0.4);
}

.certificate-image:hover {
  transform: scale(1.02);
}

.zoomable-image {
  cursor: pointer;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.zoomable-image:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 0 2px #042d17,
    0 0 0 6px #094e27,
    0 0 0 8px #042d17,
    0 12px 40px rgba(0, 0, 0, 0.6),
    inset 0 0 0 3px rgba(26, 138, 74, 0.6);
}

/* ============= ESTILOS PDF.js ============= */

/* Spinner de carga */
.pdf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #033505;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f8f9fa;
  border-top: 4px solid #033505;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.pdf-loading p {
  font-size: 1rem;
  color: #033505;
  text-align: center;
}

/* Contenedor PDF principal */
.pdf-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
}

.pdf-canvas {
  max-width: 100%;
  height: auto;
  cursor: pointer;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.zoomable-pdf:hover {
  transform: scale(1.02);
}

/* Sección de descarga PDF */
.pdf-download-section {
  margin-top: 20px;
  text-align: center;
  padding: 15px;
  background: rgba(3, 53, 5, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(3, 53, 5, 0.1);
}

.pdf-download-btn {
  display: inline-block;
  background: linear-gradient(135deg, #033505, #046c1c);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(3, 53, 5, 0.3);
}

.pdf-download-btn:hover {
  background: linear-gradient(135deg, #046c1c, #0a8c23);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(3, 53, 5, 0.4);
  color: white;
  text-decoration: none;
}

/* Error de PDF */
.pdf-error {
  padding: 40px;
  color: #dc3545;
  font-size: 1.2rem;
  text-align: center;
}

.error-fallback {
  margin-top: 10px;
  font-size: 1rem;
}

.error-fallback a {
  color: #0021b3;
  text-decoration: underline;
}

/* Modal PDF */
.modal-pdf-canvas {
  max-width: 95%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 16px;
  animation: zoomIn 0.3s ease;

  /* Marco Art Deco para modal PDF */
  border: 30px solid transparent;
  background:
    linear-gradient(white, white) padding-box,
    linear-gradient(
        135deg,
        #2c3e50,
        #34495e,
        #bdc3c7,
        #ecf0f1,
        #f39c12,
        #e67e22
      )
      border-box;
  box-shadow:
    0 0 0 3px #2c3e50,
    0 0 0 6px #f39c12,
    0 0 0 9px #2c3e50,
    0 0 0 12px #bdc3c7,
    0 0 0 15px #2c3e50,
    0 16px 50px rgba(44, 62, 80, 0.7),
    inset 0 0 0 4px rgba(243, 156, 18, 0.4);
}

.modal-error {
  color: white;
  background: rgba(220, 53, 69, 0.9);
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  margin: 20px;
}

.image-error {
  padding: 40px;
  color: #dc3545;
  font-size: 1.2rem;
}

/* Certificate Info */
.certificate-info {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid #00152a;
  margin-top: 20px;
  text-align: left;
}

.certificate-info p {
  margin-bottom: 8px;
  font-size: 1rem;
}

.certificate-info strong {
  color: #011222;
}

/* Error Container */
.error-container {
  text-align: center;
  color: #dc3545;
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.error-container h3 {
  font-size: 2rem;
  margin-bottom: 15px;
}

.error-detail {
  background: #f8d7da;
  color: #721c24;
  padding: 12px;
  border-radius: 6px;
  margin: 15px 0;
  border: 1px solid #f5c6cb;
}

.help {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
  text-align: left;
  color: #856404;
}

.help h4 {
  margin-bottom: 10px;
  color: #856404;
}

.help ul {
  padding-left: 20px;
}

.help li {
  margin-bottom: 5px;
}

/* Top navigation */
.top-navigation {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1000;
}

.home-btn-top {
  display: inline-block;
  padding: 10px 20px;
  background: linear-gradient(135deg, #094e27 0%, #062010 100%);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 3px 10px rgba(9, 78, 39, 0.3);
  transition: all 0.3s ease;
}

.home-btn-top:hover {
  background: linear-gradient(135deg, #062010 0%, #094e27 100%);
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(9, 78, 39, 0.4);
}

/* Navigation buttons */
.navigation-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 30px;
  margin-bottom: 20px;
}

.nav-btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  min-width: 180px;
}

.home-btn {
  background: linear-gradient(135deg, #094e27 0%, #062010 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(9, 78, 39, 0.3);
}

.home-btn:hover {
  background: linear-gradient(135deg, #062010 0%, #094e27 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(9, 78, 39, 0.4);
}

.nav-btn:active {
  transform: translateY(0);
}

/* Footer */
footer {
  text-align: center;
  color: rgb(0, 0, 0);
  padding: 20px 0;
  opacity: 0.8;
  font-size: 0.9rem;
}

footer a {
  color: #0021b3;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 15px;
    padding-top: 20px;
  }

  /* Top Navigation Mobile - Make it part of flow, not fixed */
  .top-navigation {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    text-align: center;
    margin-bottom: 15px;
    padding: 0;
  }

  .home-btn-top {
    padding: 10px 20px;
    font-size: 13px;
    display: inline-block;
    width: auto;
  }

  /* Header Mobile Fix */
  header {
    text-align: center;
    padding: 10px 10px;
    margin-bottom: 15px;
  }

  header h1 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 8px;
    line-height: 1.3;
  }

  header h2 {
    font-size: 1.1rem;
    text-align: center;
  }

  .content {
    padding: 20px 15px;
  }

  /* Certificate Header Mobile */
  .certificate-header {
    padding: 0 10px;
  }

  .certificate-header h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
  }

  .certificate-header p {
    font-size: 0.9rem;
    word-break: break-all;
  }

  /* UUID Code Mobile - Prevent overflow */
  .certificate-header code {
    display: inline-block;
    max-width: 100%;
    word-break: break-all;
    font-size: 0.75rem;
    padding: 6px 10px;
    overflow-wrap: break-word;
  }

  /* Certificate Info Mobile */
  .certificate-info {
    padding: 15px;
  }

  .certificate-info p {
    font-size: 0.9rem;
  }

  /* Error Container Mobile */
  .error-container h3 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
    padding-top: 15px;
  }

  /* Top Navigation - smaller screens */
  .top-navigation {
    margin-bottom: 12px;
  }

  .home-btn-top {
    padding: 8px 16px;
    font-size: 12px;
  }

  header {
    padding: 8px 5px;
    margin-bottom: 12px;
  }

  header h1 {
    font-size: 1.25rem;
  }

  header h2 {
    font-size: 0.9rem;
  }

  .content {
    padding: 15px 10px;
    border-radius: 8px;
  }

  .certificate-header h3 {
    font-size: 1.1rem;
  }

  .certificate-header code {
    font-size: 0.65rem;
    padding: 5px 8px;
  }

  .certificate-container {
    padding: 10px;
    margin: 15px 0;
  }

  .certificate-info {
    padding: 12px;
    margin-top: 15px;
  }

  .certificate-info p {
    font-size: 0.85rem;
    margin-bottom: 6px;
  }

  /* PDF Download Button Mobile */
  .pdf-download-section {
    padding: 10px;
  }

  .pdf-download-btn {
    padding: 10px 18px;
    font-size: 0.9rem;
  }

  /* Footer Mobile */
  footer {
    font-size: 0.8rem;
    padding: 15px 10px;
  }
}

/* Modal de zoom para certificados */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
  overflow: hidden;
}

.modal-content {
  position: relative;
  max-width: 95%;
  max-height: 95%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal-image {
  max-width: 95%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 6px;
  animation: zoomIn 0.3s ease;

  /* Marco Art Deco para modal - versión ampliada */
  border: 30px solid transparent;
  background:
    linear-gradient(white, white) padding-box,
    linear-gradient(
        135deg,
        #035917,
        #035917ba,
        #bdc7c1,
        #ecf1ed,
        #f39c12,
        #e67e22
      )
      border-box;
  box-shadow:
    0 0 0 3px #2c3e50,
    0 0 0 6px #f39c12,
    0 0 0 9px #2c3e50,
    0 0 0 12px #bdc3c7,
    0 0 0 15px #2c3e50,
    0 16px 50px rgba(44, 62, 80, 0.7),
    inset 0 0 0 4px rgba(243, 156, 18, 0.4);
}

.close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 35px;
  font-weight: bold;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5);
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
}

.close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-caption {
  color: white;
  text-align: center;
  margin-top: 15px;
  font-size: 14px;
  opacity: 0.8;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============= ESTILOS DE MARCOS ALTERNATIVOS ============= */

/* Opción 1: Marco Victoriano Ornamentado */
.victorian-frame {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  cursor: pointer;

  border: 25px solid transparent;
  background:
    linear-gradient(white, white) padding-box,
    repeating-linear-gradient(
        45deg,
        #094e27 0px,
        #0e6b38 8px,
        #1a6b3a 16px,
        #1a8a4a 24px
      )
      border-box;
  box-shadow:
    0 0 0 3px #031d0f,
    0 0 0 6px #042d17,
    0 0 0 12px #031d0f,
    0 0 20px 5px rgba(9, 78, 39, 0.4),
    inset 0 0 0 4px rgba(26, 138, 74, 0.5),
    inset 20px 20px 30px -15px rgba(46, 125, 82, 0.5),
    inset -20px -20px 30px -15px rgba(9, 78, 39, 0.5);
}

.victorian-frame:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 0 3px #031d0f,
    0 0 0 6px #042d17,
    0 0 0 12px #031d0f,
    0 0 30px 8px rgba(9, 78, 39, 0.6),
    inset 0 0 0 4px rgba(26, 138, 74, 0.7),
    inset 20px 20px 30px -15px rgba(46, 125, 82, 0.7),
    inset -20px -20px 30px -15px rgba(9, 78, 39, 0.7);
}

/* Opción 2: Marco Art Deco */
.artdeco-frame {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  cursor: pointer;

  border: 20px solid transparent;
  background:
    linear-gradient(white, white) padding-box,
    linear-gradient(
        135deg,
        #035917,
        #035917ba,
        #bdc7c1,
        #ecf1ed,
        #f39c12,
        #e67e22
      )
      border-box;
  box-shadow:
    0 0 0 2px #033859,
    0 0 0 4px #f39c12,
    0 0 0 6px #035917,
    0 0 0 8px #bdc3c7,
    0 0 0 10px #033959,
    0 8px 25px rgba(11, 71, 12, 0.4),
    inset 0 0 0 3px rgba(243, 156, 18, 0.3);
}

.artdeco-frame:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 0 2px #2c3e50,
    0 0 0 4px #f39c12,
    0 0 0 6px #2c3e50,
    0 0 0 8px #bdc3c7,
    0 0 0 10px #2c3e50,
    0 12px 35px rgba(44, 62, 80, 0.6),
    inset 0 0 0 3px rgba(243, 156, 18, 0.5);
}

/* Opción 3: Marco Sello Académico */
.academic-frame {
  max-width: 100%;
  height: auto;
  border-radius: 50%;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  cursor: pointer;

  border: 30px solid transparent;
  background:
    linear-gradient(white, white) padding-box,
    radial-gradient(circle, #1a237e, #283593, #3949ab, #5c6bc0) border-box;
  box-shadow:
    0 0 0 4px #0d47a1,
    0 0 0 8px #1565c0,
    0 0 0 12px #0d47a1,
    0 0 0 16px #bbdefb,
    0 0 0 18px #0d47a1,
    0 10px 40px rgba(26, 35, 126, 0.5),
    inset 0 0 0 6px rgba(92, 107, 192, 0.3),
    inset 0 0 30px rgba(26, 35, 126, 0.2);
}

.academic-frame:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 0 4px #0d47a1,
    0 0 0 8px #1565c0,
    0 0 0 12px #0d47a1,
    0 0 0 16px #bbdefb,
    0 0 0 18px #0d47a1,
    0 15px 50px rgba(26, 35, 126, 0.7),
    inset 0 0 0 6px rgba(92, 107, 192, 0.5),
    inset 0 0 40px rgba(26, 35, 126, 0.3);
}

/* Opción 4: Marco Verde Premium y Oro */
.wood-gold-frame {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  cursor: pointer;

  border: 35px solid transparent;
  background:
    linear-gradient(white, white) padding-box,
    linear-gradient(
        45deg,
        #042d17,
        #094e27,
        #0e6b38,
        #3e9968,
        #ffd700,
        #ffb300,
        #ff8f00
      )
      border-box;
  box-shadow:
    0 0 0 3px #031d0f,
    0 0 0 6px #ffd700,
    0 0 0 9px #031d0f,
    0 0 0 12px #3e9968,
    0 0 0 15px #031d0f,
    0 12px 45px rgba(4, 45, 23, 0.6),
    inset 0 0 0 5px rgba(255, 215, 0, 0.4),
    inset 25px 25px 40px -20px rgba(62, 153, 104, 0.7),
    inset -25px -25px 40px -20px rgba(4, 45, 23, 0.8);
}

.wood-gold-frame:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 0 3px #031d0f,
    0 0 0 6px #ffd700,
    0 0 0 9px #031d0f,
    0 0 0 12px #3e9968,
    0 0 0 15px #031d0f,
    0 18px 55px rgba(4, 45, 23, 0.8),
    inset 0 0 0 5px rgba(255, 215, 0, 0.6),
    inset 25px 25px 40px -20px rgba(62, 153, 104, 0.9),
    inset -25px -25px 40px -20px rgba(4, 45, 23, 1);
}

/* Opción 5: Marco Lujo Minimalista Moderno */
.modern-luxury-frame {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  cursor: pointer;

  border: 18px solid transparent;
  background:
    linear-gradient(white, white) padding-box,
    linear-gradient(
        135deg,
        #263238,
        #37474f,
        #546e7a,
        #78909c,
        #b0bec5,
        #eceff1
      )
      border-box;
  box-shadow:
    0 0 0 1px #263238,
    0 0 0 2px #b0bec5,
    0 0 0 3px #263238,
    0 6px 20px rgba(38, 50, 56, 0.3),
    inset 0 0 0 2px rgba(176, 190, 197, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.8),
    inset 0 -2px 4px rgba(38, 50, 56, 0.2);
}

.modern-luxury-frame:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 0 1px #263238,
    0 0 0 2px #b0bec5,
    0 0 0 3px #263238,
    0 10px 30px rgba(38, 50, 56, 0.5),
    inset 0 0 0 2px rgba(176, 190, 197, 0.7),
    inset 0 3px 6px rgba(255, 255, 255, 0.9),
    inset 0 -3px 6px rgba(38, 50, 56, 0.3);
}

/* Responsive para PDF y modal */
@media (max-width: 768px) {
  .certificate-container {
    padding: 15px;
    min-height: 300px;
  }

  .pdf-canvas {
    max-width: 100%;
  }

  .modal-pdf-canvas {
    max-height: 80vh;
    border: 20px solid transparent;
  }

  .download-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  .close {
    top: 10px;
    right: 10px;
    font-size: 28px;
    width: 40px;
    height: 40px;
  }

  .modal-caption {
    font-size: 12px;
    margin-top: 10px;
  }

  .spinner {
    width: 30px;
    height: 30px;
  }

  .pdf-loading p {
    font-size: 0.9rem;
  }

  .artdeco-frame {
    border: 10px solid transparent;
  }
}

@media (max-width: 480px) {
  .certificate-container {
    padding: 10px;
    min-height: 250px;
  }

  .modal-pdf-canvas {
    border: 15px solid transparent;
  }

  .download-btn {
    padding: 8px 16px;
    font-size: 0.8rem;
  }

  .pdf-loading {
    padding: 30px;
  }
}
