/**
 * Stili Admin per SM Custom Form Plugin (Revamped & Themed)
 */

/* --- Contenitore Principale Dashboard --- */
.sm-results-dashboard-container {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f9f9f9;
  padding: 25px;
  border-radius: 16px;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.07);
  margin: 20px 0;
  box-sizing: border-box;
  color: #555;
}
.sm-results-dashboard-container .sm-form-header {
  text-align: left;
  margin-bottom: 25px;
}
.sm-results-dashboard-container .sm-form-main-title {
  font-size: 2.2rem;
  color: #333;
  margin: 0;
  font-weight: 600;
}
.sm-results-dashboard-container .sm-form-header::after {
  content: "";
  display: block;
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, #6a1b9a, #3949ab);
  margin: 10px 0 0;
  border-radius: 2px;
}

/* --- Notifiche Admin --- */
.sm-dashboard-notices .sm-admin-notice,
.sm-modal .sm-form-message {
  margin: 0 0 15px 0;
  padding: 12px 15px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.sm-dashboard-notices .notice-success,
.sm-modal .sm-form-message.notice-success {
  background-color: rgba(76, 175, 80, 0.15);
  color: #388e3c;
  border-color: #c8e6c9;
}
.sm-dashboard-notices .notice-error,
.sm-modal .sm-form-message.notice-error {
  background-color: rgba(244, 67, 54, 0.15);
  color: #d32f2f;
  border-color: #ffcdd2;
}

/* --- Barra Controlli Superiore --- */
.sm-dashboard-top-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 10px;
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}
.sm-icon-button {
  background-color: #f5f5f5;
  border: 1px solid #e0e0e0;
  color: #555;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  transition: all 0.2s ease-in-out;
}
.sm-icon-button .dashicons {
  font-size: 20px;
  line-height: 1;
  width: auto;
  height: auto;
}
.sm-icon-button:hover,
.sm-icon-button:focus {
  background-color: #e0cde9;
  border-color: #6a1b9a;
  color: #6a1b9a;
  transform: scale(1.05);
}
/* Stile specifico per i bottoni della barra superiore */
.sm-dashboard-top-controls .sm-icon-button {
  background-color: #fff;
  border: 1px solid #ddd;
  color: #6a1b9a;
}
.sm-dashboard-top-controls .sm-icon-button:hover {
  background-color: #f5f5f5;
  border-color: #6a1b9a;
}
.sm-dashboard-top-controls .sm-icon-button.add-new-btn {
  background-color: #6a1b9a;
  color: #fff;
  border-color: #6a1b9a;
}
.sm-dashboard-top-controls .sm-icon-button.add-new-btn:hover {
  background-color: #501475;
}

.sm-search-box-compact {
  display: flex;
  align-items: center;
  flex-grow: 1;
}
.sm-search-box-compact input[type="search"] {
  height: 40px;
  padding: 0 15px;
  border-radius: 20px 0 0 20px;
  border: 1px solid #ccc;
  border-right: none;
  font-size: 14px;
  flex-grow: 1;
  min-width: 200px;
  transition: all 0.3s ease;
}
.sm-search-box-compact input[type="search"]:focus {
  border-color: #6a1b9a;
  box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.15);
  outline: none;
  z-index: 1;
}
.sm-search-box-compact .search-submit-button {
  border-radius: 0 20px 20px 0;
  margin-left: -1px;
  height: 40px;
  width: 45px;
  background-color: #6a1b9a;
  border-color: #6a1b9a;
  color: #fff;
}
.sm-search-box-compact .search-submit-button:hover {
  background-color: #501475;
  border-color: #501475;
}

/* --- Barra Azioni di Gruppo --- */
.sm-bulk-actions-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 15px;
}
.sm-bulk-actions-bar select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
  background-color: #fff;
}
.sm-bulk-actions-bar .sm-secondary-button {
  padding: 0.6rem 1.5rem;
  border-radius: 20px;
  background-color: #f0f0f0;
  color: #555;
  border: 1px solid #d0d0d0;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  transition: all 0.25s ease;
}
.sm-bulk-actions-bar .sm-secondary-button:hover {
  background-color: #e0e0e0;
  border-color: #b0b0b0;
  transform: translateY(-2px);
}

/* --- Tabella Custom --- */
.sm-custom-table-wrapper {
  overflow-x: auto;
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.sm-custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.sm-custom-table th,
.sm-custom-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
  vertical-align: middle;
}
.sm-custom-table thead th {
  background-color: rgba(106, 27, 154, 0.08);
  color: #333;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
}
.sm-custom-table thead th a {
  color: inherit;
  text-decoration: none;
}
.sm-custom-table thead th a:hover {
  color: #6a1b9a;
}
.sm-custom-table tbody tr:hover {
  background-color: rgba(106, 27, 154, 0.04);
}
.sm-custom-table td.sm-col-email a {
  color: #3949ab;
  text-decoration: none;
  font-weight: 500;
}
.sm-custom-table .sm-status-dropdown {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  min-width: 140px;
  background-color: #fff;
}
.sm-custom-table .sm-col-actions {
  white-space: nowrap;
  text-align: right;
}
/* Stile per i bottoni di azione nella tabella */
.sm-custom-table .sm-col-actions .sm-icon-button {
  width: 34px;
  height: 34px;
  margin-left: 5px;
  background-color: transparent;
  border: 1px solid #ddd;
  color: #888;
}
.sm-custom-table .sm-col-actions .sm-icon-button:hover {
  color: #6a1b9a;
  border-color: #6a1b9a;
  background-color: #f5f5f5;
}
.sm-custom-table .sm-col-actions .sm-delete-submission-btn:hover {
  color: #d32f2f;
  border-color: #d32f2f;
}
.sm-custom-table .sm-col-actions .sm-icon-button .dashicons {
  font-size: 18px;
}
.sm-no-results td {
  text-align: center;
  padding: 40px;
  font-size: 1.2rem;
  color: #777;
}

