/* ============================================================
   CAMICERIA GEST — STYLE.CSS
   Override e componenti specifici Admin/Operatore
   Il design system base è in theme.css (caricato prima)
   Versione: v20260508a
   ============================================================ */

/* ── Profilo pagina ── */
.profilo-wrap {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 4px;
}
.profilo-header-card {
  background: linear-gradient(135deg, var(--night), var(--night-2));
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  border: 1px solid rgba(176,138,78,.2);
}
.profilo-avatar-big {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--bronze-dark), var(--bronze-light));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 800; color: white;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(138,104,48,.4);
}
.profilo-nome { font-size: 1.2rem; font-weight: 800; color: white; }
.profilo-ruolo {
  font-size: .75rem; color: var(--bronze-light);
  text-transform: capitalize; letter-spacing: .5px;
  margin-top: 3px;
}

/* ── Dashboard: sezione attività recente ── */
.activity-list { display: flex; flex-direction: column; gap: 10px; }
.activity-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  background: var(--gray-50);
  border-radius: 10px;
  border: 1px solid var(--gray-100);
  transition: background var(--transition);
}
.activity-item:hover { background: var(--bronze-subtle); }
.activity-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.activity-icon.bronze { background: var(--bronze-subtle); color: var(--bronze-dark); }
.activity-icon.green  { background: var(--success-bg);    color: var(--success); }
.activity-icon.blue   { background: var(--info-bg);       color: var(--info); }
.activity-icon.red    { background: var(--danger-bg);     color: var(--danger); }
.activity-text { flex: 1; min-width: 0; }
.activity-title { font-weight: 600; font-size: .875rem; color: var(--night); }
.activity-sub   { font-size: .75rem; color: var(--gray-500); margin-top: 1px; }
.activity-time  { font-size: .72rem; color: var(--gray-400); white-space: nowrap; flex-shrink: 0; }

/* ── Assistente acquisti ── */
.assistente-chat-wrap {
  display: flex; flex-direction: column;
  height: calc(100vh - 200px); min-height: 400px;
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--gray-200); overflow: hidden;
  box-shadow: var(--shadow);
}
.assistente-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--cream);
}
.assistente-msg { display: flex; gap: 10px; max-width: 82%; }
.assistente-msg.user { flex-direction: row-reverse; align-self: flex-end; }
.assistente-bubble {
  padding: 11px 16px; border-radius: 16px;
  font-size: .875rem; line-height: 1.55;
}
.assistente-msg.ai .assistente-bubble {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: 4px 16px 16px 16px; color: var(--gray-800);
}
.assistente-msg.user .assistente-bubble {
  background: linear-gradient(135deg, var(--night), var(--night-3));
  color: white; border-radius: 16px 4px 16px 16px;
}
.assistente-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; flex-shrink: 0;
}
.assistente-msg.ai .assistente-avatar {
  background: linear-gradient(135deg, var(--bronze-dark), var(--bronze));
  color: white;
}
.assistente-msg.user .assistente-avatar { background: var(--gray-200); color: var(--gray-600); }
.assistente-input-bar {
  display: flex; gap: 10px; padding: 14px;
  background: var(--white); border-top: 1px solid var(--gray-200);
}
.assistente-input {
  flex: 1; padding: 10px 16px;
  border: 1.5px solid var(--gray-200); border-radius: 24px;
  font-family: inherit; font-size: .875rem;
  outline: none; resize: none; height: 44px; max-height: 120px;
  transition: border-color var(--transition);
}
.assistente-input:focus { border-color: var(--bronze); }
.assistente-send {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--night), var(--night-3));
  color: white; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: all var(--transition); flex-shrink: 0;
}
.assistente-send:hover { opacity: .9; transform: scale(1.05); }

/* ── Gestione clienti: card cliente ── */
.cliente-card {
  background: var(--white); border: 1.5px solid var(--gray-200);
  border-radius: 14px; padding: 16px 20px;
  margin-bottom: 12px; transition: all var(--transition);
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
}
.cliente-card:hover { border-color: var(--bronze-light); box-shadow: var(--shadow-md); }
.cliente-nome { font-weight: 700; font-size: 1rem; color: var(--night); }
.cliente-info { font-size: .8rem; color: var(--gray-500); margin-top: 3px; }
.cliente-info i { color: var(--bronze); margin-right: 5px; }

