/* =========================
   RESET BASE
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box; /* Include padding e border nelle dimensioni */
  font-family: sans-serif;
}

body {
  background-color: #1e1e1e;
  color: #fff;
  line-height: 1.5;
  padding: 0 10px; /* Piccolo padding per evitare che i contenuti tocchino i bordi su mobile */
}

/* =========================
   HEADER
========================= */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #8b0000; /* Rosso scuro */
  padding: 10px 30px;
  flex-wrap: wrap; /* Permette agli elementi di andare a capo su schermi piccoli */
  gap: 10px;
}

.header-left {
  font-size: 1.5rem;
  font-weight: bold;
}

.header-center {
    display: flex;
    justify-content: center; /* centra orizzontalmente */
    align-items: center;     /* centra verticalmente */
}

.header-center .logo {
    width: 110px;          
    height: 110px;         
    object-fit: cover;     
    border-radius: 50%;    
    border: 2px solid #000; 
}

.header-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Logout button */
.header-right .logout-btn {
  background-color: #fff;
  color: #8b0000;
  padding: 8px 10px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  transition: 0.3s;
}
.header-right .logout-btn:hover {
  background-color: #f0f0f0;
}

/* Pulsante modifica dati azienda a quadratino */
.header-right .btn-square {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 35px;
  height: 35px;
  background-color: #fff;
  color: #8b0000;
  border-radius: 5px;
  text-decoration: none !important;  /* forza rimozione sottolineatura */
  font-weight: bold;
  font-size: 14px;                   /* ridotto per entrare nel quadratino */
  transition: 0.3s;
  border: 1px solid #8b0000;
  text-align: center;                 /* centra la scritta */
  line-height: 35px;                  /* allinea verticalmente */
}

.header-right .btn-square:hover {
  background-color: #f0f0f0;
}


/* =========================
   MAIN CONTENT
========================= */
.main-content {
  padding: 30px 0;
}


/* =========================
   QUICK BUTTONS RESPONSIVE
========================= */
.quick-buttons {
  margin-top: 40px;
  display: flex; /* default desktop: flex orizzontale */
  flex-wrap: wrap;
  gap: 15px;
}

/* Pulsanti singoli */
.quick-buttons .btn {
  background-color: #8b0000;
  color: #fff;
  padding: 15px 25px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  transition: 0.3s;
  flex: 1 1 200px; /* cresce e si restringe in base allo spazio */
  text-align: center;
}

.quick-buttons .btn:hover {
  background-color: #a30000;
}



/* =========================
   FORMS
========================= */
.form-cliente {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 500px;
  margin-bottom: 30px;
}

.form-cliente input, 
.form-cliente textarea {
  padding: 8px;
  border-radius: 5px;
  border: 1px solid #ccc;
  width: 100%; /* Assicura che il form si adatti allo schermo */
}

/* =========================
   TABELLE CLIENTI, VEICOLI, PREVENTIVI
========================= */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th, td {
  border: 1px solid #444;
  padding: 8px;
  text-align: left;
}

th {
  background-color: #8b0000;
  color: #fff;
}

tr:nth-child(even) {
  background-color: #2a2a2a;
}

/* Input di ricerca (uniforme per tutte le pagine) */
.search-input,
#search,
#searchCliente,
#searchPreventivi {
  padding: 8px;
  margin-bottom: 10px;
  width: 100%;
  border-radius: 5px;
  border: 1px solid #ccc;
}

