/* ===============================
   VARIABLES DE COLOR
=============================== */
:root {
  --primary: #007bff;
  --primary-dark: #0056b3;
  --accent: #28a745;
  --accent-dark: #1e7e34;
  --bg: #f3f6f9;
  --card-bg: #ffffff;
  --text: #333;
  --radius: 12px;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* ===============================
   MODO OSCURO
=============================== */
body.dark-mode {
  --bg: #121212;
  --card-bg: #1e1e1e;
  --text: #e5e5e5;
  --primary: #4dabf7;
  --primary-dark: #228be6;
  --accent: #37b24d;
  --accent-dark: #2f9e44;
}

/* ===============================
   BOTÓN MODO OSCURO
=============================== */
#modoBtn {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s;
  z-index: 999;
}
#modoBtn:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
}

/* ===============================
   ESTILO BASE
=============================== */
body {
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1100px;
  background: var(--card-bg);
  margin: 30px auto;
  padding: 30px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fadeIn 0.6s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

h1 {
  text-align: center;
  color: var(--primary);
  font-size: 2rem;
  margin-bottom: 10px;
}
.subtitle {
  text-align: center;
  color: #666;
  margin-bottom: 25px;
}

/* ===============================
   SECCIÓN DE IMÁGENES
=============================== */
.upload-section {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 25px;
}

.upload-card {
  flex: 1 1 320px;
  background: #f9fbfd;
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
}
.upload-card:hover {
  transform: translateY(-3px);
}
.upload-card label {
  font-weight: 600;
  display: block;
  margin-bottom: 8px;
  color: var(--primary-dark);
}
input[type="file"] {
  display: block;
  margin: 10px auto;
  cursor: pointer;
}
.preview {
  display: none;
  width: 100%;
  max-height: 250px;
  object-fit: contain;
  border-radius: 8px;
  margin-top: 10px;
  border: 2px solid #ddd;
  transition: transform 0.3s ease;
  cursor: zoom-in;
}

/* ===============================
   BOTONES
=============================== */
button {
  width: 100%;
  padding: 12px;
  margin-top: 25px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: var(--shadow);
}
#btnProcesar {
  background: var(--primary);
  color: white;
}
#btnProcesar:hover {
  background: var(--primary-dark);
}
#btnEnviar {
  background: var(--accent);
  color: white;
}
#btnEnviar:hover {
  background: var(--accent-dark);
}

/* ===============================
   FORMULARIO
=============================== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin-top: 20px;
}
label {
  display: block;
  margin-top: 10px;
  font-weight: 600;
}
input[type="text"] {
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: 0.2s;
}
input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 4px rgba(0, 123, 255, 0.3);
  outline: none;
}

/* ===============================
   LOADER
=============================== */
.loader {
  text-align: center;
  margin-top: 30px;
}
.spinner {
  border: 5px solid #f3f3f3;
  border-top: 5px solid var(--primary);
  border-radius: 50%;
  width: 45px;
  height: 45px;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===============================
   MENSAJES Y FOOTER
=============================== */
.mensaje {
  margin-top: 25px;
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
}
footer {
  text-align: center;
  margin: 30px 0 15px;
  color: #777;
  font-size: 0.9rem;
}
footer span {
  color: var(--primary-dark);
  font-weight: 600;
}
/* ===============================
   FOOTER FIJO (Sticky Footer)
=============================== */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  background: var(--card-bg);
  color: #777;
  font-size: 0.9rem;
  padding: 10px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.05);
  z-index: 100;
}

footer span {
  color: var(--primary-dark);
  font-weight: 600;
}

/* Versión modo oscuro */
body.dark-mode footer {
  background: #181818;
  color: #aaa;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -3px 10px rgba(255, 255, 255, 0.05);
}

body.dark-mode footer span {
  color: var(--primary);
}

/* ===============================
   DISEÑO DE IMÁGENES LADO A LADO
=============================== */
.upload-section {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  margin-bottom: 25px;
}

.upload-card {
  flex: 1 1 45%;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: center;
  transition: transform 0.3s ease;
}

.upload-card:hover {
  transform: translateY(-4px);
}

.image-container {
  position: relative;
  display: inline-block;
  width: 100%;
}

/* ===============================
   MARCO Y ZOOM MEJORADO
=============================== */
.img-wrapper {
  position: relative;
  width: 100%;
  height: auto;
  border-radius: 14px;
  overflow: hidden;
  background: #fafafa;
  border: 2px solid #ddd;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
}

body.dark-mode .img-wrapper {
  background: #1e1e1e;
  border: 2px solid #444;
  box-shadow: 0 4px 10px rgba(255, 255, 255, 0.05);
}

.preview {
  display: none;
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  cursor: zoom-in;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  transform-origin: center center;
}

/* Zoom centrado, sin desplazamiento */
.preview.zoomed {
  transform: scale(1.9);
  cursor: zoom-out;
  z-index: 5;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.3);
}

body.dark-mode .preview.zoomed {
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.1);
}


/* Botón rotar */
.rotate-btn {
  position: absolute;
  top: 5px;
  right: 10px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 17px;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 10;
  transition: transform 0.3s ease, background 0.3s ease;
}

.rotate-btn:hover {
  background: var(--primary-dark);
  transform: rotate(45deg);
}

body.dark-mode .rotate-btn {
  background: #339af0;
}
body.dark-mode .rotate-btn:hover {
  background: #1c7ed6;
}

/* Adaptación móvil */
@media (max-width: 768px) {
  .upload-card {
    flex: 1 1 100%;
  }
}
/* ===============================
   📱 DISEÑO RESPONSIVE MOVIL / TABLET
=============================== */

/* Pantallas medianas (tablets y horizontales pequeñas) */
@media (max-width: 900px) {
  .upload-section {
    flex-direction: column;
    align-items: center;
    gap: 25px;
  }

  .upload-card {
    width: 90%;
    flex: none;
    margin-bottom: 15px;
  }

  .img-wrapper {
    max-height: 360px;
  }

  .preview {
    max-height: 320px;
  }

  .rotate-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
    top: 10px;
    right: 12px;
  }
}

/* Pantallas pequeñas (smartphones) */
@media (max-width: 600px) {
  .upload-section {
    flex-direction: column;
    width: 100%;
    gap: 20px;
  }

  .upload-card {
    width: 95%;
    padding: 15px;
  }

  .preview {
    max-height: 280px;
    border-radius: 10px;
  }

  .img-wrapper {
    border-radius: 10px;
    border: 1.5px solid #ccc;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  }

  body.dark-mode .img-wrapper {
    border: 1.5px solid #444;
    box-shadow: 0 3px 10px rgba(255, 255, 255, 0.05);
  }

  .rotate-btn {
    width: 34px;
    height: 34px;
    font-size: 16px;
    top: 8px;
    right: 8px;
  }

  button, #btnProcesar, #btnEnviar {
    font-size: 0.9rem;
    padding: 10px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }
}

/* Muy pequeñas (≤ 400px) */
@media (max-width: 400px) {
  .preview {
    max-height: 240px;
  }

  .rotate-btn {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }

  h1 {
    font-size: 1.3rem;
  }

  .container {
    margin: 10px;
    padding: 15px;
  }

  footer {
    font-size: 0.8rem;
  }
}