/* --- Paginazione --- */
.sm-pagination {
  margin-top: 25px;
  text-align: center;
}
.sm-pagination ul.page-numbers {
  list-style: none;
  padding: 0;
  display: inline-flex;
  gap: 8px;
}
.sm-pagination .page-numbers a,
.sm-pagination .page-numbers span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  min-width: 38px;
  height: 38px;
  border: 1px solid #ccc;
  border-radius: 20px;
  text-decoration: none;
  color: #3949ab;
  background-color: #fff;
  transition: all 0.3s ease;
  font-weight: 500;
}
.sm-pagination .page-numbers a:hover {
  background-color: #e0cde9;
  border-color: #6a1b9a;
  color: #6a1b9a;
}
.sm-pagination .page-numbers span.current {
  background: linear-gradient(90deg, #6a1b9a, #3949ab);
  color: #ffffff;
  border-color: #6a1b9a;
}

/* --- Stili Generali Modal --- */
.sm-modal {
  display: none;
  position: fixed;
  z-index: 100001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  align-items: center;
  justify-content: center;
}
.sm-modal-backdrop {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.65);
  animation: smFadeIn 0.3s ease-out;
}
.sm-modal-wrap {
  position: relative;
  background-color: #ffffff;
  padding: 0;
  width: 90%;
  max-width: 600px;
  border-radius: 16px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: smSlideDown 0.4s ease-out;
}
.sm-modal-wrap-small {
  max-width: 450px;
}
.sm-modal-wrap-large {
  max-width: 800px;
}

.sm-modal-header {
  padding: 20px 25px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}
.sm-modal-title {
  font-size: 1.5rem;
  margin: 0;
  font-weight: 600;
  color: #6a1b9a;
}
.sm-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  color: #aaa;
  background: #f1f1f1;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 24px;
  transition: all 0.2s ease;
}
.sm-modal-close:hover {
  background: #e0e0e0;
  color: #333;
}
.sm-modal-content-area {
  overflow-y: auto;
  padding: 25px;
  flex-grow: 1;
}
.sm-modal-actions {
  padding: 20px 25px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: #f9f9f9;
  border-radius: 0 0 16px 16px;
}

/* Stili per form nei modal */
.sm-modal .sm-form-group {
  margin-bottom: 20px;
}
.sm-modal .sm-form-group label {
  display: block;
  margin-bottom: 8px;
  color: #444;
  font-weight: 500;
}
.sm-modal .sm-form-group input[type="text"],
.sm-modal .sm-form-group input[type="email"],
.sm-modal .sm-form-group input[type="tel"],
.sm-modal .sm-form-group textarea,
.sm-modal .sm-form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
  font-size: 0.95rem;
}
.sm-modal .sm-form-group .sm-required {
  color: #c00;
}

/* Bottoni Modal */
.sm-modal-actions .sm-cta-button,
.sm-modal-actions .sm-secondary-button {
  padding: 0.8rem 1.8rem;
  border-radius: 25px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  transition: all 0.25s ease;
}
.sm-modal-actions .sm-cta-button {
  background: linear-gradient(90deg, #6a1b9a, #4a235a);
  color: #ffffff;
}
.sm-modal-actions .sm-cta-button.delete-confirm {
  background: #d32f2f;
}
.sm-modal-actions .sm-secondary-button {
  background-color: #f0f0f0;
  color: #555;
  border: 1px solid #d0d0d0;
}

/* Dettagli Richiesta Modal */
#sm-submission-details-modal-body .sm-details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
#sm-submission-details-modal-body .sm-details-table td {
  padding: 10px 0;
  border-bottom: 1px dotted #e0e0e0;
  vertical-align: top;
}
#sm-submission-details-modal-body .sm-details-table .sm-detail-label {
  font-weight: 600;
  width: 35%;
  color: #3949ab;
}
#sm-submission-details-modal-body a {
  color: #6a1b9a;
}

body.sm-modal-open {
  overflow: hidden;
}

@keyframes smFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes smSlideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Responsività --- */
@media (max-width: 782px) {
  .sm-dashboard-top-controls {
    flex-wrap: wrap;
  }
  .sm-search-box-compact {
    width: 100%;
    order: 1;
    margin: 10px 0 0 0;
  }
  .sm-custom-table thead {
    display: none;
  }
  .sm-custom-table tr {
    display: block;
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
  }
  .sm-custom-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
    padding: 10px;
    border-bottom: 1px dotted #eee;
  }
  .sm-custom-table td:last-child {
    border-bottom: none;
  }
  .sm-custom-table td::before {
    content: attr(data-label);
    font-weight: 600;
    text-align: left;
    color: #333;
  }
  .sm-custom-table td.sm-col-checkbox {
    justify-content: flex-start;
  }
  .sm-custom-table td.sm-col-checkbox::before {
    content: none;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
