/* Stili custom Fiera Olivicola — CSS puro (no @apply, Tailwind via CDN non lo processa) */

/* ============================================================
   FORM CONTROLS — bordi sempre visibili in tutte le modali/form
   ============================================================ */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="file"],
select,
textarea,
.input {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  line-height: 1.4;
  color: #1f2937;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;       /* slate-300 */
  border-radius: 0.5rem;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
  outline: none;
  box-sizing: border-box;
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
input[type="search"]:hover,
input[type="date"]:hover,
select:hover,
textarea:hover,
.input:hover {
  border-color: #94a3b8;            /* slate-400 */
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="time"]:focus,
select:focus,
textarea:focus,
.input:focus {
  border-color: #7CB342;            /* olive-500 */
  box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.25);
  background-color: #ffffff;
}

input[disabled],
select[disabled],
textarea[disabled],
.input[disabled] {
  background-color: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 16px 16px;
  padding-right: 2.2rem;
}

/* Label form */
.label,
label.label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;                   /* slate-700 */
  margin-bottom: 0.35rem;
}

/* Wrapper per riga input (label sopra, input sotto) */
.field { margin-bottom: 0.9rem; }
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-bottom: 0.9rem;
}
@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
}

/* Checkbox / radio */
input[type="checkbox"],
input[type="radio"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #558B2F;
  cursor: pointer;
}

/* ============================================================
   BADGE — stati colorati
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge-green   { background:#dcfce7; color:#166534; }
.badge-yellow  { background:#fef9c3; color:#854d0e; }
.badge-red     { background:#fee2e2; color:#991b1b; }
.badge-gray    { background:#e5e7eb; color:#374151; }
.badge-blue    { background:#dbeafe; color:#1e40af; }
.badge-purple  { background:#ede9fe; color:#5b21b6; }
.badge-orange  { background:#ffedd5; color:#9a3412; }

/* ============================================================
   STAND CARDS (2D)
   ============================================================ */
.stand-card {
  border: 1px solid rgba(0,0,0,0.08);
  transition: transform .15s ease, box-shadow .15s ease;
}
.stand-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

/* ============================================================
   CANVAS 3D
   ============================================================ */
#three-canvas {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  cursor: grab;
}
#three-canvas:active { cursor: grabbing; }

.stand-tooltip {
  position: fixed;
  pointer-events: none;
  background: rgba(33, 33, 33, 0.95);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  z-index: 9999;
  display: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.stand-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(33,33,33,0.95);
}

/* ============================================================
   LOADER
   ============================================================ */
