/* ===================================
   BOOTSTRAP PERSONALIZZATO - CSS COMPILATO
   =================================== */

/* Variabili CSS Custom Properties */
:root {
  --bs-primary: #0066cc;
  --bs-secondary: #6c757d;
  --bs-success: #28a745;
  --bs-info: #17a2b8;
  --bs-warning: #ffc107;
  --bs-danger: #dc3545;
  --bs-light: #f8f9fa;
  --bs-dark: #343a40;

  --brand-primary: #0066cc;
  --brand-secondary: #004080;
  --brand-accent: #deac57;

  --border-radius: 0.375rem;
  --border-radius-lg: 0.5rem;
  --border-radius-sm: 0.25rem;

  --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --box-shadow-sm: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.075);
  --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Reset generale */
* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #212529;
  background-color: #f8f9fa;
  line-height: 1.6;
}

/* ===== UTILITÀ PERSONALIZZATE ===== */
.bg-gradient-primary {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
}

.bg-gradient-accent {
  background: linear-gradient(135deg, var(--brand-accent) 0%, #e65c00 100%);
}

.text-brand-primary {
  color: var(--brand-primary) !important;
}

.text-brand-secondary {
  color: var(--brand-secondary) !important;
}

.text-brand-accent {
  color: var(--brand-accent) !important;
}

.bg-brand-primary {
  background-color: var(--brand-primary) !important;
  color: white;
}

.bg-brand-secondary {
  background-color: var(--brand-secondary) !important;
  color: white;
}

.bg-brand-accent {
  background-color: var(--brand-accent) !important;
  color: white;
}

/* ===== CARD PERSONALIZZATE ===== */
.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-5px);
  box-shadow: var(--box-shadow-lg);
}

.card-colored {
  border-left: 4px solid var(--brand-primary);
}

/* ===== BOTTONI PERSONALIZZATI ===== */
.btn-gradient {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
  border: none;
  color: white;
  transition: all 0.3s ease;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  font-weight: 500;
}

.btn-gradient:hover {
  background: linear-gradient(135deg, var(--brand-secondary) 0%, var(--brand-primary) 100%);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--box-shadow);
}

.btn-accent {
  background-color: var(--brand-accent);
  border-color: var(--brand-accent);
  color: white;
}

.btn-accent:hover {
  background-color: #e65c00;
  border-color: #e65c00;
  color: white;
}

/* ===== BADGE PERSONALIZZATI ===== */
.badge-custom {
  background-color: var(--brand-accent);
  color: white;
  padding: 0.5em 0.75em;
  border-radius: var(--border-radius);
}

/* ===== NAVBAR PERSONALIZZATA ===== */
.navbar-custom {
  background: var(--brand-primary);
  box-shadow: var(--box-shadow);
}

.navbar-custom .navbar-brand {
  color: white;
  font-weight: bold;
  font-size: 1.5rem;
}

.navbar-custom .navbar-brand:hover {
  color: white;
}

.navbar-custom .nav-link {
  color: rgba(255, 255, 255, 0.8);
  transition: color 0.3s ease;
  padding: 0.5rem 1rem;
}

.navbar-custom .nav-link:hover {
  color: white;
}

/* ===== FORM PERSONALIZZATI ===== */
.form-floating-custom .form-control {
  border: 2px solid #dee2e6;
  border-radius: var(--border-radius);
}

.form-floating-custom .form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.25);
}

.form-floating-custom label {
  color: #6c757d;
}

/* ===== TABELLE PERSONALIZZATE ===== */
.table-custom thead {
  background-color: var(--brand-primary);
  color: white;
}

.table-custom thead th {
  border: none;
  font-weight: 600;
  padding: 1rem;
}

.table-custom tbody tr {
  transition: background-color 0.3s ease;
}

.table-custom tbody tr:hover {
  background-color: rgba(0, 102, 204, 0.05);
}

.table-custom tbody td {
  padding: 0.75rem 1rem;
}

/* ===== TABELLE STILE MINIMAL UI ===== */
.table-minimal {
  background-color: white;
  border-radius: 16px;
  overflow: hidden;
  /* box-shadow: 0 0 2px 0 rgba(145, 158, 171, 0.2), 0 12px 24px -4px rgba(145, 158, 171, 0.12); */
}

.table-minimal thead {
  background-color: #F4F6F8;
}

.table-minimal thead th {
  border: none;
  padding: 16px 16px;
  font-weight: 600;
  font-size: 0.875rem;
  color: #637381;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.table-minimal tbody tr {
  transition: background-color 0.2s ease;
}

