@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
html {
  scroll-behavior: smooth;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  background-color: #f5f7fa;
  min-height: 100vh;
  font-family: "Poppins", sans-serif;
  overflow-x: hidden;
}

/* Impedisci lo scroll orizzontale e lo zoom */
html,
body {
  max-width: 100vw;
  overflow-x: hidden;
  touch-action: pan-y;
}
body {
  overscroll-behavior-x: none;
}

/* Disabilita lo zoom su mobile */

/* --- Fine responsive --- */

header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 20px 20px;
}
main {
  max-width: 920px;
  margin: 0 auto;
}
#title {
  display: flex;
  align-items: center;
}
#title .logo {
  height: 75px;
  margin-right: 10px;
}
#title h1 {
  font-size: 24px;
  font-weight: 600;
}
#navbar {
  display: flex;
  align-items: center;
  margin-right: 20px;
}
#navbar a {
  text-decoration: none;
  color: inherit;
}
#navbar a:visited {
  text-decoration: none;
}
#navbar ul {
  display: flex;
  list-style: none;
  gap: 20px;
  margin-right: 20px;
}
#navbar li {
  margin-right: 20px;
  transition: all 0.3s ease;
  font-size: 1.2rem;
}
#navbar li:hover {
  color: #0056b3;
  cursor: pointer;
}
#navbar li::after {
  content: "";
  display: block;
  width: 100%;
  height: 2px;
  background: #088ff0;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}
#navbar li:hover::after {
  transform: scaleX(1);
}
#navbar button {
  margin-left: auto;
  padding: 10px 20px;
  background-color: #088ff0;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: "Poppins", sans-serif;
  transition: all 0.3s ease;
}
#navbar button:hover {
  background-color: #0056b3;
}

/* UPLOAD SECTION */
#uploadSection {
  padding: 20px;

  border-radius: 5px;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-self: center;
  text-align: center;
}
#uploadSection h2 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  font-weight: 500;
}

.file-drop {
  display: flex;
  flex-direction: column;

  min-height: 300px;
  gap: 16px;
  align-items: center;

  border: 2px dashed rgba(8, 143, 240, 0.35);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(8, 143, 240, 0.03), transparent);
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
  max-height: 700px;
  overflow-y: auto;
}

.file-drop:hover,
.file-drop:focus-within {
  border-color: rgba(8, 143, 240, 0.65);
  box-shadow: 0 6px 18px rgba(8, 143, 240, 0.06);
  transform: translateY(-1px);
}

.file-drop__icon {
  height: 125px;
}

/* Text block */
.file-drop__text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-drop__title {
  display: block;
  font-size: 1.5rem;
  line-height: 1.1;
  color: #0b2540;
  font-weight: 500;
}
#fileInput {
  display: none;
}
.file-drop__supported {
  color: #0b6fe0;
  font-weight: 600;
}
/* File Uploaded */
#labelContainer.dragover {
  background: rgba(13, 110, 253, 0.08);
  border-color: #0d6efd;
  transform: scale(1.05);
  box-shadow: 0 0 18px rgba(13, 110, 253, 0.4);
}
.imageContainer {
  position: relative;
  max-width: 100%;
}
.pdfContainer {
  max-width: 100%;
  position: relative;
}
.labelImg {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
.imageContainer .closeButton,
.textContainer .closeButton,
.pdfContainer .closeButton {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.6); /* sfondo scuro semitrasparente */
  color: white; /* X bianca */
  border: none;
  border-radius: 10px; /* forma rotonda */
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.imageContainer .closeButton:hover,
.textContainer .closeButton:hover,
.pdfContainer .closeButton:hover {
  background-color: rgba(255, 0, 0, 0.8); /* rosso al passaggio */
  transform: scale(1.1); /* leggero ingrandimento */
}
#fileDropTitleContainer.hidden {
  display: none;
}

.textContainer {
  position: relative;
  width: 95%;
  margin: 0 auto;
  padding: 12px 16px;
  border: 1px solid #eee;
  border-radius: 8px;
  background-color: #f9f9f9;
  margin-top: 12px;
  font-size: 1.2rem;
}
/* Scroll bar Style */
.file-drop::-webkit-scrollbar {
  width: 12px;
}

