/**
 * FpiMemO28 Module - Styling
 * CSS personalizzato per il modulo di gestione fpi_mem028
 */

/* ===== GENERAL FORM LAYOUT ===== */
.fpi-mem028-container {
  margin-top: 20px;
}

.fpi-mem028-container .input-group-addon {
  border: unset;
}

.fpi-mem028-container .row {
  margin-bottom: 20px;
}

/* ===== NAVIGATION LIST ===== */
.fpi-mem028-navigation .list-group-item:first-child {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}
.fpi-mem028-navigation .list-group-item:last-child {
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.fpi-mem028-navigation .list-group-item {
  transition: all 0.3s ease;
  cursor: pointer;
  border-left: 4px solid transparent;
  border-right: 1px solid transparent;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fpi-mem028-navigation .list-group-item:hover {
  background-color: #f8f9fa;
  border-left-color: var(--iveco-blue);
  border-right: 1px solid transparent;
}

.fpi-mem028-navigation .list-group-item.active {
  border-color: #ddd;
  background-color: #d9edf7;
  border-left-color: var(--iveco-blue);
  border-right: 1px solid transparent;
  color: var(--iveco-blue);
  font-weight: 600;
}

/* Badge per numero step */
.fpi-mem028-navigation .badge {
  margin-right: 10px;
  width: 25px;
  height: 25px;
  line-height: 23px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  vertical-align: middle;
}

.fpi-mem028-navigation .list-group-item:not(.active) .badge {
  background-color: #6c757d;
  color: white;
}

.fpi-mem028-navigation .list-group-item.active .badge {
  background-color: var(--iveco-blue);
  color: white;
}

/* Stato disabled per gli elementi non disponibili */
.fpi-mem028-navigation .list-group-item.disabled {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.5;
  color: #999;
  background-color: #f8f9fa;
}

.fpi-mem028-navigation .list-group-item.disabled:hover {
  background-color: #f8f9fa;
  border-left-color: transparent;
  transform: none;
}

.fpi-mem028-navigation .list-group-item.disabled .badge {
  background-color: #ccc;
  color: #666;
}

/* Stato completed per gli elementi completati */
.fpi-mem028-navigation .list-group-item.completed {
  background-color: #dff0d8;
  border-left-color: #3c763d;
  color: #3c763d;
}

.fpi-mem028-navigation .list-group-item.completed:hover {
  background-color: #d0e9c6;
  border-left-color: #3c763d;
}

.fpi-mem028-navigation .list-group-item.completed .badge {
  background-color: #3c763d;
  color: white;
}

/* ===== FORM PARTS ===== */
.form-part {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s ease;
  min-height: 400px;
}

.form-part.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.form-part .card {
  border: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

.form-part .card-header {
  background-color: var(--iveco-blue);
  color: white;
  border-radius: 8px 8px 0 0;
  padding: 20px;
}

.form-part .card-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 300;
}

.form-part .card-body {
  padding: 30px;
}

/* ===== LOADING STATES ===== */
.loading-spinner {
  padding: 60px 20px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-spinner .spinner {
  text-align: center;
}

.loading-spinner .fa-spinner {
  color: var(--iveco-blue);
  margin-bottom: 20px;
}

.loading-spinner p {
  color: #6c757d;
  font-style: italic;
  margin: 0;
}

/* Spinner animation personalizzata */
@keyframes custom-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-spinner .fa-spin {
  animation: custom-spin 1s linear infinite;
}

/* ===== FORM STYLING ===== */
.form-custom .form-group {
  margin-bottom: 25px;
}

.form-custom .control-label {
  font-weight: 600;
  color: #495057;
  padding-top: 7px;
}

.form-custom .form-control {
  border: 2px solid #e9ecef;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.form-custom .form-control:focus {
  border-color: var(--iveco-blue);
  box-shadow: 0 0 0 0.2rem rgba(51, 122, 183, 0.25);
}

.btn-primary:hover {
  background-color: #286090;
  border-color: #204d74;
  transition: all 0.3s ease;
}

/* ===== ALERTS ===== */
.alert {
  border: none;
  border-radius: 8px;
  margin-bottom: 20px;
  position: relative;
  animation: slideDown 0.3s ease;
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
}

.alert-danger {
  background-color: #f8d7da;
  color: #721c24;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .fpi-mem028-container .col-md-3 {
    margin-bottom: 20px;
  }

  .fpi-mem028-navigation .list-group-item {
    text-align: center;
    transform: none;
  }

  .fpi-mem028-navigation .list-group-item:hover {
    transform: none;
  }

  .form-part .card-header {
    padding: 15px;
  }

  .form-part .card-header h1 {
    font-size: 20px;
  }

  .form-part .card-body {
    padding: 20px;
  }

  .form-custom .control-label {
    text-align: left;
    margin-bottom: 5px;
  }
}

/* ===== ANIMATION UTILITIES ===== */
.fade-in {
  animation: fadeIn 0.5s ease;
}

.slide-up {
  animation: slideUp 0.4s ease;
}

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

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

/* ===== PROGRESS INDICATOR ===== */
.progress-wrapper {
  margin-bottom: 30px;
  background-color: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
}

.progress {
  height: 8px;
  border-radius: 4px;
  background-color: #e9ecef;
}

.progress-bar {
  background-color: var(--iveco-blue);
  transition: width 0.6s ease;
}

/* ===== FORM VALIDATION ===== */
.form-control.is-invalid {
  border-color: #dc3545;
}

.form-control.is-valid {
  border-color: #28a745;
}

.invalid-feedback {
  display: block;
  color: #dc3545;
  font-size: 14px;
  margin-top: 5px;
}

.valid-feedback {
  display: block;
  color: #28a745;
  font-size: 14px;
  margin-top: 5px;
}

/* ===== DOCUMENTATION CONFIRMATION ===== */
#confirmationGroup {
  transition: all 0.3s ease;
}

.highlight-animation {
  animation: highlightGlow 2s ease-in-out;
}

.highlight-animation .panel {
  border: 2px solid #f0ad4e !important;
  box-shadow: 0 0 15px rgba(255, 193, 7, 0.3);
}

@keyframes highlightGlow {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

#documentationViewedCheck:disabled + strong {
  color: #6c757d;
  opacity: 0.6;
}

#documentationViewedCheck:enabled + strong {
  color: #28a745;
  font-weight: 500;
}

