/* =====================================================================
   ABRASIVE SOLUTION — CRM Clienti
   Tema brand sopra Bootstrap 5 (vedi brand/BRAND-GUIDELINES.md del sito)
   ===================================================================== */

:root {
  --as-ink:     #101112;
  --as-ink-2:   #191b1d;
  --as-red:     #c81010;
  --as-red-2:   #7e0909;
  --as-paper:   #fbfaf7;
  --as-panel:   #f5f1ea;
  --as-muted:   #74706a;
  --as-line:    rgba(16, 17, 18, .12);
  --as-steel:   #6b7b8d;
  --as-gold-lt: #f2cc82;

  --as-font-display: "Instrument Serif", Georgia, serif;
  --as-font-body:    "Manrope", Arial, sans-serif;

  --as-radius-card: 8px;
  --as-radius-btn:  6px;
  --as-shadow-red:  0 8px 24px rgba(200, 16, 16, .38);

  /* Override variabili Bootstrap */
  --bs-body-font-family: var(--as-font-body);
  --bs-body-bg: var(--as-paper);
  --bs-body-color: var(--as-ink);
  --bs-link-color: var(--as-red);
  --bs-link-hover-color: var(--as-red-2);
}

body {
  font-family: var(--as-font-body);
  background: var(--as-paper);
  color: var(--as-ink);
}

/* ---- Header con logo ---- */
.brand-header {
  background: var(--as-white, #fff);
  border-bottom: 1px solid var(--as-line);
  padding: .65rem 1rem;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-header img {
  height: 34px;
  width: auto;
}

.brand-header .brand-app-name {
  font-family: var(--as-font-body);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--as-muted);
  border-left: 1px solid var(--as-line);
  padding-left: 14px;
}

/* ---- Etichetta rossa angolata (signature del brand) ---- */
.as-label {
  display: inline-block;
  background: var(--as-red);
  color: #fff;
  padding: 8px 22px 8px 12px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .09em;
  text-transform: uppercase;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 100%, 0 100%);
  box-shadow: var(--as-shadow-red);
}

/* ---- Eyebrow ---- */
.as-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--as-red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

/* ---- Titoli in Instrument Serif ---- */
h5, h6, .modal-title {
  font-family: var(--as-font-display);
  font-weight: 400;
  color: var(--as-ink);
}

.sidebar h5 {
  font-size: 24px;
}

.modal-title {
  font-size: 26px;
  line-height: 1.1;
}

.info-card h6 {
  font-size: 20px;
  border-bottom: 1px solid var(--as-line);
  padding-bottom: .45rem;
  margin-bottom: .7rem;
}

/* ---- Sidebar ---- */
.sidebar {
  background-color: var(--as-panel) !important;
  border-right: 1px solid var(--as-line) !important;
}

.sidebar .form-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--as-muted);
}

.form-select, .form-control {
  border-color: var(--as-line);
  border-radius: var(--as-radius-btn);
  font-family: var(--as-font-body);
  background-color: #fff;
}

.form-select:focus, .form-control:focus {
  border-color: var(--as-red);
  box-shadow: 0 0 0 .2rem rgba(200, 16, 16, .15);
}

/* ---- Barra ricerca ---- */
.search-section {
  background: #fff !important;
  border-bottom: 1px solid var(--as-line) !important;
}

.input-group-text {
  background: #fff;
  border-color: var(--as-line);
  color: var(--as-muted);
}

/* ---- Contatori stato (filtri rapidi) ---- */
.stat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: .65rem 1rem;
  background: var(--as-panel);
  border-bottom: 1px solid var(--as-line);
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--as-line);
  background: #fff;
  border-radius: 99px;
  padding: .28rem .85rem;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--as-ink);
  cursor: pointer;
  user-select: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.stat-chip:hover { border-color: var(--as-red); }

.stat-chip.active {
  border-color: var(--as-red);
  box-shadow: 0 0 0 .15rem rgba(200, 16, 16, .12);
}

.stat-chip .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.stat-chip strong { font-weight: 800; }

/* ---- Tabella ---- */
.main-content { background: var(--as-paper) !important; }

.table {
  --bs-table-striped-bg: rgba(245, 241, 234, .55);
  background: #fff;
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-card);
  overflow: hidden;
}

.table th {
  background-color: var(--as-ink) !important;
  color: #fff !important;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  border: none !important;
}

.sortable-header:hover { background-color: var(--as-ink-2) !important; }

