/* ===========================================================
   static/css/style.css  — Versione Professionale 2025+
   Autore: Nicole Ferraro
   Descrizione: Stile modulare e accessibile per interfacce moderne
   =========================================================== */

/* ------------------------------------------------------------------ */
/* 1. VARIABILI GLOBALI E FONT
/* ------------------------------------------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Palette principale */
  --green-primary: #28a745;
  --green-dark: #218838;
  --green-light-bg: #f6fbf6;

  /* Testi */
  --text-primary: #1a202c;
  --text-secondary: #4a5568;

  /* Struttura e sfondi */
  --background-color: #f7fafc;
  --border-color: #e2e8f0;

  /* Ombre e bordi */
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --card-hover-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;

  /* Transizioni globali */
  --transition-fast: 0.15s ease-out;
  --transition-medium: 0.25s ease;
}

/* ------------------------------------------------------------------ */
/* 2. RESET & BASE TYPOGRAPHY
/* ------------------------------------------------------------------ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  padding: 1.5rem;
}

/* Miglioramento della selezione */
::selection {
  background-color: var(--green-primary);
  color:var(--text-secondary);
}

/* ------------------------------------------------------------------ */
/* 3. LAYOUT PRINCIPALE E HEADER
/* ------------------------------------------------------------------ */
.page {
  max-width: 960px;
  margin: 2.5rem auto;
}

.header {
  text-align: center;
  margin-bottom: 3rem;
}

.header h1 {
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.header p {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

/* ------------------------------------------------------------------ */
/* 4. CARD — COMPONENTE BASE
/* ------------------------------------------------------------------ */
.card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 2rem 2.5rem;
  box-shadow: var(--card-shadow);
  margin-bottom: 2.5rem;
  transition: transform var(--transition-medium), box-shadow var(--transition-medium);
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--card-hover-shadow);
}

.card h2 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

/* ------------------------------------------------------------------ */
/* 5. FORM DI RICERCA E BOTTONI
/* ------------------------------------------------------------------ */
.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.search-form input[type="text"] {
  flex-grow: 1;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  font-size: 1rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-form input[type="text"]:focus {
  outline: none;
  border-color: var(--green-primary);
  box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.15);
}

/* Bottoni principali */
button,
.save-button,
.export-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--green-primary);
  color: #000000;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.7rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

button:hover,
.save-button:hover,
.export-button:hover {
  background: var(--green-dark);
}

button:active,
.save-button:active,
.export-button:active {
  transform: scale(0.97);
}

/* ------------------------------------------------------------------ */
/* 6. LISTA SUGGERIMENTI
/* ------------------------------------------------------------------ */
.suggestions {
  list-style: none;
  margin-top: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.suggestions li form { margin: 0; }

.suggestion-btn {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.2rem;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  font-size: 0.95rem;
}

.suggestions li:last-child .suggestion-btn {
  border-bottom: none;
}

.suggestion-btn:hover {
  background-color: var(--green-light-bg);
}

.suggestion-btn strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* 7. BLOCCO ANALISI E RISULTATI
/* ------------------------------------------------------------------ */
.analysis .meta p {
  margin: 0.5rem 0;
  font-size: 1rem;
  color: var(--text-secondary);
}

.analysis .meta p strong {
  color: var(--text-primary);
}

.impact-total {
  background: var(--green-light-bg);
  border-left: 4px solid var(--green-primary);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-sm);
  margin: 2rem 0;
}

.metric-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem 0;
}

/* Tabelle */
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.results-table th,
.results-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.results-table th {
  background: #f8f9fa;
  color: var(--text-secondary);
  text-align: left;
  font-weight: 600;
}

.results-table tbody tr:hover {
  background-color: #fcfcfc;
}

.results-table .total-row {
  background: var(--green-light-bg);
  font-weight: 700;
}

/* Grafici */
.chart {
  width: 100%;
  min-height: 450px;
  margin: 2rem 0;
}

/* ------------------------------------------------------------------ */
/* 8. SEZIONE ANALISI SALVATE
/* ------------------------------------------------------------------ */
.export-button {
  margin-bottom: 1.5rem;
}

.saved ul {
  list-style: none;
  padding: 0;
}

.saved li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast);
}

.saved li:hover {
  background-color: #f8f9fa;
}

.saved li b {
  font-weight: 500;
}

/* Pulsante elimina */
.delete-btn {
  background: #ffebe9;
  color: #e53e3e;
  border: 1px solid #e53e3e;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.delete-btn:hover {
  background: #e53e3e;
  color: #fff;
}

/* ------------------------------------------------------------------ */
/* 9. GRIGLIA METRICHE
/* ------------------------------------------------------------------ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
  text-align: center;
}

.metric-card {
  background-color: #f8f9fa;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow);
}

.metric-card.total {
  background-color: var(--green-light-bg);
}

.metric-card label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.metric-card .metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.metric-card .metric-value span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.metric-card input {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  width: 100%;
  border: none;
  background: none;
  text-align: center;
}

.metric-card input:focus {
  outline: none;
}

/* ------------------------------------------------------------------ */
/* 10. RESPONSIVE DESIGN
/* ------------------------------------------------------------------ */
@media (max-width: 768px) {
  .card {
    padding: 1.5rem;
  }

  .search-form {
    flex-direction: column;
  }

  .search-form input[type="text"],
  button {
    width: 100%;
  }

  .header h1 {
    font-size: 2.2rem;
  }
} .header .logo {
  height: 42px;
  vertical-align: middle;
  margin-right: 0.6rem;
  transform: translateY(-2px);
}
.header .logo-large {
  height: 70px;
  margin-bottom: 1rem;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.1));
}