.loader {
  border: 3px solid #eef6dc;
  border-top: 3px solid #558B2F;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-radius: 0.5rem;
  color: #475569;
  transition: all .15s;
  text-decoration: none;
}
.sidebar-link:hover { background: #eef6dc; color: #33691E; }
.sidebar-link.active {
  background: linear-gradient(90deg, #7CB342, #558B2F);
  color: white;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: #1f2937;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 10000;
  animation: slidein .3s ease-out;
}
.toast.success { background: #16a34a; }
.toast.error   { background: #dc2626; }
@keyframes slidein { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================================================
   LEGENDA
   ============================================================ */
.legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; }
.legend-swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.1); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .15s, transform .05s, box-shadow .15s;
  text-decoration: none;
  line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary   { background:#558B2F; color:#fff; }
.btn-primary:hover   { background:#33691E; }
.btn-secondary { background:#fff; color:#334155; border-color:#cbd5e1; }
.btn-secondary:hover { background:#f8fafc; border-color:#94a3b8; }
.btn-danger    { background:#dc2626; color:#fff; }
.btn-danger:hover    { background:#b91c1c; }
.btn-warning   { background:#f59e0b; color:#fff; }
.btn-warning:hover   { background:#d97706; }
.btn-sm { padding:0.35rem 0.7rem; font-size:0.82rem; }

/* ============================================================
   TABELLA
   ============================================================ */
.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; text-align: left; }
.tbl thead th {
  background: #eef6dc;
  color: #33691E;
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #d4e4b3;
  white-space: nowrap;
}
.tbl tbody td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}
.tbl tbody tr:hover { background: #f7fbef; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  backdrop-filter: blur(2px);
}
.modal-content {
  background: white;
  border-radius: 1rem;
  padding: 1.6rem;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-content h2,
.modal-content h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: #33691E;
  font-weight: 700;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

/* ============================================================
   PLANIMETRIA 2D (SVG)
   ============================================================ */
.plan2d-container {
  width: 100%;
  height: 100%;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
  position: relative;
}
.plan2d-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stand-rect:hover {
  filter: brightness(1.12) drop-shadow(0 0 2px rgba(0,0,0,0.3));
}

/* Tooltip planimetria 2D */
.plan2d-tooltip {
  position: fixed;
  pointer-events: none;
  background: white;
  color: #1f2937;
  padding: 0.55rem 0.8rem;
  border-radius: 0.55rem;
  font-size: 0.83rem;
  z-index: 9999;
  display: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  border: 1px solid #e5e7eb;
  min-width: 180px;
  max-width: 260px;
}
.plan2d-tooltip .tt-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #33691E;
  margin-bottom: 0.25rem;
}
.plan2d-tooltip .tt-cat {
  font-size: 0.78rem;
  color: #475569;
  margin: 0.3rem 0;
  line-height: 1.3;
}
.plan2d-tooltip .tt-az {
  font-weight: 600;
  color: #1e40af;
  margin: 0.3rem 0;
}
.plan2d-tooltip .tt-empty {
  font-style: italic;
  color: #94a3b8;
  margin: 0.3rem 0;
}
.plan2d-tooltip .tt-stato {
  font-size: 0.75rem;
  color: #64748b;
  border-top: 1px solid #f1f5f9;
  padding-top: 0.3rem;
  margin-top: 0.3rem;
}

/* Legenda macro-aree */
.legend-macro {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.legend-macro-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 0.5rem;
  background: white;
  border: 1px solid #e5e7eb;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all .15s;
}
.legend-macro-item:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}
.legend-macro-item.active {
  border-color: #558B2F;
  background: #f1f8e9;
  font-weight: 600;
}
.legend-macro-swatch {
  width: 14px; height: 14px; border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.1);
}

/* Pannello dettaglio stand a destra */
.stand-detail-panel {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.stand-detail-panel h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #33691E;
}
.stand-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.88rem;
}
.stand-detail-row .lbl { color: #64748b; }
.stand-detail-row .val { font-weight: 600; color: #1f2937; }

/* ============================================================
   PULSE
   ============================================================ */
@keyframes pulse-olive {
  0%,100% { box-shadow: 0 0 0 0 rgba(124,179,66,0.7); }
  50%     { box-shadow: 0 0 0 8px rgba(124,179,66,0); }
}
.pulse-olive { animation: pulse-olive 2s infinite; }

/* ============================================================
   GESTIONE CATEGORIE & STAND (pannello planimetria admin)
   ============================================================ */
.cat-manager-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}
.cat-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
  transition: background .15s, border-color .15s;
}
.cat-row:hover { background: #f8fafc; border-color: #cbd5e1; }
.cat-row.active {
  background: #ecfccb;
  border-color: #84cc16;
}
.cat-row-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.cat-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.1);
}
.cat-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cat-code {
  display: inline-block;
  font-family: monospace;
  background: #f1f5f9;
  color: #475569;
  padding: 0 0.3rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  margin-right: 0.3rem;
}
.cat-meta {
  font-size: 0.7rem;
  color: #64748b;
  display: flex;
  gap: 0.6rem;
  margin-top: 0.1rem;
}
.cat-row-actions {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}
.cat-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .12s;
}
.cat-btn:hover:not(:disabled) {
  background: #e2e8f0;
}
.cat-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.cat-btn-add:hover { background: #dcfce7; color: #15803d; border-color: #86efac; }
.cat-btn-remove:hover:not(:disabled) { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.cat-btn-edit:hover { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.cat-btn-delete:hover { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

.cat-modal-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: #f8fafc;
  padding: 0.7rem;
  border-radius: 0.4rem;
  margin-bottom: 0.8rem;
  border: 1px solid #e2e8f0;
}

.modal-form fieldset {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.8rem;
  margin-bottom: 0.8rem;
}
.modal-form fieldset legend {
  padding: 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #558b2f;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.btn-danger {
  background: #dc2626;
  color: white;
}
.btn-danger:hover { background: #b91c1c; }

/* ============ Sidebar pending badge ============ */
.sb-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.5rem;
  border-radius: 9999px;
  background: #dc2626;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}
.sb-badge.hidden { display: none; }

/* ============ Pagina Aziende da accettare ============ */
.pending-empty {
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 0.75rem;
  padding: 2.5rem;
  text-align: center;
  color: #64748b;
}
.pending-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #f59e0b;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}
.pending-card .pc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.pending-card .pc-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: #166534;
}
.pending-card .pc-meta {
  color: #64748b;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}
.pending-card .pc-data {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem 1rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #e2e8f0;
}
.pending-card .pc-data div {
  font-size: 0.85rem;
}
.pending-card .pc-data .pc-label {
  color: #94a3b8;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.pending-card .pc-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
