/* General layout improvements */
.main-container {
  margin-bottom: 2rem;
}

@media (min-width: 992px) {
  .main-container {
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
    padding: 2.5rem !important;
  }

  .form-section {
    padding: 1.5rem;
  }
}

/* Original styles */
.on-rules-section #mobileNav,
.on-rules-section .desktop-nav {
  display: none !important;
}

.on-rules-section .mobile-bottom-space {
  display: none;
}

#logoContainer.d-none {
  opacity: 0;
  height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

#logoContainer.d-block {
  opacity: 1;
  height: auto;
}

/* Mobile navigation improvements */
#mobileNav .nav-link {
  flex: 1;
  text-align: center;
  padding: 0.5rem 0;
}

#mobileNav .nav-link.active {
  color: var(--bs-primary);
  font-weight: 500;
}

#mobileNav .nav-link.active i {
  color: var(--bs-primary);
}

/* Desktop navigation active state */
.nav-btn.active {
  background-color: var(--bs-primary);
  color: white;
  border-color: var(--bs-primary);
}

/* Scanner overlay */
.scan-success-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(25, 135, 84, 0.8);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  font-weight: bold;
  z-index: 10;
  animation: fadeInOut 1.5s forwards;
}

@keyframes fadeInOut {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* Manual device entry feedback */
.manual-feedback {
  position: absolute;
  bottom: -25px;
  left: 0;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: opacity 0.3s;
}

/* Section transitions */
.form-section {
  display: none;
  animation: fadeInUp 0.3s ease-out;
}

.form-section.active {
  display: block;
}

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

/* Mobile table improvements */
@media (max-width: 767.98px) {
  #scannedEquipmentTable {
    font-size: 0.875rem;
  }

  #scannedEquipmentTable .btn-sm {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
  }

  /* Stack condition buttons on mobile */
  #scannedEquipmentTable .d-flex.gap-1 {
    flex-direction: column;
    gap: 0.25rem !important;
  }

  /* Better spacing for mobile tables */
  #scannedEquipmentTable td {
    padding: 0.5rem 0.25rem;
    vertical-align: middle;
  }

  /* Make the device ID column more prominent */
  #scannedEquipmentTable td:first-child {
    font-weight: 500;
    font-size: 0.8rem;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Improved Tab Navigation */
#deviceTabs {
  display: flex;
  margin-bottom: 1.5rem;
  border-radius: 0.5rem;
  background-color: var(--bs-light);
  padding: 0.5rem;
  gap: 0.5rem;
  border: none;
}

#deviceTabs .nav-item {
  flex: 1;
}

#deviceTabs .nav-link {
  width: 100%;
  border: none;
  padding: 0.75rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--bs-gray-600);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

#deviceTabs .nav-link i {
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

#deviceTabs .nav-link.active {
  background-color: white;
  color: var(--bs-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Tab Content Animation */
.tab-content .tab-pane {
  animation: fadeIn 0.2s ease-out;
}

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

/* Improved Summary Table */
.summary-table {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
  border-collapse: collapse;
}

.summary-table th,
.summary-table td {
  width: 25%;
  text-align: center;
  vertical-align: middle;
  padding: 0.75rem;
}

.summary-table th {
  background-color: var(--bs-light);
  font-weight: 600;
}

.summary-table td:first-child {
  text-align: left;
  font-weight: 500;
}

.summary-table tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Damage notes styling */
.damage-notes {
  font-size: 0.85rem;
  color: var(--bs-danger);
  background-color: rgba(var(--bs-danger-rgb), 0.08);
  padding: 0.5rem;
  border-radius: 0.25rem;
  margin-top: 0.5rem;
}

/* Modal animation */
.modal.fade .modal-dialog {
  transition: transform 0.2s ease-out;
  transform: translateY(-50px);
}

.modal.show .modal-dialog {
  transform: translateY(0);
}

/* Better textarea focus */
#damageNotesText:focus {
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-warning-rgb), 0.25);
  border-color: var(--bs-warning);
}

/* Error animation */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

#damageNotesError:not(.d-none) {
  display: block !important;
  animation: shake 0.6s;
}

.form-label.required:after {
  content: " *";
  color: var(--bs-danger);
}

/* Summary section styles */
#summarySection .card {
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#summarySection .card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--bs-primary);
  border-bottom: 1px solid var(--bs-border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
}

#summary-notes {
  display: inline-block;
  padding: 0.5rem;
  background-color: var(--bs-light);
  border-radius: 0.25rem;
  width: 100%;
}

#summarySection h5 {
  font-size: 1.1rem;
}

#summarySection .table td,
#summarySection .table th {
  padding: 0.5rem;
}

/* Highlight invalid input/select fields */
.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--bs-danger);
  background-color: #fff0f0;
}

/* Optional: add a fade-in effect for feedback */
.was-validated .form-control:invalid,
.was-validated .form-select:invalid {
  animation: shake 0.15s ease-in-out 1;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  50% { transform: translateX(2px); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

/* Optional: error message styling */
.invalid-feedback {
  display: none;
  color: var(--bs-danger);
  font-size: 0.875em;
}

.is-invalid + .invalid-feedback {
  display: block;
}