.btn-lg {
  font-size: 16px;
  padding: 12px 24px;
}

.panel-success .panel-body {
  background-color: #f8fff8;
  border-radius: 6px;
}

#confirmationGroup .checkbox label {
  font-size: 14px !important;
  padding-left: 25px;
  font-weight: normal;
}

#confirmationGroup .checkbox label strong {
  font-size: 14px !important;
  font-weight: 500 !important;
}

/* ===== DOCUMENT SELECTION STYLING ===== */
.documents-selection {
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden; /* Previene scroll orizzontale */
  padding: 5px;
  box-sizing: border-box;
}

.document-checkbox {
  padding: 10px 12px;
  margin: 0;
  border-radius: 4px;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  box-sizing: border-box;
  overflow: hidden; /* Previene l'overflow del contenuto */
}

.document-checkbox:hover {
  background-color: #f8f9fa;
  border-color: #e9ecef;
}

.document-selection-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  cursor: pointer;
  box-sizing: border-box;
}

.document-info {
  flex: 1;
  padding-right: 15px;
  min-width: 0; /* Previene overflow del contenuto flessibile */
  overflow: hidden;
}

.document-checkbox-container {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  width: 25px; /* Larghezza fissa per il contenitore checkbox */
  justify-content: center;
}

.document-checkbox-container input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  transform: scale(1.1);
}

.document-code {
  font-size: 14px;
  margin-bottom: 2px;
  display: block;
  line-height: 1.3;
}

.document-description {
  font-size: 13px;
  line-height: 1.3;
  margin: 0;
}

.document-separator {
  margin: 5px 0;
  border-top: 1px solid #eee;
}

.document-separator:last-child {
  display: none;
}

/* Stato checked */
.document-checkbox input[type="checkbox"]:checked ~ .document-info {
  color: #3c763d;
}

.document-checkbox:has(input[type="checkbox"]:checked) .document-info .document-code {
  color: #3c763d;
  font-weight: 600;
}

.document-checkbox:has(input[type="checkbox"]:checked) {
  background-color: #f5f5f5;
  border-color: #3c763d;
}

/* Document selection alert */
#documentSelectionAlert {
  border-color: #faebcc;
  background-color: #fcf8e3;
  color: #8a6d3b;
}

