/* Componenti delle pagine del pannello (tabelle, badge, strumenti), nello stile EvoCRM */

/* ---- Tabelle elenco (DataTables) ---- */

.list-box {
  overflow: hidden;
}

.list-table-wrap {
  display: block;
  padding: 0.5rem 0.85rem 0.85rem;
}

.list-table {
  width: 100% !important;
  margin-bottom: 0;
  font-size: 0.875rem;
}

.list-table th,
.list-table td {
  padding: 0.5rem 0.65rem;
  vertical-align: middle;
}

.list-table thead th {
  background: var(--evo-content-bg);
  border-bottom: 1px solid var(--evo-border);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--evo-muted);
  font-weight: 600;
  white-space: nowrap;
}

.list-table tbody td {
  border-color: var(--evo-border);
}

.list-table tbody tr:hover td {
  background: var(--evo-primary-soft);
}

.list-table-wrap .dataTables_wrapper .row {
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 0.5rem;
}

.list-table-wrap .dataTables_wrapper .row:first-child {
  margin-bottom: 0.65rem;
}

.list-table-wrap .dataTables_length label,
.list-table-wrap .dataTables_filter label,
.list-table-wrap .dataTables_info {
  font-size: 0.84rem;
  color: var(--evo-muted);
  margin-bottom: 0;
}

.list-table-wrap .dataTables_wrapper .dataTables_paginate {
  padding-top: 0.35rem;
  font-size: 0.84rem;
}

.list-table-wrap .dataTables_wrapper .page-item.active .page-link {
  background: var(--evo-primary);
  border-color: var(--evo-primary);
  color: #fff;
}

.list-table-wrap .page-link {
  color: var(--evo-primary);
}

.list-table-wrap .page-link:focus {
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25) !important;
}

/* ---- Codici e badge ---- */

.client-code,
.file-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  color: var(--evo-muted);
}

.count-badge {
  display: inline-block;
  min-width: 2rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  padding: 0.15rem 0.5rem;
  border-radius: 2rem;
  color: var(--evo-primary);
  border: 1px solid rgba(94, 141, 94, 0.35);
  background: var(--evo-primary-soft);
}

.empty-state {
  margin: 1rem;
}

/* ---- Dashboard ---- */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr));
  gap: 0.85rem;
}

.dashboard-grid > .box {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.dashboard-grid .box-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.dashboard-grid .box-body p {
  font-size: 0.9rem;
  color: var(--evo-muted);
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
}

/* ---- Layout a due colonne (strumenti) ---- */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.tool-grid > .box {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.tool-grid .box-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

@media (max-width: 991.98px) {
  .tool-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- Generatore QR Code ---- */

.qrcode-tabs {
  margin-bottom: 1rem;
}

.qrcode-tabs .nav-link {
  color: var(--evo-muted);
}

.qrcode-tabs .nav-link.active {
  color: var(--evo-primary);
  font-weight: 600;
}

.qrcode-preview-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 324px;
  border: 1px dashed var(--evo-border);
  border-radius: 0.5rem;
  background: var(--evo-content-bg);
}

.qrcode-preview-slot img {
  display: inline-block;
  background: #ffffff;
  padding: 12px;
  border-radius: 0.5rem;
}

.qrcode-preview-empty {
  color: var(--evo-muted);
  font-size: 0.9rem;
  padding: 1rem;
}

.qrcode-help ul {
  padding-left: 1.2rem;
}

/* ---- Ottimizzatore immagini ---- */

.imgopt-upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 170px;
  border: 2px dashed var(--evo-border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--evo-content-bg);
  transition: border-color 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.imgopt-upload-zone:hover,
.imgopt-upload-zone:focus-visible,
.imgopt-upload-zone.imgopt-dragover {
  border-color: var(--evo-primary);
  background: var(--evo-primary-soft);
  outline: none;
}

.imgopt-upload-zone.imgopt-zone-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.imgopt-upload-zone > i {
  font-size: 2rem;
  color: var(--evo-primary);
  margin-bottom: 0.5rem;
}

.imgopt-file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.imgopt-upload-label {
  font-weight: 600;
}

.imgopt-upload-hint {
  font-size: 0.85rem;
}

.imgopt-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.imgopt-name-preview {
  margin-top: 0.5rem;
}

.imgopt-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.imgopt-totals {
  margin-left: auto;
}

@media (max-width: 991.98px) {
  .imgopt-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .imgopt-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .imgopt-totals {
    margin-left: 0;
    width: 100%;
  }
}

/* Avanzamento nell'intestazione dell'elenco */
.imgopt-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 14rem;
}

.imgopt-progress.d-none {
  display: none !important;
}

.imgopt-progress .progress {
  flex: 1;
  height: 0.5rem;
}

.imgopt-progress .progress-bar {
  background-color: var(--evo-primary);
  transition: width 0.25s ease;
}

/* Tabella file */
.imgopt-col-thumb {
  width: 3.25rem;
}

#imgopt-table-wrap {
  overflow-x: auto;
}

/* La colonna nome occupa lo spazio residuo e tronca i testi lunghi */
.imgopt-col-name {
  width: 100%;
  max-width: 0;
  min-width: 9rem;
}

.imgopt-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  object-fit: cover;
  border-radius: 0.35rem;
  border: 1px solid var(--evo-border);
  background: var(--evo-content-bg);
}

.imgopt-thumb-empty {
  color: var(--evo-muted);
}

.imgopt-status {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 2rem;
  border: 1px solid var(--evo-border);
  color: var(--evo-muted);
  background: #ffffff;
  white-space: nowrap;
}

.imgopt-status-working {
  color: var(--evo-info);
  border-color: rgba(23, 162, 184, 0.35);
  background: rgba(23, 162, 184, 0.08);
}

.imgopt-status-done {
  color: var(--evo-primary);
  border-color: rgba(94, 141, 94, 0.35);
  background: var(--evo-primary-soft);
}

.imgopt-status-error,
.imgopt-status-invalid {
  color: var(--evo-danger);
  border-color: rgba(192, 57, 43, 0.35);
  background: rgba(192, 57, 43, 0.08);
}

.imgopt-status .spinner-border-sm {
  width: 0.7rem;
  height: 0.7rem;
  border-width: 0.12em;
}

.imgopt-status-message {
  font-size: 0.75rem;
  color: var(--evo-danger);
  margin-top: 0.2rem;
}

.imgopt-saving {
  color: var(--evo-primary);
  font-weight: 600;
}

/* Riepilogo finale */
.imgopt-summary-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}

.imgopt-summary-icon {
  font-size: 1.75rem;
  line-height: 1;
  color: var(--evo-primary);
}

.imgopt-summary-text {
  flex: 1;
  min-width: 12rem;
}

.imgopt-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---- Anteprima presentazioni (Figma / Canva) ---- */

.presentation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(26rem, 1fr));
  gap: 0.85rem;
}

.presentation-grid > .box {
  margin-bottom: 0;
}

.presentation-meta {
  font-size: 0.8125rem;
  color: var(--evo-muted);
}

.presentation-embed iframe,
.presentation-embed embed,
.presentation-embed object {
  width: 100%;
  min-height: 320px;
  border: 0;
  border-radius: 0.45rem;
}

@media (max-width: 575.98px) {
  .presentation-grid,
  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