/* =========================
   POPUP ELIMINA CLIENTE
========================= */
.popup-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  display: none; /* Visibile solo quando attivato */
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.popup-content {
  background: #1e1e1e;
  padding: 25px 30px;
  border-radius: 10px;
  width: 400px;
  max-width: 90%; /* Si adatta ai telefoni */
  color: #fff;
  text-align: center;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.popup-header {
  font-size: 1.4rem;
  margin-bottom: 15px;
  font-weight: bold;
}

.popup-body p {
  margin-bottom: 10px;
}

.popup-body input {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #555;
  background: #333;
  color: #fff;
  margin-bottom: 15px;
}

.popup-body input::placeholder {
  color: #aaa;
}

.popup-footer {
  display: flex;
  flex-wrap: wrap; /* I pulsanti vanno a capo su schermi piccoli */
  justify-content: space-between;
  gap: 10px;
}

.popup-footer .btn {
  flex: 1 1 120px;
}

/* Pulsante rosso per eliminazione */
.btn-danger {
  background-color: #8b0000;
  color: #fff;
}

.btn-danger:hover {
  background-color: #a30000;
}

/* Pulsante indietro */
.back-btn {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  margin-right: 15px;
}

.back-btn:hover {
  text-decoration: underline;
}

/* =========================
   MEDIA QUERY PER RESPONSIVE
========================= */
@media (max-width: 768px) {
  /* Header: disposizione in colonna per schermi piccoli */
  .header {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }
  
  .header-left {
    font-size: 1.2rem;
    order: 1;
  }

  .header-center {
    order: 2;
  }
  
  .header-center .logo {
    width: 80px;
    height: 80px;
  }

  .header-right {
    order: 3;
  }

  /* Quick buttons: griglia 2x2 */
  .quick-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 colonne uguali */
    gap: 15px;
  }

  .quick-buttons .btn {
    flex: unset; /* togliamo flex perché ora è grid */
    padding: 12px;
    font-size: 0.9rem;
  }

  .popup-content {
    padding: 20px;
  }

  .popup-footer .btn {
    flex: 1 1 100%;
  }
}

@media (max-width: 480px) {
  .header-left {
    font-size: 1rem;
  }

  .header-center .logo {
    width: 60px;
    height: 60px;
  }

  /* Quick buttons: 1 colonna su schermi molto piccoli */
  .quick-buttons {
    grid-template-columns: 1fr;
  }

  .form-cliente {
    max-width: 100%;
  }
}

