/* ==================================================
   PORTALE CREDENZIALI - Global Stylesheet
   Bootstrap 5 compatible, White+Red accent (SIT style)
   ================================================== */

@import url('https://fonts.googleapis.com/css2?family=Titillium+Web:ital,wght@0,300;0,400;0,600;0,700;1,300;1,400;1,600&display=swap');

:root {
  --red: #bf1e2e;
  --red-hover: #9b1825;
  --red-light: #fef0f1;

  --sit-gray-bg: #f4f6f9;
  --text-primary: #333333;
  --text-secondary: #6c757d;
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);

  /* Backward-compat vars (referenced by views) */
  --surface-bg: #ffffff;
  --surface-border: #dee2e6;
  --bg-gradient-start: #ffffff;
  --bg-gradient-end: #f4f6f9;
  --error-color: #bf1e2e;
  --success-color: #198754;
  --primary-color: #bf1e2e;
  --primary-hover: #9b1825;
}

body {
  background-color: var(--sit-gray-bg);
  color: var(--text-primary);
  font-family: "Titillium Web", "Segoe UI", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ---- Navbar / Top Header ---- */
.navbar-portale {
  background: #ffffff;
  border-bottom: 3px solid var(--red);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-portale .logos img {
  height: 48px;
  object-fit: contain;
}

.navbar-portale .logos img[alt="Portale Accettazione Credenziali"] {
  height: 44px;
  width: 44px;
  object-fit: contain;
}

.navbar-portale .logos {
  display: flex;
  align-items: center;
  gap: 14px;
}

.navbar-portale .page-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--text-primary);
}

.navbar-portale .user-info {
  font-size: .82rem;
  color: var(--text-secondary);
}

/* ---- Cards ---- */
.card {
  border: 1px solid #dee2e6;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  background: #fff;
  overflow: hidden;
}

.card-header-red {
  background: var(--red);
  color: #fff;
  padding: .85rem 1.25rem;
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: .4px;
}

/* ---- Tables ---- */
.table th {
  background-color: var(--red) !important;
  color: #fff !important;
  font-weight: 600;
  text-transform: uppercase;
  font-size: .8rem;
  letter-spacing: .4px;
  border: none !important;
  vertical-align: middle;
  white-space: nowrap;
}

.table td {
  vertical-align: middle;
  font-size: .875rem;
}

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

/* ---- Status Badges ---- */
.badge-stato {
  display: inline-block;
  padding: .25rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}

.badge-Aperta {
  background: #fff0f0;
  color: var(--red);
  border: 1px solid #f5c2c5;
}

.badge-Firmata {
  background: #fff8e3;
  color: #8a6600;
  border: 1px solid #ffe08a;
}

.badge-Evasa {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #86efac;
}

/* ---- File Pills (red, as in images) ---- */
.file-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--red);
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  text-decoration: none;
  margin: 2px 2px 2px 0;
  transition: background .15s;
  white-space: nowrap;
}

.file-pill:hover {
  background: var(--red-hover);
  color: #fff;
}

/* ---- Buttons ---- */
.btn-red {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  padding: .55rem 1.4rem;
  transition: background .2s, transform .1s;
  font-size: .875rem;
  cursor: pointer;
}

.btn-red:hover {
  background: var(--red-hover);
  color: #fff;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--red);
  border-color: var(--red);
  font-weight: 600;
  border-radius: 8px;
}

.btn-primary:hover {
  background: var(--red-hover);
  border-color: var(--red-hover);
}

/* ---- CTA Panel Left (like images) ---- */
.cta-panel {
  min-width: 190px;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 1.5rem 1.25rem;
  gap: .75rem;
}

.cta-panel .btn-red {
  width: 100%;
  text-align: center;
  padding: .75rem;
  border-radius: 30px;
  letter-spacing: .5px;
}

.cta-panel .btn-outline-secondary {
  border-radius: 30px;
  width: 100%;
  text-align: center;
}

.cta-panel .user-name {
  font-size: .8rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: .5rem;
}

/* =========================================================
   LOGIN PAGE — Layout, Header, Card, Footer
   ========================================================= */

/* Wrapper pagina: colonna flex full-viewport
   Usa !important per evitare conflitti con body {} generico */