.cliente-row:hover { background-color: var(--as-panel) !important; }

/* ---- Badge stato: pill del brand ---- */
.stato-badge, .badge {
  border-radius: 99px;
  font-weight: 700;
  letter-spacing: .02em;
}

.stato-da-contattare { background-color: var(--as-steel) !important; }
.stato-contattato { background-color: #1d4f8f !important; }
.stato-non-interessato { background-color: var(--as-red) !important; }
.stato-cliente-attivo { background-color: #1d7a3a !important; }

.rischio-basso { background-color: #1d7a3a !important; }
.rischio-medio { background-color: var(--as-gold-lt) !important; color: var(--as-ink) !important; }
.rischio-alto { background-color: var(--as-red) !important; }

/* ---- Bottoni ---- */
.btn-primary {
  background: var(--as-red);
  border-color: var(--as-red);
  border-radius: var(--as-radius-btn);
  font-weight: 600;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background: var(--as-red-2) !important;
  border-color: var(--as-red-2) !important;
}

.btn-outline-secondary {
  border-radius: var(--as-radius-btn);
  border-color: var(--as-line);
  color: var(--as-ink);
  font-weight: 600;
}

.btn-outline-secondary:hover {
  background: var(--as-panel);
  border-color: var(--as-line);
  color: var(--as-ink);
}

.btn-outline-primary {
  color: var(--as-red);
  border-color: var(--as-red);
  border-radius: var(--as-radius-btn);
  font-weight: 600;
}

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

/* ---- Modal e card ---- */
.modal-content {
  border-radius: var(--as-radius-card);
  border: 1px solid var(--as-line);
}

.modal-header {
  background-color: var(--as-paper) !important;
  border-bottom: 1px solid var(--as-line);
}

.info-card {
  background-color: #fff !important;
  border: 1px solid var(--as-line) !important;
  border-radius: var(--as-radius-card) !important;
}

.note-item {
  background-color: var(--as-paper) !important;
  border: 1px solid var(--as-line) !important;
  border-radius: var(--as-radius-card) !important;
}

.note-meta { color: var(--as-muted) !important; }

.analisi-content {
  background: var(--as-panel) !important;
  border-left: 4px solid var(--as-red) !important;
  border-radius: var(--as-radius-card) !important;
}

/* ---- Link contatti cliccabili nella scheda ---- */
.contact-link {
  color: var(--as-red);
  text-decoration: none;
  font-weight: 600;
}

.contact-link:hover {
  color: var(--as-red-2);
  text-decoration: underline;
}

/* ---- Pulsante "carica altri" ---- */
.load-more-row td {
  text-align: center;
  padding: .9rem !important;
  background: var(--as-panel);
}


/* =====================================================================
   CRM ABRASIVE SOLUTION v2.0 — STILI MOBILE-FIRST, COCKPIT & QUICK-ACTIONS
   ===================================================================== */

/* ---- Barra di Navigazione Mobile Inferiore (Stile App Nativa) ---- */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  body {
    padding-bottom: 74px !important; /* Spazio per la bottom nav */
  }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #ffffff;
    border-top: 1px solid var(--as-line);
    z-index: 1040;
    box-shadow: 0 -4px 18px rgba(16, 17, 18, 0.08);
    justify-content: space-around;
    align-items: center;
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--as-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    flex: 1;
    height: 100%;
    position: relative;
    transition: color .15s ease;
    cursor: pointer;
    user-select: none;
  }

  .bottom-nav-item i {
    font-size: 20px;
    margin-bottom: 2px;
  }

  .bottom-nav-item.active {
    color: var(--as-red) !important;
  }

  .bottom-nav-item .badge-pill-count {
    position: absolute;
    top: 6px;
    right: calc(50% - 20px);
    background: var(--as-red);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    border-radius: 99px;
    padding: 1px 6px;
  }
}

/* ---- Navigazione Desktop Tab in Testata ---- */
.desktop-nav-tabs {
  display: flex;
  gap: 6px;
  margin-left: 20px;
}

.desktop-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--as-muted);
  cursor: pointer;
  transition: all .2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.desktop-tab-btn:hover {
  color: var(--as-ink);
  background: var(--as-panel);
  border-radius: 6px 6px 0 0;
}

.desktop-tab-btn.active {
  color: var(--as-red);
  border-bottom-color: var(--as-red);
}

@media (max-width: 768px) {
  .desktop-nav-tabs {
    display: none !important;
  }
}