.table-minimal tbody tr:hover {
  background-color: rgba(145, 158, 171, 0.08);
}

.table-minimal tbody td {
  padding: 16px 16px;
  font-size: 0.875rem;
  color: #212B36;
  vertical-align: middle;
  border: none;
}

/* Wrapper per tabella minimal con card */
.table-minimal-wrapper {
  background-color: white;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 0 2px 0 rgba(145, 158, 171, 0.2), 0 12px 24px -4px rgba(145, 158, 171, 0.12);
  overflow: hidden;
}

.table-minimal-wrapper .table {
  margin-bottom: 0;
}

/* Header della tabella minimal */
.table-minimal-header {
  padding: 24px;
  border-bottom: 1px dashed rgba(145, 158, 171, 0.2);
}

.table-minimal-header h5 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #212B36;
}

/* Footer della tabella minimal */
.table-minimal-footer {
  padding: 16px 24px;
  border-top: 1px dashed rgba(145, 158, 171, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Avatar nelle tabelle minimal */
.table-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.table-avatar-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-avatar-info h6 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #212B36;
}

.table-avatar-info p {
  margin: 0;
  font-size: 0.75rem;
  color: #637381;
}

/* Badge minimal */
.badge-minimal {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-minimal.badge-success {
  background-color: rgba(34, 197, 94, 0.16);
  color: #118D57;
}

.badge-minimal.badge-warning {
  background-color: rgba(255, 171, 0, 0.16);
  color: #B76E00;
}

.badge-minimal.badge-error {
  background-color: rgba(255, 86, 48, 0.16);
  color: #B71D18;
}

.badge-minimal.badge-info {
  background-color: rgba(0, 184, 217, 0.16);
  color: #006C9C;
}

/* Bottoni azioni tabella minimal */
.table-action-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #637381;
  transition: all 0.2s ease;
  cursor: pointer;
}

.table-action-btn:hover {
  background-color: rgba(145, 158, 171, 0.08);
  color: #212B36;
}

/* Checkbox personalizzati stile minimal */
.checkbox-minimal {
  width: 20px;
  height: 20px;
  border: 2px solid #DFE3E8;
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--brand-primary);
}