.file-drop::-webkit-scrollbar-track {
  background: rgba(8, 143, 240, 0.05);
  border-radius: 12px;
}

.file-drop::-webkit-scrollbar-thumb {
  background: rgba(8, 143, 240, 0.35);
  border-radius: 12px;
  border: 3px solid rgba(8, 143, 240, 0.05);
  transition: background 0.3s ease;
}

.file-drop::-webkit-scrollbar-thumb:hover {
  background: rgba(8, 143, 240, 0.6);
}

/* Scrollbar per Firefox */
.file-drop {
  scrollbar-width: thin;
  scrollbar-color: rgba(8, 143, 240, 0.35) rgba(8, 143, 240, 0.05);
}
/*  OUTPUT SECTION */

#outputSection {
  padding: 20px;
  border-radius: 5px;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
#outputSection #btnContainer {
  display: flex;
  gap: 10px;
}
#btnContainer button {
  padding: 10px 20px;

  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: "Poppins", sans-serif;
  transition: all 0.3s ease;
  font-size: 1.1rem;
}
#btnContainer #extractTextButton {
  background-color: #088ff0;
  color: white;
}
#btnContainer #extractTextButton:hover {
  background-color: #0056b3;
}
#btnContainer #summarizeTextButton {
  color: black;
  background-color: #eef1f6;
}
#btnContainer #summarizeTextButton:hover {
  background-color: #d1d9df;
}
#previewContainer {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
#outputSection #previewTextContainer,
#outputSection #previewSummaryContainer {
  width: 100%;
  margin-top: 12px;
  padding: 12px 16px 4rem 16px;
  border: 1px solid #eee;
  border-radius: 8px;
  background-color: #f9f9f9;
  position: relative;
}
#previewTextContainer p,
#previewSummaryContainer p {
  margin-bottom: 20px;
  font-size: 1.3rem;
}

#extractedTextPreview,
#summaryTextPreview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.text-placeholder {
  height: 1.2em; /* altezza della riga */
  width: 100%;
  /* larghezza massima della riga */
  background-color: #ccc; /* grigio chiaro */
  border-radius: 4px;
  opacity: 0.5;
  position: relative;
  overflow: hidden;
}
.text-placeholder.hidden {
  display: none;
}

#summaryTextPreview .shimmer::after,
#extractedTextPreview .shimmer::after {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  height: 100%;
  width: 50%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 1s infinite;
}

@keyframes shimmer {
  0% {
    left: -150%;
  }
  100% {
    left: 150%;
  }
}

/* Container dei testi estratti */
#extractedTextContainer {
  display: flex;
  flex-direction: column;
  gap: 12px;

  position: relative;
}

.textBlock {
  border: 1px solid #ddd;
  padding: 12px;
  border-radius: 10px;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.2s ease;
  position: relative;
}

.textBlock:hover {
  transform: scale(1.01);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.textContent {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  color: #333;
}
.deleteButton {
  background-color: rgba(244, 67, 54, 0.5);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background-color 0.2s;
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: "Poppins", sans-serif;
}
.deleteButton i {
  font-size: 16px;
}

.deleteButton:hover {
  background-color: #c62828;
}

.buttonsContainer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.buttonsContainer button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background-color: #088ff0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, transform 0.2s;
}

.buttonsContainer button:hover {
  background-color: #006fc3;
  transform: scale(1.1);
}

.buttonsContainer button svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

#finalizeTextButton {
  position: absolute;
  bottom: 10px;
  right: 20px;
  background-color: #4caf50;
  padding: 10px 20px;
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
  border-radius: 10px;
  border: none;
  color: white;
}
#finalizeTextButton:hover {
  background-color: #388e3c;
  cursor: pointer;
}
#finalizeTextButton.hidden {
  display: none;
}

#ocrLogger {
  position: fixed;
  top: 10px;
  left: 10px;
  width: 220px;
  background-color: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 10px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.85rem;
  z-index: 9999;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