/* ── Reminder / Promemoria ── */
.reminder-card {
  background: var(--warning-bg);
  border: 1.5px solid var(--warning-border);
  border-radius: 12px; padding: 14px 18px;
  margin-bottom: 12px;
  display: flex; align-items: flex-start; gap: 12px;
}
.reminder-card.done {
  background: var(--success-bg);
  border-color: var(--success-border);
  opacity: .7;
}
.reminder-card i { color: var(--warning); font-size: 1.1rem; margin-top: 1px; flex-shrink: 0; }
.reminder-card.done i { color: var(--success); }
.reminder-text { flex: 1; font-size: .875rem; color: var(--gray-800); }
.reminder-date { font-size: .72rem; color: var(--gray-500); margin-top: 3px; }

/* ── FAB (Floating Action Button) ── */
#fabMenu {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 500;
}
.fab-btn {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--bronze-dark), var(--bronze));
  color: white; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 6px 24px rgba(138,104,48,.4);
  transition: all var(--transition);
}
.fab-btn:hover { transform: scale(1.08); box-shadow: 0 10px 32px rgba(138,104,48,.55); }

/* ── Scheda Operatore: sezione tessuto selezionato ── */
.op-tessuto-selected {
  display: flex; align-items: center; gap: 12px;
  background: var(--bronze-subtle);
  border: 1.5px solid var(--bronze-light);
  border-radius: 12px; padding: 12px 16px;
  margin-bottom: 12px;
}
.op-tessuto-thumb {
  width: 56px; height: 56px; object-fit: cover;
  border-radius: 8px; flex-shrink: 0;
  border: 1px solid var(--bronze-light);
}
.op-tessuto-info { flex: 1; min-width: 0; }
.op-tessuto-nome { font-weight: 700; font-size: .95rem; color: var(--night); }
.op-tessuto-sub  { font-size: .75rem; color: var(--bronze); margin-top: 2px; }

/* ── Popup smistamento (Su Misura / Confezione) ── */
.smistamento-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(13,27,46,.75);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeInSm .2s ease;
}
@keyframes fadeInSm { from { opacity:0; } to { opacity:1; } }
.smistamento-card {
  background: var(--white); border-radius: 20px;
  padding: 28px 28px 24px;
  max-width: 400px; width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
  border-top: 4px solid var(--bronze);
  animation: slideUpSm .25s ease;
}
@keyframes slideUpSm { from { transform: translateY(24px) scale(.97); opacity:0; } to { transform: none; opacity:1; } }
.smistamento-title {
  font-size: 1rem; font-weight: 800; color: var(--night);
  margin-bottom: 6px; display: flex; align-items: center; gap: 8px;
}
.smistamento-title i { color: var(--bronze); }
.smistamento-tessuto-nome {
  font-size: .88rem; color: var(--gray-600); margin-bottom: 20px;
  padding: 8px 12px; background: var(--bronze-subtle);
  border-radius: 8px; border-left: 3px solid var(--bronze);
  font-weight: 600;
}
.smistamento-buttons { display: flex; flex-direction: column; gap: 10px; }
.smistamento-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: 12px;
  border: 1.5px solid var(--gray-200);
  background: var(--white); cursor: pointer;
  transition: all var(--transition); font-family: inherit;
  text-align: left; width: 100%;
}
.smistamento-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.smistamento-btn.primary {
  background: linear-gradient(135deg, var(--bronze-dark), var(--bronze));
  border-color: transparent; color: white;
}
.smistamento-btn.primary:hover { box-shadow: 0 4px 16px rgba(138,104,48,.4); }
.smistamento-btn.secondary { border-color: var(--night-3); }
.smistamento-btn.secondary:hover { background: var(--night); color: white; border-color: var(--night); }
.smistamento-btn-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
  background: rgba(255,255,255,.15);
}
.smistamento-btn.secondary .smistamento-btn-icon { background: var(--bronze-subtle); color: var(--bronze); }
.smistamento-btn-label { font-weight: 700; font-size: .9rem; }
.smistamento-btn-desc  { font-size: .75rem; opacity: .8; margin-top: 1px; }
.smistamento-cancel {
  margin-top: 6px; padding: 10px;
  background: none; border: none; width: 100%;
  font-family: inherit; font-size: .82rem; font-weight: 600;
  color: var(--gray-500); cursor: pointer; border-radius: 8px;
  transition: color var(--transition), background var(--transition);
}
.smistamento-cancel:hover { color: var(--danger); background: var(--danger-bg); }