body.login-body {
  display: flex !important;
  flex-direction: column !important;
  min-height: 100vh !important;
  background-color: #f4f6f9 !important;
  margin: 0;
  padding: 0;
}

/* Area centrale: espande e centra la card */
body.login-body main.login-main {
  flex: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 2.5rem 1rem;
}

/* ------- Header di pagina (logo SIT + logo BIM + titolo) ------- */
body.login-body header.login-page-header {
  background: #ffffff !important;
  padding: 14px 28px !important;
  display: flex !important;
  align-items: center !important;
  flex-direction: row !important;
  border-bottom: 5px solid #bf1e2e !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
  flex-shrink: 0;
}

/* Contenitore loghi: affiancati orizzontalmente */
.lph-logos {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 16px;
  flex-shrink: 0;
}

/* Logo SIT */
.lph-logo-sit {
  height: 44px !important;
  width: auto !important;
  max-width: 120px;
  object-fit: contain;
  display: block;
}

/* Logo Portale Accettazione Credenziali — header login */
.lph-logo-portale {
  height: 44px !important;
  width: 44px !important;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

/* Logo BIM */
.lph-logo-bim {
  height: 44px !important;
  width: auto !important;
  max-width: 120px;
  object-fit: contain;
  display: block;
}

/* Titolo portale: separato da bordo verticale — come nel progetto di riferimento */
.lph-title {
  display: block;
  margin-left: 24px;
  padding-left: 24px;
  border-left: 1px solid #e0e0e0;
  font-family: "Titillium Web", sans-serif;
  font-size: 1.3rem;
  font-weight: 400;
  color: #bf1e2e;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

/* ------- Login Card ------- */
.login-card {
  width: 100%;
  max-width: 420px;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.07) !important;
  overflow: hidden;
}

/* Intestazione card: sfondo bianco, icona e testo rosso */
.login-card-header {
  padding: 2rem 2rem 0.85rem;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
  background: #ffffff;
}

.login-card-logo {
  width: 180px;
  height: auto;
  max-width: 75%;
  margin: 0 auto 1rem;
  display: block;
  object-fit: contain;
}

.login-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #333333;
  letter-spacing: 0.5px;
  margin-bottom: 0.2rem;
}

.login-card-subtitle {
  font-size: 0.82rem;
  color: #6c757d;
  margin-bottom: 0;
}

/* Corpo card con il form */
.login-card-body {
  padding: 1.75rem 2rem 2rem;
  background: #ffffff;
}

/* Label form stile riferimento: uppercase + spaziatura + grigio chiaro */
.login-label {
  font-size: 0.82rem !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  color: #888 !important;
  font-weight: 600 !important;
  margin-bottom: 0.35rem !important;
}

/* Icona nell'input-group: colore rosso brand */
.login-input-icon {
  color: #bf1e2e;
}

/* ---- Alerts ---- */
.alert-error-custom {
  background: #fef2f2;
  color: var(--red);
  border-left: 4px solid var(--red);
  border-radius: 6px;
  padding: .85rem 1rem;
  font-size: .875rem;
  margin-bottom: 1.25rem;
}

.alert-success-custom {
  background: #f0fdf4;
  color: #166534;
  border-left: 4px solid #86efac;
  border-radius: 6px;
  padding: .85rem 1rem;
  font-size: .875rem;
  margin-bottom: 1.25rem;
}

.alert-info-custom {
  background: #eff6ff;
  color: #1e40af;
  border-left: 4px solid #93c5fd;
  border-radius: 6px;
  padding: .75rem 1rem;
  font-size: .85rem;
}

/* Badge per file assenti (approvatore) */
.file-missing-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #e9ecef;
  color: #6c757d;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Riga senza file: lieve sfondo arancio per evidenziarla */
.row-no-files td {
  background-color: #fffbf0 !important;
}

/* ---- Modal ---- */
.modal-content {
  border-radius: 10px;
  border: none;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
}

.modal-header {
  border-bottom: 2px solid var(--red);
}

.modal-header .btn-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0;
  color: var(--text-secondary);
}

.modal-header .btn-close:hover {
  color: var(--red);
}

/* ---- Form controls ---- */
.form-control:focus,
.form-select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 .2rem rgba(191, 30, 46, .15);
}

