/* Este archivo define las variables de color para los temas claro y oscuro,
  y los estilos para el botón que permite cambiar entre ellos.
*/

:root {
  /* -- Tema Claro (Default) -- */
  --bg-color: #f0f2f5;
  --container-bg: #ffffff;
  --text-color: #495057;
  --header-color: #0056b3;
  --input-bg: #ffffff;
  --input-border: #ced4da;
  --tab-bg: #eee;
  --tab-active-bg: #ffffff;
  --preview-dashed-border: #ced4da;
  --preview-bg: #f8f9fa;
  --button-secondary-bg: #6c757d;
  --button-secondary-hover-bg: #5a6268;
  --h3-color: #495057;
  --p-color: #6c757d;
  --textarea-bg: #ffffff;
  --textarea-color: #333;
  --textarea-border: #ced4da;
}

html.dark-mode {
  /* -- Tema Oscuro -- */
  --bg-color: #121212;
  --container-bg: #1e1e1e;
  --text-color: #e0e0e0;
  --header-color: #82aaff;
  --input-bg: #2c2c2c;
  --input-border: #444444;
  --tab-bg: #2c2c2c;
  --tab-active-bg: #1e1e1e;
  --preview-dashed-border: #555555;
  --preview-bg: #2c2c2c;
  --button-secondary-bg: #5a6268;
  --button-secondary-hover-bg: #4a5258;
  --h3-color: #e0e0e0;
  --p-color: #a0a0a0;
  --textarea-bg: #2c2c2c;
  --textarea-color: #e0e0e0;
  --textarea-border: #444444;
}

/* Transiciones suaves para el cambio de tema */
body, .container, input, select, textarea, .tab-btn, .custom-file-upload, .open-gallery-btn, .preview-container, h1, h2, label, h3, p {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Botón para cambiar de tema */
#theme-switcher {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 45px;
  height: 45px;
  background-color: var(--container-bg);
  border: 1px solid var(--input-border);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  overflow: hidden;
}

#theme-switcher svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

#theme-switcher .sun-icon {
  display: none; /* Oculto por defecto */
  fill: #f39c12;
}

#theme-switcher .moon-icon {
  display: block; /* Visible por defecto (tema claro) */
  fill: var(--text-color);
}

html.dark-mode #theme-switcher .sun-icon {
  display: block;
}

html.dark-mode #theme-switcher .moon-icon {
  display: none;
}

/* Solución para el autocompletado del navegador en modo oscuro */
html.dark-mode input:-webkit-autofill,
html.dark-mode input:-webkit-autofill:hover,
html.dark-mode input:-webkit-autofill:focus,
html.dark-mode input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text-color) !important;
    -webkit-box-shadow: 0 0 0 30px var(--input-bg) inset !important;
    box-shadow: 0 0 0 30px var(--input-bg) inset !important;
    caret-color: var(--text-color) !important;
}

