/* --- 1. RESET BASE E COLORI --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: #EEF2F6; 
  color: #1E293B;
  min-height: 100vh;
}

/* --- 2. CONTENITORE NAVBAR --- */
.navbar {
  background-color: #FFFFFF;
  border-bottom: 1px solid #E2E8F0;
  padding: 1rem 2rem;
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-text {
  font-size: 1.2rem;
  color: #0F172A;
}

.nav-link {
  color: #64748B;
  text-decoration: none;
  font-weight: 500;
}

.nav-link:hover {
  color: #2563EB;
}

/* --- 3. CONTENITORE PRINCIPALE A DUE COLONNE (EQUILIBRATE) --- */
.main-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: flex;
  gap: 2rem;
  align-items: stretch;
}

.form-section, .result-section {
  flex: 1; /* Occupano esattamente lo 50% dello spazio ciascuna */
  width: 50%;
  background-color: #FFFFFF;
  padding: 1.8rem;
  border-radius: 12px;
  border: 1px solid #CBD5E1;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

.result-section {
  display: flex;
  flex-direction: column;
}

.result-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
  color: #0F172A;
}

h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: #334155;
}

.form-group {
  margin-bottom: 1.5rem;
}

/* --- 4. SEZIONE FOTO & DROPZONE --- */
#drop-zone {
  border: 2px dashed #2563EB;
  border-radius: 12px;
  background-color: #F8FAFC;
  padding: 25px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

#drop-zone:hover {
  background-color: #EFF6FF;
  border-color: #1D4ED8;
}

/* Griglia contenitore delle anteprime */
#anteprime-container {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  margin-top: 15px !important;
  min-height: 10px;
  width: 100%;
}

/* Stile per ciascuna card immagine caricata */
.foto-preview-card {
  position: relative !important;
  width: 90px !important;
  height: 90px !important;
  min-width: 90px !important;
  min-height: 90px !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  border: 2px solid #2563EB !important;
  display: inline-block !important;
  background: #E2E8F0 !important;
  box-shadow: 0 2px 5px rgba(0,0,0,0.12) !important;
}

.foto-preview-card img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

/* --- 5. STILE INPUT E SELECT --- */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.3rem;
  margin-bottom: 0.8rem;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-size: 0.95rem;
  background-color: #FFFFFF;
  outline: none;
  box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

#risultato-annuncio {
  flex: 1;
  min-height: 350px;
  background-color: #F8FAFC;
  line-height: 1.6;
}

/* --- 6. BOTTONI --- */
.btn-primary {
  width: 100%;
  background-color: #2563EB;
  color: white;
  border: none;
  padding: 0.85rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary:hover {
  background-color: #1D4ED8;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.btn-secondary {
  flex: 1;
  background-color: #FFFFFF;
  color: #334155;
  border: 1px solid #CBD5E1;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  background-color: #F1F5F9;
  border-color: #94A3B8;
  color: #0F172A;
}

.box-crediti {
  margin-top: auto;
  text-align: center;
  font-size: 0.85rem;
  color: #64748B;
  padding-top: 0.5rem;
  border-top: 1px solid #F1F5F9;
}

/* --- 7. AUTH BOX (LOGIN/LOGOUT) COMPATTO E ORDINATO --- */
.auth-box-compact {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-box-compact input {
  margin-bottom: 0;
}

.auth-box-compact button {
  width: 100%;
  background-color: #2563EB;
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.auth-box-compact button:hover {
  background-color: #1D4ED8;
}

/* Layout Utente Loggato */
#logged-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  background: #F8FAFC;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
}

/* --- 8. ADATTAMENTO PER CELLULARI --- */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
  }
  
  .form-section, .result-section {
    width: 100%;
  }
}
/* --- POSIZIONAMENTO CORRETTO OCCHIO DENTRO L'INPUT --- */
.password-wrapper {
  position: relative !important;
  width: 100% !important;
  display: block !important;
  margin-top: 0.3rem;
  margin-bottom: 0.8rem;
}

.password-wrapper input {
  width: 100% !important;
  padding-right: 42px !important; /* Spazio per non sovrapporre il testo digitato all'occhio */
  margin: 0 !important;
}

#btn-toggle-password {
  position: absolute !important;
  right: 12px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: none !important;
  border: none !important;
  cursor: pointer !important;
  font-size: 1.1rem !important;
  line-height: 1 !important;
  z-index: 10 !important;
  user-select: none !important;
  display: inline-block !important;
}