/* ============================================= */
/* BOOTSTRAP 3 - MODERN THEME ULTIMATE - FIXED */
/* Versione corretta con dropdown funzionante */
/* ============================================= */

:root {
  --primary-gradient: linear-gradient(135deg, #0375b6 0%, #0a3c6e 100%);
  --primary-light: #4aa4e3;
  --primary-dark: #0a3c6e;
  --secondary-color: #5bc0de;
  --text-dark: #1a202c;
  --text-medium: #4a5568;
  --text-light: #718096;
  --bg-light: #ffffff;
  --bg-lighter: #ffffff;
  --border-color: #e2e8f0;
  --success-color: #48bb78;
  --warning-color: #ed8936;
  --danger-color: #f56565;
  --info-color: #4299e1;
}

/* ## BASE RI-DESIGNATA ## */
body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-medium);
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

/* ============================================= */
/* STILE DATATABLES INTEGRATO */
/* ============================================= */
.dataTables_wrapper {
  padding: 15px 0;
}

.dataTables_wrapper .dataTables_filter {
  text-align: left !important;
  margin-bottom: 15px;
}

.dataTables_wrapper .dataTables_length {
  float: left !important;
  margin-bottom: 15px;
}

.dataTables_wrapper .dt-buttons {
  float: left;
  text-align: center;
  margin-bottom: 15px;
}

.dataTables_filter input {
  width: 180px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  transition: all 0.3s ease;
}

.dataTables_filter input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(74, 164, 227, 0.2);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 0;
  margin-left: 0;
  display: inline;
  border: 0;
  color: var(--primary-dark) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  border: 0 !important;
  background: var(--bg-light) !important;
  color: var(--primary-dark) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary-gradient) !important;
  color: white !important;
  border-radius: 8px;
}

.myclass {
  word-wrap: break-word;
  word-break: break-all;
  white-space: normal;
}

/* ============================================= */
/* DATATABLES RESPONSIVE ICONS (DTR-INLINE) */
/* ============================================= */
table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child:before, 
table.dataTable.dtr-inline.collapsed>tbody>tr>th:first-child:before {
  content: '';
  background: url('/overground/mobile/ico_grandi/circle_arrow-down_datatables_responsive.png') no-repeat center center;
  width: 24px;
  height: 24px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
  transition: transform 0.2s ease;
}

table.dataTable.dtr-inline.collapsed>tbody>tr.parent>td:first-child:before, 
table.dataTable.dtr-inline.collapsed>tbody>tr.parent>th:first-child:before {
  content: '';
  background: url('/overground/mobile/ico_grandi/circle_arrow-forward_next_datatables_responsive.png') no-repeat center center;
  transform: rotate(0deg);
}

/* Hover effect */
table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child:hover:before,
table.dataTable.dtr-inline.collapsed>tbody>tr>th:first-child:hover:before {
  transform: scale(1.1);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child:before, 
  table.dataTable.dtr-inline.collapsed>tbody>tr>th:first-child:before {
    width: 20px;
    height: 20px;
    background-size: contain;
  }
  
  /* iOS specific fix */
  @supports (-webkit-touch-callout: none) {
    table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child:before,
    table.dataTable.dtr-inline.collapsed>tbody>tr>th:first-child:before {
      background-size: 20px 20px;
    }
  }
}

/* ## PANEL MODERNI ## */
.panel {
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  background: var(--bg-lighter);
  margin-bottom: 25px;
  position: static;
  overflow: visible;
}

.panel-heading {
	background: none !important; /* rimuove eventuali gradient */
	/*border: 1px solid var(--primary-dark); /* solo bordo */
	/*border-radius: 6px;*/
	padding: 15px 15px;
	margin-bottom: 5px;
  box-sizing: border-box;
}

.panel-heading .panel-title {
	color: var(--primary-dark); /* colore testo blu navy */
	font-weight: bold;
	margin: 0;
}

.panel-heading:hover {
	border-color: var(--primary-light); /* azzurro acceso al passaggio */
}

.panel-body {
  padding: 20px;
  position: relative;
  z-index: auto;
  overflow: visible;
}


/* ## DROPDOWN ## */
.input-group-btn {
  position: relative;
  display: table-cell !important;
  white-space: nowrap;
  width: 1% !important;
  vertical-align: middle;
}

.dropdown {
  position: static !important;
}

/* ============================================= */
/* FIX CONFLITTO DATEPICKER/DROPDOWN */
/* ============================================= */