#ocrProgressBar {
  width: 0%;
  height: 6px;
  background-color: #4caf50;
  border-radius: 3px;
  margin-bottom: 5px;
  transition: width 0.2s ease;
}

#ocrLogText {
  margin: 0;
}

#summaryLogger {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  max-width: 300px;
  max-height: 200px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-family: monospace;
  font-size: 0.9rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  z-index: 9999;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#summaryLogger div {
  margin-bottom: 0.3rem;
}

.copyButton {
  background-color: #088ff0;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-family: "Poppins", sans-serif;
}

.copyButton:hover {
  background-color: #006fc3;
}
.textContentSummary {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  color: #333;
}

/* Stile generale del footer */

/* Paragrafi */

#infoSection #infoTitle {
  font-size: 1.2rem;
  color: #4ea1d3;
}
#infoSection #aboutVisio {
  font-size: 1rem;
}

/* Lista contatti e social */
#infoSection {
  background-color: #0f3460; /* Blu scuro intenso, in linea con una palette "tech" */
  color: #f0f0f5; /* Testo chiaro per ottimo contrasto e leggibilità */
  padding: 40px 20px;
  font-family: "Poppins", sans-serif;
  text-align: center;
  border-top: 3px solid #16213e; /* Bordo superiore leggermente più scuro per effetto divisione */
}

/* Paragrafi con spaziatura elegante e leggibilità migliorata */
#infoSection p {
  margin: 8px 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Lista contatti/social disposta in orizzontale, responsiva e centrata */
#infoSection ul {
  list-style: none;
  padding: 0;
  margin: 20px auto 0;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 30px;
}

/* Elementi della lista: testo leggermente più piccolo e uniforme */
#infoSection ul li {
  font-size: 0.9rem;
}

/* Link stilizzati con effetto luminoso al passaggio */
#infoSection a {
  color: #4ea1d3; /* Azzurro brillante per richiamare l’attenzione */
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease, transform 0.3s ease;
}

/* Hover su link: colore chiaro + effetto leggero di scala */
#infoSection a:hover {
  color: #e0e0e5;
  transform: scale(1.05);
}

/* Media query per schermi piccoli: lista verticale, più compatta */

/* Media query mobile */
@media (max-width: 600px) {
  html {
    font-size: 16px;
    touch-action: manipulation;
  }

  header {
    padding: 8px 6px;
    flex-direction: row;
    align-items: center;
    justify-content: center;
  }

  #title .logo {
    height: 38px;
    margin-right: 0px;
  }

  #title h1 {
    font-size: 1.1rem;
  }

  #navbar ul {
    display: none;
  }

  #navbar button {
    display: none;
  }

  main {
    max-width: 100vw;
    padding: 0 4px;
  }

  #uploadSection {
    padding: 10px 2px;
  }

  #uploadSection h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
  }

  .file-drop {
    min-height: 160px;
    padding: 8px;
    gap: 6px;
    max-height: 300px;
  }

  .file-drop__icon {
    height: 60px;
  }

  .file-drop__title {
    font-size: 1rem;
  }

  .file-drop__supported {
    font-size: 0.85rem;
  }

  .imageContainer,
  .pdfContainer,
  .textContainer {
    max-width: 95vw;
    padding: 6px 4px;
    font-size: 0.9rem;
  }

  #outputSection {
    padding: 10px 4px;
  }

  #previewContainer {
    gap: 10px;
  }

  #outputSection #previewTextContainer,
  #outputSection #previewSummaryContainer {
    padding: 6px 10px 2rem 10px;
    border-radius: 6px;
  }

  .textBlock {
    padding: 6px 8px;
    font-size: 0.9rem;
    border-radius: 6px;
  }

  #finalizeTextButton {
    bottom: 6px;
    right: 10px;
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  #ocrLogger {
    width: 100px;
    font-size: 0.55rem;
    padding: 3px 4px;
  }

  #summaryLogger {
    max-width: 90vw;
    font-size: 0.55rem;
    padding: 4px 6px;
  }

  #infoSection ul {
    flex-direction: column;
    gap: 12px;
  }
  .toastify {
    display: none !important;
  }
}
