/* =========================================================
   UPLOAD MODAL — Hairtude
   ========================================================= */

/* =========================
   OVERLAY
   ========================= */
#uploadModalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

#uploadModalOverlay[aria-hidden="false"] { display: flex; }

#uploadModalOverlay[aria-hidden="false"] > .ht-modal {
  animation: htFadeIn .18s ease;
}

@keyframes htFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* =========================
   MODALE
   ========================= */
#uploadModalOverlay .ht-modal {
  width: min(500px, 100%);
  background: #fafaf8;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
  max-height: 90dvh;
}



/* =========================
   BODY — scrollabile
   ========================= */
#uploadModalOverlay .ht-modal-body {
  padding: 12px 16px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0; /* fondamentale per flex + overflow */
}

/* scrollbar sottile */
#uploadModalOverlay .ht-modal-body::-webkit-scrollbar { width: 4px; }
#uploadModalOverlay .ht-modal-body::-webkit-scrollbar-track { background: transparent; }
#uploadModalOverlay .ht-modal-body::-webkit-scrollbar-thumb {
  background: #d1cfc9;
  border-radius: 2px;
}

/* =========================
   SEZIONI
   ========================= */
#uploadModalOverlay .ht-modal-section {
  margin-bottom: 16px;
}

#uploadModalOverlay .ht-modal-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8c8880;
  margin-bottom: 8px;
}

#uploadModalOverlay .ht-hint,
#uploadClienteHint,
#uploadTipoCapelliHint {
  font-size: .8rem;
  color: #9c9890;
  margin: 6px 0 0;
}

/* =========================
   INPUT / SELECT
   ========================= */
#uploadModalOverlay input,
#uploadModalOverlay select,
#uploadModalOverlay button {
  font-family: inherit;
}

#uploadModalOverlay select {
  font-size: 16px;
}

/* =========================
   SELECT CLIENTE
   ========================= */
#uploadClienteSelect {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid #e2e0da;
  border-radius: 12px;
  background: #fff;
  color: #1a1814;
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238c8880' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  transition: border-color .15s;
}

#uploadClienteSelect:focus {
  outline: none;
  border-color: #c9aa4a;
}

#uploadClienteOtherSection { margin-top: 10px; }

/* =========================
   QUICK GRID CLIENTI
   ========================= */
#uploadModalOverlay #uploadClienteQuickGrid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

@media (max-width: 360px) {
  #uploadModalOverlay #uploadClienteQuickGrid {
    grid-template-columns: 1fr;
  }
}

/* =========================
   RADIO CHOICE (lunghezza / tipo / clienti)
   ========================= */
#uploadModalOverlay .ht-choice-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#uploadModalOverlay .ht-choice {
  position: relative;
  display: block;
  cursor: pointer;
  user-select: none;
}

#uploadModalOverlay .ht-choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

#uploadModalOverlay .ht-choice span {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 8px;
  border: 1.5px solid #e2e0da;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #4a4844;
  background: #fff;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

#uploadModalOverlay .ht-choice span:hover {
  border-color: #bfbdb7;
  background: #f5f3ef;
}

#uploadModalOverlay .ht-choice input:checked + span {
  border-color: #c9aa4a;
  background: #fffbef;
  color: #1a1814;
  box-shadow: 0 0 0 3px rgba(201,170,74,.15);
}

#uploadModalOverlay .ht-choice input:checked + span::before {
  content: "✓";
  font-weight: 900;
  color: #c9aa4a;
  font-size: 12px;
}

/* =========================
   ETICHETTE (chips)
   ========================= */
#uploadEtichetteSectionWrapper {
  background: #fff;
  border: 1.5px solid #e2e0da;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

#uploadModalOverlay .chips-content { }

#uploadModalOverlay .chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .75rem;
}

#uploadModalOverlay .chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .65rem;
  border-radius: 20px;
  background: #f0ede6;
  border: 1px solid #ddd9d0;
  font-size: .75rem;
  font-weight: 600;
  color: #3a3830;
}

#uploadModalOverlay .chip-x {
  background: transparent;
  border: none;
  color: #a09c94;
  cursor: pointer;
  font-size: .875rem;
  padding: 0;
  line-height: 1;
  transition: color .12s;
}

#uploadModalOverlay .chip-x:hover { color: #4a4844; }

#uploadModalOverlay .chips-add {
  display: flex;
  align-items: center;
  gap: .6rem;
}

#uploadModalOverlay .chips-input {
  flex: 1;
  min-width: 0;
  border-radius: 10px;
  border: 1.5px solid #e2e0da;
  padding: 10px 12px;
  font-size: 16px;
  background: #fafaf8;
  color: #1a1814;
  transition: border-color .15s;
}

#uploadModalOverlay .chips-input:focus {
  outline: none;
  border-color: #c9aa4a;
}

#uploadModalOverlay .chips-button {
  background: #1a1814;
  border: none;
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  transition: background .15s;
}