/* Stile specifico per dropdown-menu standard (escludendo datepicker) */
.dropdown-menu:not(.datepicker-dropdown) {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1051 !important;
  min-width: 500px;
  padding: 0;
  margin: 2px 0 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.175);
  background-color: var(--bg-lighter);
  transform: none !important;
}

/* Stile specifico per datepicker */
.datepicker-dropdown {
  z-index: 1060 !important;
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 320px !important;
  max-width: 95vw !important;
  padding: 10px !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
  box-shadow: 0 6px 12px rgba(0,0,0,0.175) !important;
  background-color: var(--bg-lighter) !important;
}

/* Aggiungi questa regola per maggiore specificità */
.datepicker-dropdown.dropdown-menu {
  /* Sovrascrive le proprietà conflittuali */
  min-width: auto !important;
  margin: 0 !important;
  /* Mantiene le proprietà uniche del datepicker */
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
}

/* Fix per l'input group */
.input-group.date .dropdown-menu {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 320px !important;
  max-width: 95vw !important;
}

.open > .dropdown-menu {
  display: block !important;
}

.dropdown-menu iframe {
  width: 100% !important;
  height: 3000px !important;
  border: none !important;
  display: block !important;
  position: relative;
  z-index: 1050 !important;
}

.btn.dropdown-toggle {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  border-left: 1px solid var(--border-color) !important;
  height: 34px !important;
  margin-left: -1px !important;
}

/* ## FORM CONTROLS ## */
input[type="text"],
input[type="date"],
input[type="password"],
textarea,
select.form-control {
  border: 2px solid var(--border-color) !important;
  border-radius: 10px !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08) !important;
  padding: 12px 16px !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  background-color: var(--bg-lighter) !important;
  color: var(--text-dark) !important;
  font-size: 15px !important;
}

input[type="text"]:hover,
input[type="date"]:hover,
input[type="password"]:hover,
textarea:hover,
select.form-control:hover {
  border-color: var(--primary-light) !important;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15) !important;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="password"]:focus,
textarea:focus,
select.form-control:focus {
  border-color: var(--primary-dark) !important;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3), 
              0 6px 16px rgba(102, 126, 234, 0.2) !important;
  transform: translateY(-1px) !important;
  outline: none !important;
}

::placeholder {
  color: var(--text-light) !important;
  opacity: 0.8 !important;
  font-style: italic !important;
}

.control-label {
  font-weight: 700 !important;
  color: var(--text-dark) !important;
  margin-bottom: 10px !important;
  font-size: 15px !important;
  letter-spacing: 0.3px !important;
  display: block !important;
}

textarea.form-control {
  min-height: 120px !important;
  line-height: 1.6 !important;
  resize: vertical !important;
}

select.form-control {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234a5568'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 16px center !important;
  background-size: 18px !important;
  padding-right: 40px !important;
}

/* ## DATEPICKER ## */
.datepicker {
  width: 100% !important;
  max-width: 320px !important;
  margin: 0 auto !important;
}

.datepicker-dropdown {
  z-index: 1060 !important; /* Modificato da 2000 a 1060 per coerenza con Bootstrap */
  position: fixed !important; /* Aggiunto */
  top: 50% !important; /* Aggiunto */
  left: 50% !important; /* Aggiunto */
  transform: translate(-50%, -50%) !important; /* Aggiunto */
}

.datepicker .datepicker-switch {
  font-size: 14px !important;
  padding: 8px !important;
}

.datepicker .prev,
.datepicker .next {
  width: 30px !important;
  height: 30px !important;
  line-height: 30px !important;
}

.datepicker table tr td.day {
  width: 30px !important;
  height: 30px !important;
  line-height: 30px !important;
}

.datepicker .datepicker-footer {
  padding: 8px !important;
}

/* ## CLOCKPICKER ## */
.clockpicker-popover {
  position: absolute !important;
  z-index: 1060 !important;
}

.clockpicker-popover .popover-content {
  position: relative;
}

.clockpicker-plate {
  position: relative;
  z-index: auto !important;
}

.clockpicker-canvas {
  position: absolute;
  z-index: auto !important;
}

.clockpicker-button {
  position: relative;
  z-index: auto !important;
}

.clockpicker .input-group-addon {
  cursor: pointer;
}

.clockpicker-popover:before,
.clockpicker-popover:after {
  display: none !important;
}

/* ## SELECT PICKER ## */
.bootstrap-select .btn:focus,
.bootstrap-select .btn:active {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3) !important;
}

.selectpicker-container {
  position: relative;
}

.selectpicker-container .bootstrap-select {
  width: 100% !important;
}