/* ── Book tessuti: variante lightbox ── */
.op-var-lightbox {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(13,27,46,.88);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeInSm .18s ease;
}
.op-var-lightbox-inner {
  background: var(--white); border-radius: var(--radius-lg);
  max-width: 560px; width: 100%;
  max-height: 92vh; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 32px 80px rgba(0,0,0,.45);
  animation: slideUpSm .22s ease;
}
.op-var-lightbox-img {
  width: 100%; max-height: 200px;
  object-fit: contain; background: var(--cream);
  display: block; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  flex-shrink: 0;
}
.op-var-lightbox-body { padding: 16px 20px 20px; flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--bronze) transparent; }
.op-var-lightbox-nome { font-size: 1.05rem; font-weight: 800; color: var(--night); margin: 0 0 6px; }
.op-var-lightbox-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.op-var-lightbox-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

/* ── Book: griglia varianti (pannello dettaglio) ── */
.shop-book-det-varianti {
  display: flex; flex-direction: column; gap: 8px;
}
.shop-book-det-variante-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1.5px solid var(--gray-200);
  border-radius: 10px; cursor: pointer; transition: all .15s; background: var(--white);
}
.shop-book-det-variante-row:hover { border-color: var(--bronze); background: var(--bronze-subtle); }

/* ── Stato ordini badge (admin e operatore) ── */
.stato-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  font-size: .7rem; font-weight: 700; white-space: nowrap;
}
.stato-attesa      { background: var(--warning-bg); color: #78350f; border: 1px solid var(--warning-border); }
.stato-lavorazione { background: var(--info-bg); color: #1e3a8a; border: 1px solid var(--info-border); }
.stato-spedito     { background: #ede9fe; color: #4c1d95; border: 1px solid #c4b5fd; }
.stato-completato  { background: var(--success-bg); color: #145a30; border: 1px solid var(--success-border); }
.stato-consegnato  { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-300); }
.stato-annullato   { background: var(--danger-bg); color: #8b1a1a; border: 1px solid var(--danger-border); }
.stato-bozza       { background: var(--gray-50); color: var(--gray-400); border: 1px solid var(--gray-200); }

/* ── Su Misura: card ordine ── */
.sm-ordine-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 14px; margin-bottom: 12px;
  overflow: hidden; box-shadow: var(--shadow);
  transition: all var(--transition);
}
.sm-ordine-card:hover { border-color: var(--bronze-light); box-shadow: var(--shadow-md); }
.sm-ordine-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; flex-wrap: wrap; gap: 8px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  background: var(--cream-light);
}
.sm-ordine-card:hover .sm-ordine-header {
  border-left-color: var(--bronze);
  background: var(--bronze-subtle);
}

/* ── Filtri: tab button group ── */
.tab-group {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 4px; background: var(--gray-100); border-radius: 10px;
  margin-bottom: 16px;
}
.tab-group .btn {
  flex: 1; justify-content: center;
  background: transparent; color: var(--gray-600);
  border: none; border-radius: 8px; padding: 8px 14px;
}
.tab-group .btn.active {
  background: var(--white); color: var(--night);
  box-shadow: 0 1px 8px rgba(0,0,0,.08);
}

/* ── Popup dialog tessuto smistamento (version condivisa) ──
   Usato da _opBookChiediDestinazioneDialog in catalogo.js    */
.op-dest-overlay {
  position: fixed; inset: 0; z-index: 2500;
  background: rgba(13,27,46,.8);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.op-dest-card {
  background: var(--white); border-radius: 20px;
  padding: 26px 26px 22px; max-width: 380px; width: 100%;
  box-shadow: var(--shadow-xl);
  border-top: 4px solid var(--bronze);
}
.op-dest-icon {
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, var(--bronze-dark), var(--bronze-light));
  color: white; font-size: 1.4rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; box-shadow: 0 6px 20px rgba(138,104,48,.4);
}
.op-dest-title {
  font-size: 1rem; font-weight: 800; color: var(--night); text-align: center; margin-bottom: 4px;
}
.op-dest-sub {
  font-size: .82rem; color: var(--bronze); text-align: center;
  font-weight: 600; margin-bottom: 18px;
  padding: 6px 10px; background: var(--bronze-bg); border-radius: 6px;
}
.op-dest-actions { display: flex; flex-direction: column; gap: 9px; }
.op-dest-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--gray-200); background: var(--white);
  font-family: inherit; transition: all var(--transition); width: 100%;
}
.op-dest-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.1); }
.op-dest-btn.is-primary {
  background: linear-gradient(135deg, var(--bronze-dark), var(--bronze));
  border-color: transparent; color: white;
  box-shadow: 0 3px 12px rgba(138,104,48,.28);
}
.op-dest-btn.is-primary:hover { box-shadow: 0 6px 20px rgba(138,104,48,.4); }
.op-dest-btn.is-secondary {
  border-color: var(--night-3); color: var(--night);
}
.op-dest-btn.is-secondary:hover { background: var(--night); color: white; }
.op-dest-btn-ico {
  width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
  background: rgba(255,255,255,.18);
}
.op-dest-btn.is-secondary .op-dest-btn-ico { background: var(--bronze-subtle); color: var(--bronze); }
.op-dest-btn-text { flex: 1; text-align: left; }
.op-dest-btn-label { font-weight: 700; font-size: .88rem; display: block; }
.op-dest-btn-desc  { font-size: .72rem; opacity: .8; margin-top: 1px; display: block; }
.op-dest-cancel {
  margin-top: 4px; padding: 9px; background: none; border: none; width: 100%;
  font-family: inherit; font-size: .8rem; font-weight: 600; color: var(--gray-400);
  cursor: pointer; border-radius: 8px; transition: all var(--transition);
}
.op-dest-cancel:hover { color: var(--danger); background: var(--danger-bg); }