/* =========================
   STATS CONTAINER
========================= */
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.stat-card {
  background: linear-gradient(135deg, #8b0000, #a30000);
  padding: 25px 20px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid #fff;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.stat-number {
  font-size: 3rem;
  font-weight: bold;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.stat-label {
  font-size: 1.1rem;
  opacity: 0.9;
  font-weight: 500;
}

/* =========================
   MEDIA QUERY PER STATS RESPONSIVE
========================= */
@media (max-width: 768px) {
  .stats-container {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
  }
  
  .stat-card {
    padding: 20px 15px;
  }
  
  .stat-number {
    font-size: 2.5rem;
  }
  
  .stat-label {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .stats-container {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .stat-card {
    padding: 18px 12px;
  }
  
  .stat-number {
    font-size: 2.2rem;
  }
}

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  padding: 15px;
  background-color: #222;
  color: #fff;
  font-size: 14px;
}
.footer p {
  margin: 0;
}

.footer-link {
    color: inherit;       /* prende il colore del footer */
    text-decoration: none; /* rimuove la sottolineatura */
}
.footer-link:hover {
    text-decoration: underline; /* opzionale: sottolinea al passaggio del mouse */
}

/*------------------------------------------------------------------------------------*/

/* =========================
   CALENDARIO
========================= */
.calendar-section {
  margin: 40px 0;
  padding: 20px;
  background: #2a2a2a;
  border-radius: 12px;
  border: 1px solid #444;
}

.calendar-section h3 {
  margin-bottom: 20px;
  text-align: center;
  color: #fff;
}

.calendar-container {
  max-width: 800px;
  margin: 0 auto;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 10px;
}

.calendar-header h4 {
  margin: 0;
  font-size: 1.4rem;
  color: #fff;
}

.calendar-nav {
  background: #8b0000;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: background 0.3s;
}

.calendar-nav:hover {
  background: #a30000;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.calendar-day-header {
  text-align: center;
  padding: 10px;
  background: #8b0000;
  color: white;
  font-weight: bold;
  border-radius: 4px;
}

.calendar-day {
  position: relative;
  min-height: 80px;
  padding: 8px;
  background: #333;
  border: 1px solid #444;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
}

.calendar-day:hover {
  background: #444;
  transform: scale(1.02);
}

.calendar-day.empty {
  background: #2a2a2a;
  cursor: default;
}

.calendar-day.empty:hover {
  background: #2a2a2a;
  transform: none;
}

.calendar-day.today {
  background: #8b0000;
  border-color: #fff;
}

.calendar-day.has-event {
  background: #1a472a;
  border-color: #2e8b57;
}

.event-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 0.8rem;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: #2a2a2a;
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  border: 1px solid #444;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #444;
}

.modal-header h4 {
  margin: 0;
  color: #fff;
}

.close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: #444;
  border-radius: 50%;
}

.modal-body {
  padding: 20px;
}

.modal-body textarea {
  width: 100%;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #555;
  background: #333;
  color: #fff;
  resize: vertical;
  font-family: inherit;
}

.modal-body textarea:focus {
  outline: none;
  border-color: #8b0000;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  padding: 20px;
  border-top: 1px solid #444;
  gap: 10px;
}

.modal-footer .btn {
  flex: 1;
}

@media (max-width: 768px) {
  .calendar-day {
    min-height: 60px;
    padding: 5px;
    font-size: 0.9rem;
  }
  
  .calendar-day-header {
    padding: 8px 5px;
    font-size: 0.8rem;
  }
  
  .event-badge {
    font-size: 0.7rem;
  }
  
  .calendar-header h4 {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .calendar-day {
    min-height: 50px;
    font-size: 0.8rem;
  }
  
  .calendar-grid {
    gap: 2px;
  }
  
  .modal-content {
    width: 95%;
    margin: 10px;
  }
  
  .modal-footer {
    flex-direction: column;
  }
}



@media (max-width: 480px) {
  .import-export-section {
    padding: 15px;
  }
  
  .export-buttons {
    gap: 8px;
  }
  
  .btn-export,
  .btn-import {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
}



@media (max-width: 480px) {
  .import-export-section {
    padding: 15px;
  }
  
  .export-buttons {
    gap: 8px;
  }
  
  .btn-export,
  .btn-import {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
}



@media (max-width: 480px) {
  .import-export-section {
    padding: 15px;
  }
  
  .export-buttons {
    gap: 8px;
  }
  
  .btn-export,
  .btn-import {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
}



@media (max-width: 480px) {
  .import-export-section {
    padding: 15px;
  }
  
  .export-buttons {
    gap: 8px;
  }
  
  .btn-export,
  .btn-import {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
}



@media (max-width: 480px) {
  .import-export-section {
    padding: 15px;
  }
  
  .export-buttons {
    gap: 8px;
  }
  
  .btn-export,
  .btn-import {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
}



@media (max-width: 480px) {
  .import-export-section {
    padding: 15px;
  }
  
  .export-buttons {
    gap: 8px;
  }
  
  .btn-export,
  .btn-import {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
}



@media (max-width: 480px) {
  .import-export-section {
    padding: 15px;
  }
  
  .export-buttons {
    gap: 8px;
  }
  
  .btn-export,
  .btn-import {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
}

/* =========================
   IMPORT/EXPORT SECTION
========================= */
.import-export-section {
  margin: 40px 0;
  padding: 25px;
  background: #2a2a2a;
  border-radius: 12px;
  border: 1px solid #444;
}

.import-export-section h3 {
  margin-bottom: 25px;
  text-align: center;
  color: #fff;
  border-bottom: 2px solid #8b0000;
  padding-bottom: 10px;
}

.import-export-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.export-section,
.import-section {
  padding: 20px;
  background: #333;
  border-radius: 8px;
  border: 1px solid #555;
}

.export-section h4,
.import-section h4 {
  color: #8b0000;
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.export-section p,
.import-section p {
  color: #ccc;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.export-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-export {
  background: linear-gradient(135deg, #2e8b57, #32a56c);
  border: none;
  padding: 12px 15px;
  border-radius: 6px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-export:hover {
  background: linear-gradient(135deg, #32a56c, #3bc47d);
  transform: translateY(-2px);
}

.btn-import {
  background: linear-gradient(135deg, #8b0000, #a30000);
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
}

.btn-import:hover {
  background: linear-gradient(135deg, #a30000, #c40000);
  transform: translateY(-2px);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #fff;
  font-weight: bold;
}

.form-group select,
.form-group input[type="file"] {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #555;
  background: #1e1e1e;
  color: #fff;
  font-size: 0.9rem;
}

.form-group select:focus,
.form-group input[type="file"]:focus {
  outline: none;
  border-color: #8b0000;
}

.form-group small {
  color: #888;
  font-size: 0.8rem;
  display: block;
  margin-top: 5px;
}

.import-export-message {
  padding: 15px;
  border-radius: 6px;
  margin: 15px 0;
  text-align: center;
  font-weight: bold;
}

.message-success {
  background: #1a472a;
  color: #32a56c;
  border: 1px solid #2e8b57;
}

.message-error {
  background: #472a1a;
  color: #a56c32;
  border: 1px solid #8b572e;
}

@media (max-width: 768px) {
  .import-export-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .export-section,
  .import-section {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .import-export-section {
    padding: 15px;
  }
  
  .export-buttons {
    gap: 8px;
  }
  
  .btn-export,
  .btn-import {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
}