/* ---- Checkbox accent ---- */
input[type="checkbox"] {
  accent-color: var(--red);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ---- Misc ---- */
.main-layout {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 1.5rem;
}

.table-area {
  flex: 1;
  min-width: 0;
}

/* ---- Allegati cell (stable layout) ---- */
.allegati-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-height: 28px;
}

/* ---- Allegati a 3 slot (approvatore) — layout piatto inline ---- */
.allegati-row {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* Badge numerico circolare per ogni slot */
.slot-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #6c757d;
  color: #fff;
  font-size: .58rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-right: 1px;
}

/* Badge 3 in evidenza rossa (L.Invio — modificabile) */
.slot-num-invio {
  background: var(--red);
}

/* Separatore visivo tra i 3 slot */
.slot-sep {
  display: inline-block;
  width: 1px;
  height: 20px;
  background: #dee2e6;
  margin: 0 4px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* File assente: trattino grigio */
.slot-dash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: #f1f3f5;
  color: #adb5bd;
  font-size: .8rem;
  font-weight: 600;
}

/* File assente critico (slot 3 su Firmata): X rossa */
.slot-dash-danger {
  background: #fff5f5;
  color: #c0392b;
}

/* Slot 3 bloccato: mancano file 1 o 2. Grigio con lucchetto */
.slot-dash-locked {
  background: #f8f9fa;
  color: #adb5bd;
  font-size: .78rem;
}

/* Miniaturizza i btn nel btn-group dell'approvatore */
.btn-xs {
  padding: 2px 5px !important;
  font-size: .7rem !important;
  line-height: 1.4 !important;
}

/* ---- Chip di stato nella colonna Azioni (approvatore) ---- */
.azioni-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ✅ Tutto pronto per convalidare */
.chip-pronto {
  background: #d1fae5;
  color: #065f46;
}

/* ⏳ In attesa che il Segretario carichi i file 1/2 */
.chip-segretario {
  background: #ffedd5;
  color: #9a3412;
}

/* 📝 File 1 e 2 presenti, l'approvatore deve caricare L.Invio */
.chip-approvatore {
  background: #dbeafe;
  color: #1e40af;
}



/* ------- Footer di pagina (stile progetto di riferimento) ------- */
body.login-body footer.site-footer,
.site-footer {
  background-color: #30373D !important;
  color: #ecf0f1 !important;
  padding: 36px 8%;
  font-family: "Titillium Web", sans-serif;
  font-size: 14px;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* Riga brand: logo + ragione sociale */
.sf-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.sf-brand-logo {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.sf-brand-name {
  font-size: 20px;
  font-weight: 400;
  color: #fff;
  line-height: 1.2;
}

/* Contenitore 3 colonne */
.sf-columns {
  margin-bottom: 0;
}

.sf-col {
  margin-bottom: 24px;
}

/* Titolo colonna */
.sf-col-title {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

/* Lista voci footer */
.sf-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sf-list li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #ecf0f1;
  font-size: 13px;
  line-height: 1.5;
}

.sf-list li i {
  margin-top: 2px;
  width: 14px;
  text-align: center;
  color: #5dade2;
  font-size: 13px;
  flex-shrink: 0;
}

.sf-list a {
  color: #5dade2;
  text-decoration: none;
  transition: color 0.2s;
}

.sf-list a:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* Copyright */
.sf-copyright {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
}

.sf-copyright span {
  color: #fff;
}

/* Responsive — su mobile */
@media (max-width: 768px) {
  .lph-title {
    display: none !important;
  }

  body.login-body header.login-page-header {
    padding: 10px 16px !important;
  }

  .lph-logo-sit {
    height: 36px !important;
  }

  .lph-logo-portale {
    height: 32px !important;
    width: 32px !important;
  }

  .lph-logo-bim {
    height: 36px !important;
  }

  .site-footer {
    padding: 28px 5% !important;
  }

  .sf-col {
    margin-bottom: 20px;
  }
}

/* ---- File pill variants (approvatore) ---- */
.file-pill-invio {
  background: #1a6d3a;
}

.file-pill-invio:hover {
  background: #145530;
  color: #fff;
}

.file-pill-missing {
  background: #adb5bd;
  color: #fff;
  cursor: default;
}