#uploadModalOverlay .chips-button:hover { background: #2e2a24; }

#uploadModalOverlay .chips-suggest-title {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #9c9890;
  margin: .85rem 0 .45rem;
}

#uploadModalOverlay .chips-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

#uploadModalOverlay .chip.suggest {
  background: #fafaf8;
  border: 1.5px dashed #d1cfc9;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}

#uploadModalOverlay .chip.suggest:hover {
  background: #f0ede6;
  border-color: #c9aa4a;
  border-style: solid;
}

#uploadModalOverlay .chips-more {
  display: flex;
  gap: .6rem;
  margin-top: .65rem;
}

#uploadModalOverlay .chips-more-btn {
  background: #fff;
  border: 1.5px solid #e2e0da;
  color: #4a4844;
  font-size: .72rem;
  padding: .4rem .7rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background .12s, border-color .12s;
}

#uploadModalOverlay .chips-more-btn:hover {
  background: #f5f3ef;
  border-color: #bfbdb7;
}

#uploadModalOverlay .chips-more-btn.secondary { color: #8c8880; }

/* =========================
   COLLABORATORI
   ========================= */
#uploadModalOverlay .collaboratori-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#uploadModalOverlay .collaboratore-item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid #e2e0da;
  border-radius: 11px;
  margin-bottom: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

#uploadModalOverlay .collaboratore-item:hover {
  background: #f5f3ef;
  border-color: #bfbdb7;
}

#uploadModalOverlay .collaboratore-item input[type="checkbox"] {
  accent-color: #c9aa4a;
  width: 17px;
  height: 17px;
  cursor: pointer;
}

/* =========================
   PROGRESS
   ========================= */
#upload-status {
  font-size: .85rem;
  color: #4a4844;
  margin-top: 8px;
}

#upload-bar-container {
  height: 5px;
  width: 100%;
  background: #e2e0da;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

#upload-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #c9aa4a, #e8c96a);
  border-radius: 3px;
  transition: width .2s ease;
}

/* =========================
   AZIONI
   ========================= */
#uploadModalOverlay .ht-modal-actions {
  display: flex !important;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
  padding: 12px 16px 14px;
  border-top: 1px solid #ece9e3;
  background: #fafaf8;
  flex-shrink: 0; /* rimane sempre visibile in fondo */
}

/* stacca il body dal footer */
#uploadModalOverlay .ht-modal-body {
  padding-bottom: 4px;
}

#uploadModalCancel {
  flex: 1;
  background: #fff;
  border: 1.5px solid #e2e0da;
  color: #4a4844;
  border-radius: 12px;
  padding: 13px 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

#uploadModalCancel:hover { background: #f5f3ef; border-color: #bfbdb7; }

#uploadModalConfirm {
  flex: 2;
  border: none;
  border-radius: 12px;
  color: #1a1814;
  font-weight: 800;
  font-size: 14px;
  padding: 13px 12px;
  background: linear-gradient(135deg, #e8c96a 0%, #c9aa4a 100%);
  box-shadow: 0 2px 10px rgba(201,170,74,.3);
  cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease, filter .15s;
}

#uploadModalConfirm:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,170,74,.4);
}

#uploadModalConfirm:disabled {
  opacity: .45;
  cursor: not-allowed;
  filter: grayscale(.6);
  box-shadow: none;
  transform: none;
}

/* =========================
   HOTFIX: bottoni figli non rotti da css esterni
   ========================= */
#uploadModalOverlay button {
  font-size: 14px !important;
  text-indent: 0 !important;
  letter-spacing: normal !important;
}

#uploadModalOverlay button span {
  display: inline !important;
  font-size: inherit !important;
  color: inherit !important;
}

#uploadModalOverlay .ht-choice span {
  color: #4a4844 !important;
}

/* =========================
   RESPONSIVO MICRO
   ========================= */
@media (max-width: 360px) {
  #uploadModalOverlay .ht-modal-actions {
    flex-direction: column;
    align-items: stretch;
  }
  #uploadModalOverlay .chips-add {
    flex-direction: column;
    align-items: stretch;
  }
  #uploadModalOverlay .chips-input {
    min-width: auto;
  }
}


#uploadModalOverlay .segmented {
  display: flex;
  border: 1.5px solid #e2e0da;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

#uploadModalOverlay .segmented input[type="radio"] {
  display: none;
}

#uploadModalOverlay .segmented label {
  flex: 1;
  text-align: center;
  padding: 11px 8px;
  font-size: 14px;
  font-weight: 600;
  color: #4a4844;
  cursor: pointer;
  border-right: 1.5px solid #e2e0da;
  transition: background .15s, color .15s;
  user-select: none;
}

#uploadModalOverlay .segmented label:last-of-type {
  border-right: none;
}

#uploadModalOverlay .segmented input[type="radio"]:checked + label {
  background: #fffbef;
  color: #1a1814;
  font-weight: 700;
  box-shadow: inset 0 0 0 1.5px #c9aa4a;
}