/* ===== FORM 4 STYLING ===== */

/* Subsection headers */
.subsection-header {
  background-color: #f8f9fa;
  border-left: 3px solid var(--iveco-blue);
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #495057;
  border-radius: 0 3px 3px 0;
  line-height: 1.4;
}

.subsection-header:first-child {
  margin-top: 0;
}

/* Item descriptions */
.item-description {
  font-size: 13px;
  font-weight: bold;
  color: #495057;
  line-height: 1.4;
}

.item-description-small {
  padding: 0px 0px 8px 0px;
  font-size: 12px;
  font-weight: 400;
  color: #495057;
  line-height: 1.4;
}

/* Form rows for Step 4/5 */
.form-row {
  margin-bottom: 10px;
  border-bottom: 1px solid #e9ecef;
}

.form-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.form-row .row {
  margin-top: 8px;
}

.form-row .form-control {
  border: 2px solid #e9ecef;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.form-row .form-control:focus {
  border-color: var(--iveco-blue);
  box-shadow: 0 0 0 0.2rem rgba(0, 78, 155, 0.25);
}

/* ===== END FORM 4 STYLING ===== */

/* ===== END DOCUMENT SELECTION STYLING ===== */

/* ===== STEP 6 - DEVIATION REQUESTS STYLING ===== */
#deviation-requests-container {
  margin-bottom: 1rem;
}

.deviation-request-item {
  margin-bottom: 1rem;
}

.deviation-request-item .card {
  border: 1px solid #ddd;
  border-radius: 0.375rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.deviation-request-item .card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.deviation-request-item .card-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #ddd;
  padding: 0.75rem 1rem;
}

.deviation-request-item .card-header h5 {
  color: var(--iveco-blue);
  font-weight: 600;
  margin-bottom: 0;
  flex: 1; /* Occupa tutto lo spazio disponibile a sinistra */
}

.deviation-request-item .card-header .d-flex {
  width: 100%;
  align-items: center;
}

.deviation-request-item .remove-request-btn {
  min-width: 60px !important;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: initial;
}

.deviation-request-item .remove-request-btn i {
  font-size: 16px; /* Icona più grande */
}

#add-request-btn {
  transition: all 0.3s ease;
}

#add-request-btn i {
  margin-right: 0.5rem;
}

/* Styling per i pulsanti affiancati */
.d-flex.justify-content-between .btn {
  min-width: 140px;
}

.d-flex.justify-content-between {
  gap: 1rem; /* Aggiungo gap tra i pulsanti */
}

.d-flex.justify-content-between #add-request-btn {
  margin-right: 1rem;
}

/* Responsive per schermi piccoli */
@media (max-width: 576px) {
  .d-flex.justify-content-between {
    flex-direction: column;
    gap: 1rem;
  }

  .d-flex.justify-content-between .btn {
    width: 100%;
    min-width: auto;
  }

  .d-flex.justify-content-between #add-request-btn {
    margin-right: 0;
  }
}

/* Animazione per nuove richieste */
@keyframes slideInFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.deviation-request-item {
  animation: slideInFadeIn 0.3s ease-out;
}

/* ===== END STEP 6 STYLING ===== */

/* =============================================
   CARD LAYOUT
   ============================================= */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.btn-action {
  border: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  border-radius: 4px;
}
.btn-action:hover {
  text-decoration: none;
}
.btn-action:active {
  transform: translateY(0);
}

.btn-download {
  background: #2d3748;
  color: #fff;
}
.btn-download:hover {
  background: #1a202c;
  color: #fff;
}
.btn-delete {
  background: transparent;
  color: #e53e3e;
  border: 1px solid #fed7d7;
}
.btn-delete:hover {
  background: #fff5f5;
  color: #c53030;
}

/* =============================================
     OPTION 1 – CARD PANELS
     ============================================= */
.form-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0px;
  padding: 20px 24px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  border-radius: 8px;
}
.form-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e0;
  transform: translateY(-2px);
}
.form-card .card-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.form-card .card-info h4 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: #1a202c;
}
.form-card .card-info .card-meta {
  font-size: 13px;
  color: #a0aec0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.form-card .card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =============================================
     RESPONSIVE
     ============================================= */
@media (max-width: 600px) {
  .form-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .form-card .card-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