/* ---- Toast Notifications Leggere (Non-Bloccanti) ---- */
.toast-container-custom {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1099;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  width: calc(100% - 32px);
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  background: #101112;
  color: #fff;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 10px 30px rgba(16, 17, 18, 0.35);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: slideInToast .25s ease forwards;
}

.toast-item.toast-success { border-left: 4px solid #1d7a3a; }
.toast-item.toast-error   { border-left: 4px solid #c81010; }
.toast-item.toast-info    { border-left: 4px solid #1d4f8f; }

@keyframes slideInToast {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Action Cards per "Il Mio Lavoro Oggi" e Visualizzazione Mobile ---- */
.action-card {
  background: #ffffff;
  border: 1px solid var(--as-line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 6px rgba(16, 17, 18, 0.04);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.action-card:hover {
  border-color: rgba(200, 16, 16, .35);
  box-shadow: 0 6px 18px rgba(16, 17, 18, 0.08);
}

.action-card.card-urgent {
  border-left: 5px solid var(--as-red);
}

.action-card.card-sample {
  border-left: 5px solid #e67e22;
}

.action-card.card-today {
  border-left: 5px solid #1d4f8f;
}

.action-card.card-quote {
  border-left: 5px solid #8e44ad;
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}

.card-company-name {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--as-ink);
  line-height: 1.25;
}

.card-meta-line {
  font-size: 12.5px;
  color: var(--as-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.card-task-title {
  background: var(--as-panel);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--as-ink);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* ---- Bottoni Touch Ergonomici (Mobile Friendly) ---- */
.btn-touch {
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  user-select: none;
  transition: transform .1s ease, background .15s ease;
}

.btn-touch:active {
  transform: scale(0.97);
}

.btn-touch-call {
  background: #1d7a3a;
  color: #fff;
  border: none;
}
.btn-touch-call:hover, .btn-touch-call:active {
  background: #145829 !important;
  color: #fff;
}

.btn-touch-wa {
  background: #25d366;
  color: #0b391a;
  border: none;
}
.btn-touch-wa:hover, .btn-touch-wa:active {
  background: #1ebe5d !important;
  color: #0b391a;
}

.btn-touch-log {
  background: var(--as-red);
  color: #fff;
  border: none;
}
.btn-touch-log:hover, .btn-touch-log:active {
  background: var(--as-red-2) !important;
  color: #fff;
}

.btn-touch-outline {
  background: #fff;
  border: 1px solid var(--as-line);
  color: var(--as-ink);
}
.btn-touch-outline:hover {
  background: var(--as-panel);
  border-color: var(--as-line);
}

/* ---- Chip Esiti Chiamata (Logger Rapido 25s) ---- */
.outcome-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.outcome-chip {
  padding: 8px 14px;
  background: var(--as-panel);
  border: 1px solid var(--as-line);
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: all .15s ease;
}

.outcome-chip:hover {
  border-color: var(--as-red);
}

.outcome-chip.selected {
  background: var(--as-red);
  color: #fff;
  border-color: var(--as-red);
  box-shadow: 0 4px 12px rgba(200, 16, 16, .3);
}

/* ---- Badge Telefono Verificato e Rischio Neutro ---- */
.badge-verified {
  background: #e8f5e9;
  color: #1b5e20;
  border: 1px solid #a5d6a7;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rischio-unknown {
  background: #e0e0e0 !important;
  color: #424242 !important;
}

/* ---- Modale Full-Screen su Mobile ---- */
@media (max-width: 768px) {
  .modal-dialog-fullscreen-mobile {
    margin: 0 !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
  }

  .modal-dialog-fullscreen-mobile .modal-content {
    height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    display: flex;
    flex-direction: column;
  }

  .modal-dialog-fullscreen-mobile .modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px !important;
  }

  .sticky-modal-bottom-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--as-line);
    padding: 10px 14px;
    z-index: 10;
    display: flex;
    gap: 8px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, .08);
  }
}

/* ---- Tag Tecniche Abrasivi Selezionabili ---- */
.tag-badge {
  display: inline-block;
  background: #ffffff;
  border: 1px solid var(--as-line);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  margin: 2px 4px 2px 0;
}

.tag-badge.tag-selectable {
  cursor: pointer;
}

.tag-badge.tag-selectable:hover {
  border-color: var(--as-red);
}

.tag-badge.tag-selectable.active {
  background: var(--as-red);
  color: #fff;
  border-color: var(--as-red);
}
