/* Calcolatore Stipendio Lordo Netto - CSS Premium (2026) */

/* Font ospitato sul dominio: nessuna chiamata a terzi, stesso file
   già usato da Radar Comune (vendor/outfit.woff2 + outfit-ext.woff2). */
@font-face{font-family:'Outfit';src:url('vendor/outfit.woff2') format('woff2');
  font-weight:100 900;font-style:normal;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'Outfit';src:url('vendor/outfit-ext.woff2') format('woff2');
  font-weight:100 900;font-style:normal;font-display:swap;unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}

/* --- VARIABILI DI TEMA --- */
:root {
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Palette Dark Mode (Default) */
  --bg-app: #080b11;
  --bg-gradient: linear-gradient(135deg, #080b11 0%, #111625 100%);
  --bg-card: rgba(17, 24, 39, 0.6);
  --bg-card-hover: rgba(31, 41, 55, 0.5);
  --border-card: rgba(255, 255, 255, 0.08);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-inverted: #111827;

  /* Colori Identificativi */
  --primary: #4f46e5;       /* Indigo */
  --primary-hover: #6366f1;
  --success: #10b981;       /* Emerald (Netto) */
  --warning: #f97316;       /* Orange (INPS) */
  --danger: #ec4899;        /* Pink/Red (IRPEF) */
  --info: #8b5cf6;          /* Purple (Addizionali) */

  --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.2);

  --border-radius: 16px;
  --transition-speed: 0.3s;
}

/* Palette Light Mode */
body.light-mode {
  --bg-app: #f3f4f6;
  --bg-gradient: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --border-card: rgba(0, 0, 0, 0.08);
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --text-inverted: #ffffff;

  --primary: #4f46e5;
  --primary-hover: #3730a3;

  --shadow-main: 0 8px 32px 0 rgba(31, 38, 135, 0.08);
  --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.1);
}

/* --- STILI GENERALI --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
}

body {
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition-speed), color var(--transition-speed);
  overflow-x: hidden;
}

header {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(to right, #818cf8, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.logo-design {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.logo-design a {
  color: var(--primary-hover);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-speed);
}

.logo-design a:hover {
  color: var(--success);
  text-decoration: underline;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 18px;
  border-radius: 12px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all var(--transition-speed);
}

.btn-icon:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: translateY(-2px);
}

main {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto 40px auto;
  padding: 0 20px;
  flex-grow: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 992px) {
  main {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

/* --- CARD GLASSMORPHISM --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--border-radius);
  padding: 24px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-main);
  transition: background var(--transition-speed), border var(--transition-speed), transform var(--transition-speed);
}

.card:hover {
  background: var(--bg-card-hover);
}

/* --- SWITCH MODALITA (TAB) --- */
.mode-container {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 24px;
  border: 1px solid var(--border-card);
}

.mode-tab {
  flex: 1;
  text-align: center;
  padding: 12px;
  font-weight: 600;
  font-size: 15px;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-speed);
  color: var(--text-muted);
}

.mode-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-glow);
}

/* --- ELEMENTI INPUT --- */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-symbol {
  position: absolute;
  left: 16px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-muted);
}

.styled-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.15);
  border: 1.5px solid var(--border-card);
  border-radius: 12px;
  padding: 14px 16px 14px 38px;
  color: var(--text-main);
  font-size: 20px;
  font-weight: 600;
  outline: none;
  transition: all var(--transition-speed);
}

body.light-mode .styled-input {
  background: rgba(255, 255, 255, 0.8);
}

.styled-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* SLIDER RANGE */
.slider-container {
  margin-top: 14px;
  margin-bottom: 24px;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.styled-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-card);
  outline: none;
  cursor: pointer;
}

.styled-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: var(--shadow-glow);
  cursor: pointer;
  transition: transform 0.1s;
}

.styled-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* CONTROLLI DI SELEZIONE */
.select-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 576px) {
  .select-container {
    grid-template-columns: 1fr 1fr;
  }
}

.styled-select {
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border-card);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text-main);
  font-size: 15px;
  outline: none;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.styled-select:focus {
  border-color: var(--primary);
}

/* --- ACCORDION OPZIONI AVANZATE --- */
.adv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 14px 0;
  border-top: 1px solid var(--border-card);
  margin-top: 24px;
  user-select: none;
}

.adv-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.adv-header .arrow {
  transition: transform var(--transition-speed);
}

.adv-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out, padding 0.4s ease;
}

.adv-panel.open {
  max-height: 600px;
  padding-top: 16px;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

/* Familiari a carico layout */
.family-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: center;
}