/* Pagination stile minimal */
.pagination-minimal {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pagination-minimal .page-item {
  margin: 0;
}

.pagination-minimal .page-link {
  min-width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  color: #637381;
  font-weight: 600;
  font-size: 0.875rem;
  background-color: transparent;
  transition: all 0.2s ease;
}

.pagination-minimal .page-link:hover {
  background-color: rgba(145, 158, 171, 0.08);
  color: #212B36;
}

.pagination-minimal .page-item.active .page-link {
  background-color: rgba(0, 102, 204, 0.08);
  color: var(--brand-primary);
}

.pagination-minimal .page-item.disabled .page-link {
  opacity: 0.48;
  cursor: not-allowed;
}

/* Rows per page selector */
.rows-per-page {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: #637381;
}

.rows-per-page select {
  border: 1px solid #DFE3E8;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.875rem;
  color: #212B36;
  background-color: white;
  cursor: pointer;
}

/* Responsive table minimal */
@media (max-width: 768px) {
  .table-minimal thead {
    display: none;
  }

   .table-minimal tbody tr {
    display: block;
    margin-bottom: 16px;
    border: 1px solid rgba(145, 158, 171, 0.2);
    border-radius: 12px;
    padding: 12px;
  }

  .table-minimal tbody td {
    display: flex;
    justify-content: center;
    padding: 8px 0;
    border: none;
    max-width: 100%;
    width: 100%;
  }

  .table-minimal tbody {
    display: block;
    width: 88vw;
    padding: 0.375rem 0px;
  }

  .table-minimal tbody td:before {
    content: attr(data-label);
    font-weight: 600;
    color: #637381;
  }
  /* Solitamente titolo, per visualizzazione mobile */
  td.sorting_1 > div {
    flex-direction: column;
    align-items: center;
  }
}

/* ===== Datatables personalizzato ===== */

.table-responsive thead tr th {
    background-color: #e9e8e8ff;  
}
.table-responsive thead tr th:first-child {
    border-radius: 1rem 0rem 0rem 1rem;
}
.table-responsive thead tr th:last-child {
    border-radius: 0rem 1rem 1rem 0rem;
}
.table-responsive thead tr {
  border: 0;
}
.table-responsive .table-minimal {
  border-radius: 0;
}
.table-responsive div div:last-child{
  padding-top:0px;
}

table.dataTable>thead>tr>th, div.dt-container.dt-empty-footer tbody>tr:last-child>*{
  border-bottom: none!important;
}

div.dt-container div.dt-search {
  text-align: left!important;
}


/* ===== ALERT PERSONALIZZATI ===== */
.alert-custom {
  border-left: 4px solid var(--brand-accent);
  border-radius: var(--border-radius);
  background-color: #fff3e6;
  color: #994d00;
  padding: 1rem;
}

/* ===== PAGINATION PERSONALIZZATA ===== */
.pagination-custom .page-link {
  color: var(--brand-primary);
  border-color: #dee2e6;
  padding: 0.5rem 0.75rem;
  transition: all 0.3s ease;
}

.pagination-custom .page-link:hover {
  background-color: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

.pagination-custom .page-item.active .page-link {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

/* ===== PROGRESS BAR PERSONALIZZATE ===== */
.progress-custom {
  height: 1.5rem;
  border-radius: var(--border-radius-lg);
}

.progress-custom .progress-bar {
  background: linear-gradient(90deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
}

/* ===== MODAL PERSONALIZZATI ===== */
.modal-custom .modal-header {
  background: var(--brand-primary);
  color: white;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.modal-custom .modal-header .btn-close {
  filter: invert(1);
}

.modal-custom .modal-body {
  padding: 2rem;
}

/* ===== BREADCRUMB PERSONALIZZATI ===== */
.breadcrumb-custom {
  background-color: transparent;
  padding: 0.75rem 1rem;
}

.breadcrumb-custom .breadcrumb-item.active {
  color: var(--brand-primary);
}

.breadcrumb-custom .breadcrumb-item a {
  color: #6c757d;
  text-decoration: none;
}

.breadcrumb-custom .breadcrumb-item a:hover {
  color: var(--brand-primary);
}

/* ===== SPINNER PERSONALIZZATI ===== */
.spinner-custom {
  color: var(--brand-primary);
  width: 3rem;
  height: 3rem;
}

/* ===== TOAST PERSONALIZZATI ===== */
.toast-custom {
  border-left: 4px solid var(--brand-primary);
}

.toast-custom .toast-header {
  background-color: #e6f2ff;
  color: var(--brand-primary);
  font-weight: 600;
}

/* ===== DROPDOWN PERSONALIZZATI ===== */
.dropdown-custom .dropdown-menu {
  border: none;
  box-shadow: var(--box-shadow-lg);
  border-radius: var(--border-radius);
}

.dropdown-custom .dropdown-item {
  padding: 0.5rem 1rem;
  transition: background-color 0.3s ease;
}

.dropdown-custom .dropdown-item:hover {
  background-color: rgba(0, 102, 204, 0.1);
  color: var(--brand-primary);
}

.dropdown-custom .dropdown-item.active {
  background-color: var(--brand-primary);
  color: white;
}

/* ===== ACCORDION PERSONALIZZATI ===== */
.accordion-custom .accordion-item {
  border: 1px solid #dee2e6;
  border-radius: var(--border-radius);
  margin-bottom: 0.5rem;
}

.accordion-custom .accordion-button {
  background-color: #f0f7ff;
  color: var(--brand-primary);
  font-weight: 600;
}

.accordion-custom .accordion-button:not(.collapsed) {
  background-color: var(--brand-primary);
  color: white;
}

.accordion-custom .accordion-button:focus {
  box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.25);
}

/* ===== HELPER CLASSES ===== */
.shadow-custom {
  box-shadow: var(--box-shadow-lg) !important;
}

.rounded-custom {
  border-radius: var(--border-radius-lg) !important;
}

.border-custom {
  border: 1px solid #dee2e6 !important;
}

/* ===== ANIMAZIONI ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.slide-in {
  animation: slideIn 0.5s ease-in-out;
}

/* ===== RESPONSIVE UTILITIES ===== */
@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .show-mobile {
    display: none !important;
  }
}

/* ===== SIDEBAR STILE MINIMAL UI ===== */
.sidebar-minimal {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 280px;
  background-color: white;
  box-shadow: 0 0 2px 0 rgba(145, 158, 171, 0.2), 0 12px 24px -4px rgba(145, 158, 171, 0.12);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.3s ease;
  transform: translateX(0);
}

.sidebar-minimal.collapsed {
  transform: translateX(-280px);
}

/* Logo sidebar */
.sidebar-logo {
  position: relative;
  width: 100%;
  border-bottom: 1px dashed rgba(145, 158, 171, 0.2);
  gap: 12px;
}

.sidebar-logo-icon-townet {
  padding: 24px 20px;
  max-width: 280px;
  object-fit: contain;
  /* background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  font-weight: bold; */
}

.sidebar-logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #212B36;
  margin: 0;
}

/* Menu sidebar */
.sidebar-menu {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-menu::-webkit-scrollbar {
  width: 6px;
}

.sidebar-menu::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(145, 158, 171, 0.2);
  border-radius: 3px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(145, 158, 171, 0.3);
}

/* Section title */
.sidebar-section-title {
  padding: 8px 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #637381;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 8px;
}

/* Menu items */
.sidebar-menu-item {
  display: flex;
  align-items: center;
  padding: 8px 20px;
  margin: 4px 12px;
  color: #637381;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
}

.sidebar-menu-item:hover {
  background-color: rgba(145, 158, 171, 0.08);
  color: #212B36;
}

.sidebar-menu-item.active {
  background-color: #edeef0;
  color: #deac57;
  /* color: var(--brand-primary); */
  font-weight: 600;
}
/* .sidebar-menu-item {
  display: flex;
  align-items: center;
  padding: 8px 20px;
  margin: 4px 0px 4px 20px;;
  color: #637381;
  text-decoration: none;
  border-radius: 0;
  transition: all 0.2s ease;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
}

.sidebar-menu-item:hover {
  background-color: rgba(145, 158, 171, 0.08);
  color: #212B36;
}

.sidebar-menu-item.active {
  background-color: #edeef0;
  border-right-color: #212529;
  border-right-width: 2px;
  /* color: #deac57; */
  /* text-shadow:
                -1px -1px 0 #000,
                1px -1px 0 #000,
                -1px 1px 0 #000,
                1px 1px 0 #000,
                -1px 0px 0 #000,
                1px 0px 0 #000,
                0px -1px 0 #000,
                0px 1px 0 #000; */
  /* color: var(--brand-primary);
  font-weight: 600;
} */
.sidebar-menu-item-icon {
  width: 24px;
  height: 24px;
  margin-right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.sidebar-menu-item-text {
  flex: 1;
}

.sidebar-menu-item-badge {
  margin-left: 8px;
  padding: 2px 8px;
  background-color: rgba(255, 86, 48, 0.16);
  color: #B71D18;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Submenu */
.sidebar-submenu {
  margin-left: 40px;
  margin-top: 4px;
  margin-bottom: 4px;
}

.sidebar-submenu .sidebar-menu-item {
  padding: 6px 20px;
  font-size: 0.8125rem;
}

/* Footer sidebar */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px dashed rgba(145, 158, 171, 0.2);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 12px;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.sidebar-user:hover {
  background-color: rgba(145, 158, 171, 0.08);
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-user-info h6 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #212B36;
}

.sidebar-user-info p {
  margin: 0;
  font-size: 0.75rem;
  color: #637381;
}

/* Toggle button */
.sidebar-toggle {
  position: fixed;
  top: 20px;
  left: 296px;
  width: 32px;
  height: 32px;
  background-color: white;
  border: 1px solid rgba(145, 158, 171, 0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1001;
  transition: all 0.3s ease;
  box-shadow: 0 0 2px 0 rgba(145, 158, 171, 0.2);
}

.sidebar-toggle:hover {
  background-color: rgba(145, 158, 171, 0.08);
}

.sidebar-minimal.collapsed + .sidebar-toggle {
  left: 16px;
}

/* Content con sidebar */
.content-with-sidebar {
  margin-left: 280px;
  transition: margin-left 0.3s ease;
}

.sidebar-minimal.collapsed ~ .content-with-sidebar {
  margin-left: 0;
}

/* Overlay mobile */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

.sidebar-overlay.show {
  display: block;
}

/* Responsive sidebar */
@media (max-width: 992px) {
  .sidebar-minimal {
    transform: translateX(-280px);
  }

  .sidebar-minimal.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    left: 16px;
  }

  .sidebar-minimal.collapsed + .sidebar-toggle {
    left: 16px;
  }

  .content-with-sidebar {
    margin-left: 0;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .no-print {
    display: none !important;
  }

  .sidebar-minimal,
  .sidebar-toggle {
    display: none !important;
  }

  .content-with-sidebar {
    margin-left: 0 !important;
  }
}