.selectpicker-container .bootstrap-select .dropdown-toggle {
  overflow: hidden;
  text-overflow: ellipsis;
}

.bootstrap-select .dropdown-menu.inner {
  display: block !important;
}

.bootstrap-select .dropdown-menu li a span.text {
  white-space: normal !important;
  word-wrap: break-word !important;
  display: inline-block !important;
  max-width: 100% !important;
}

.bootstrap-select .filter-option {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
}

.bootstrap-select .dropdown-toggle .filter-option-inner {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* ## ICONE ## */
.container-fluid.main-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 0;
}

.row {
  display: flex;
  justify-content: center;
  margin-left: -8px;
  margin-right: -8px;
}

.col-xs-6, .col-sm-6, .col-md-6 {
  padding-left: 8px;
  padding-right: 8px;
  display: flex;
  justify-content: center;
}

.icon-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease-in-out;
}

.icon-container img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.icon-text {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 8px;
  font-size: 16px;
  font-weight: bold;
  color: #337ab7;
}

.badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: var(--success-color);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  font-weight: bold;
}

a[title] {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
}

/* ============================================= */
/* MODAL FIXES */
/* ============================================= */
.modal {
  z-index: 1050 !important;
  overflow-y: auto !important;
}

.modal-backdrop {
  z-index: 1040 !important;
}

.modal.in .datepicker-dropdown {
  position: fixed !important;
}

.modal .input-group.date {
  position: static !important;
}




/* ============================================= */
/* MEDIA QUERIES */
/* ============================================= */
@media (max-width: 768px) {
  /* DataTables */
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dt-buttons {
    float: none !important;
    text-align: center !important;
    width: 100%;
    margin-bottom: 10px;
  }
  
  .dataTables_filter input {
    width: 100% !important;
    max-width: 200px;
  }
  
  /* Datepicker */
  .datepicker-dropdown {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90% !important;
    max-width: 300px !important;
    z-index: 1060 !important;
  }
  
  .datepicker table {
    width: 100% !important;
    font-size: 14px !important;
  }
  
  .datepicker table tr td,
  .datepicker table tr th {
    padding: 8px !important;
  }
  
  /* Clockpicker */
  .clockpicker-popover {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
  }
  
  .clockpicker-popover.popover {
    max-width: none !important;
  }
  
  /* Form Controls */
  input[type="text"],
  input[type="date"],
  textarea,
  select.form-control {
    padding: 14px 16px !important;
    font-size: 16px !important;
    border-width: 2px !important;
  }
  
  .control-label {
    font-size: 16px !important;
    margin-bottom: 12px !important;
  }
  
  textarea.form-control {
    min-height: 140px !important;
  }
  
  /* Select Picker */
  select.form-control,
  .bootstrap-select .btn {
    font-size: 14px !important;
    padding: 8px 30px 8px 12px !important;
    height: auto !important;
    line-height: 1.4 !important;
  }
  
  .bootstrap-select .dropdown-menu {
    max-height: 250px !important;
    overflow-y: auto !important;
  }
  
  .bootstrap-select .dropdown-toggle .filter-option {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    text-align: right !important;
    padding-right: 20px !important;
  }
  
  .bootstrap-select .dropdown-toggle::after {
    right: 10px !important;
    font-size: 12px !important;
  }
  
  .bootstrap-select .dropdown-menu li a {
    padding: 8px 12px !important;
    font-size: 14px !important;
  }
  
  /* Icons */
  .icon-container {
    width: 100px;
    height: 100px;
    padding: 10px;
  }
  
  .icon-container img {
    width: 60px;
    height: 60px;
  }
  
  .icon-text {
    font-size: 13px;
  }
  
  .container-fluid.main-container {
    padding: 0 10px;
  }
  
  /* iOS Specific */
  @supports (-webkit-touch-callout: none) {
    .dataTables_wrapper table {
      font-size: 16px !important;
    }
    
    .dataTables_wrapper select,
    .dataTables_wrapper input {
      font-size: 16px !important;
      min-height: 44px !important;
    }
    
    select.form-control {
      font-size: 16px !important;
    }
  }
}

@media (max-width: 480px) {
  .bootstrap-select .btn {
    font-size: 13px !important;
    padding: 6px 28px 6px 10px !important;
  }
  
  .bootstrap-select .dropdown-menu li a {
    padding: 6px 10px !important;
    font-size: 13px !important;
  }
  
  select.form-control {
    padding: 6px 28px 6px 10px !important;
    font-size: 13px !important;
  }
}