@media (min-width: 576px) {
  .family-row {
    grid-template-columns: 1.5fr 1fr;
  }
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  color: var(--text-main);
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.input-mini {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

/* --- RISULTATI --- */
.result-summary {
  text-align: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-card);
  margin-bottom: 24px;
}

.summary-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.main-result {
  font-size: 42px;
  font-weight: 800;
  color: var(--success);
  letter-spacing: -1px;
}

.secondary-result {
  font-size: 16px;
  color: var(--text-muted);
  margin-top: 4px;
}

.secondary-result span {
  color: var(--text-main);
  font-weight: 600;
}

/* --- BREAKDOWN CHART (DONUT) --- */
.chart-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
}

@media (min-width: 576px) {
  .chart-section {
    flex-direction: row;
    justify-content: space-around;
  }
}

.donut-wrapper {
  position: relative;
  width: 150px;
  height: 150px;
}

.donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* Inizia dall'alto */
}

.donut-svg circle {
  fill: none;
  stroke-width: 12;
  transition: stroke-dasharray 0.5s ease, stroke-dashoffset 0.5s ease;
}

.donut-bg {
  stroke: rgba(255, 255, 255, 0.05);
}

body.light-mode .donut-bg {
  stroke: rgba(0, 0, 0, 0.05);
}

/* Colori delle fette */
.donut-slice-net { stroke: var(--success); }
.donut-slice-inps { stroke: var(--warning); }
.donut-slice-irpef { stroke: var(--danger); }
.donut-slice-local { stroke: var(--info); }

.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.donut-center-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.donut-center-val {
  font-size: 18px;
  font-weight: 700;
}

/* Legenda Grafico */
.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.color-net { background-color: var(--success); }
.color-inps { background-color: var(--warning); }
.color-irpef { background-color: var(--danger); }
.color-local { background-color: var(--info); }

.legend-text {
  font-weight: 500;
}

.legend-pct {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 13px;
  padding-left: 16px;
}

/* --- TABELLA DETTAGLI DETTAGLIATA --- */
.details-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

tr {
  border-bottom: 1px solid var(--border-card);
  transition: background 0.2s;
}

tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

body.light-mode tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

tr.zero-value {
  display: none; /* Nasconde le detrazioni a zero per pulizia */
}

td {
  padding: 10px 8px;
}

td.value {
  text-align: right;
  font-weight: 600;
}

/* Righe Speciali */
tr.row-section {
  background: rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

body.light-mode tr.row-section {
  background: rgba(0, 0, 0, 0.04);
}

tr.row-section td {
  padding: 12px 8px;
  color: var(--text-main);
}

tr.row-total {
  border-bottom: 2px solid var(--primary);
  font-size: 15px;
  font-weight: 700;
}

tr.row-total td {
  color: var(--success);
  padding: 14px 8px;
}

/* Colori dei valori */
.text-danger { color: #f87171 !important; }
.text-success { color: #34d399 !important; }
body.light-mode .text-danger { color: #dc2626 !important; }
body.light-mode .text-success { color: #059669 !important; }

/* Costo Azienda Rows styling */
tr.row-azienda-only {
  background: rgba(79, 70, 229, 0.05);
}

body.light-mode tr.row-azienda-only {
  background: rgba(79, 70, 229, 0.03);
}

#row-azienda-totale td {
  color: var(--primary-hover) !important;
  font-weight: 700;
}

/* --- SEZIONE INFORMATIVA --- */
.info-section {
  grid-column: 1 / -1;
  margin-top: 16px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 16px;
}

@media (min-width: 768px) {
  .info-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.info-card h4 {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--primary-hover);
}

.info-card p {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* --- FOOTER --- */
footer {
  text-align: center;
  padding: 30px 20px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-card);
  margin-top: 40px;
}

footer a {
  color: var(--primary-hover);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* --- PERIOD TOGGLE STYLING --- */
.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.details-header h3 {
  margin-bottom: 0 !important;
}

.period-toggle-container {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border-card);
}

body.light-mode .period-toggle-container {
  background: rgba(0, 0, 0, 0.05);
}

.period-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.period-tab:hover {
  color: var(--text-main);
}

.period-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-glow);
}

/* --- STILI DI STAMPA REPORT --- */
@media print {
  body {
    background: white !important;
    color: black !important;
  }

  body.light-mode {
    background: white !important;
  }

  header,
  .mode-container,
  .form-group,
  .adv-header,
  .adv-panel,
  .btn-icon,
  #print-report,
  .info-section,
  footer {
    display: none !important;
  }

  main {
    grid-template-columns: 1fr !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .result-summary {
    border-bottom: 2px solid #ccc !important;
    padding-bottom: 20px !important;
  }

  .main-result {
    color: black !important;
    font-size: 32px !important;
  }

  table {
    font-size: 12px !important;
    border: 1px solid #ddd !important;
  }

  tr {
    border-bottom: 1px solid #ddd !important;
  }

  tr.row-section {
    background: #f0f0f0 !important;
  }

  tr.zero-value {
    display: none !important;
  }

  td {
    padding: 8px !important;
  }

  .text-danger, .text-success {
    color: black !important;
  }

  .chart-section {
    page-break-inside: avoid;
  }
}