/* ── Loader spinner generico ── */
.app-spinner {
  display: flex; align-items: center; justify-content: center;
  padding: 60px 20px; flex-direction: column; gap: 14px;
}
.app-spinner-ring {
  width: 48px; height: 48px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--bronze);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.app-spinner p { font-size: .875rem; color: var(--gray-500); }

/* ── Su Misura: tessuto selezionato nel form ── */
#smTessutoSelezionato {
  display: flex; align-items: center; gap: 12px;
  background: var(--bronze-subtle);
  border: 1.5px solid var(--bronze-light);
  border-radius: 10px; padding: 10px 14px;
  margin-bottom: 8px;
}
#smTessutoSelNome { font-weight: 700; font-size: .9rem; color: var(--night); }
#smTessutoSelInfo { font-size: .75rem; color: var(--bronze); margin-top: 2px; }
.sm-tessuto-remove {
  margin-left: auto; background: none; border: none; color: var(--gray-400);
  cursor: pointer; font-size: .9rem; padding: 4px;
  transition: color var(--transition); border-radius: 4px;
}
.sm-tessuto-remove:hover { color: var(--danger); }

/* ── Responsive admin-specific ── */
@media (max-width: 768px) {
  .op-var-lightbox-inner { max-width: 100%; border-radius: 16px 16px 0 0; }
  .smistamento-card { border-radius: 16px 16px 0 0; max-width: 100%; }
  .op-dest-card { border-radius: 16px 16px 0 0; max-width: 100%; }
  .profilo-header-card { flex-direction: column; text-align: center; padding: 20px; }
  .tab-group { gap: 2px; }
  .tab-group .btn { font-size: .78rem; padding: 7px 10px; }
  .cliente-card { padding: 12px 14px; }
  .sm-ordine-header { padding: 12px 14px; }
}

@media (max-width: 480px) {
  .smistamento-overlay,
  .op-dest-overlay { padding: 0; align-items: flex-end; }
  .smistamento-buttons { gap: 8px; }
  .smistamento-btn { padding: 12px 14px; }
  .op-dest-actions { gap: 7px; }
}

/* ── TOOLTIP pulsanti ────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #0d1b2e;
  color: #f4efe8;
  font-size: .68rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #0d1b2e;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 9999;
}
[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
}
