/* Responsive DataTables CSS for Appendix Pages */

/* Mobile-first responsive table styles */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
}

/* Force table to be responsive */
#caminoRoutesTable,
#packingListTable,
#mobileAppsTable,
#caminoWebsitesTable {
  width: 100% !important;
  min-width: 100%;
  max-width: 100%;
  table-layout: fixed;
}

/* Force DataTables to respect responsive behavior */
.dataTables_wrapper {
  width: 100% !important;
  max-width: 100% !important;
}

/* Responsive column handling */
@media (max-width: 1023px) {
  #caminoRoutesTable td,
  #caminoRoutesTable th,
  #packingListTable td,
  #packingListTable th,
  #mobileAppsTable td,
  #mobileAppsTable th,
  #caminoWebsitesTable td,
  #caminoWebsitesTable th {
    white-space: normal !important;
    word-wrap: break-word;
    max-width: 120px;
    min-width: 80px;
  }
  
  /* Force horizontal scroll on medium screens */
  .table-responsive {
    overflow-x: auto;
  }
  
  /* Specific column adjustments for Camino Routes table */
  #caminoRoutesTable td:nth-child(1), /* Route */
  #caminoRoutesTable th:nth-child(1) {
    min-width: 100px;
    max-width: 150px;
  }
  
  #caminoRoutesTable td:nth-child(2), /* Starting Point */
  #caminoRoutesTable th:nth-child(2) {
    min-width: 90px;
    max-width: 120px;
  }
  
  #caminoRoutesTable td:nth-child(3), /* Distance */
  #caminoRoutesTable th:nth-child(3) {
    min-width: 60px;
    max-width: 80px;
  }
  
  #caminoRoutesTable td:nth-child(4), /* Terrain */
  #caminoRoutesTable th:nth-child(4) {
    min-width: 80px;
    max-width: 100px;
  }
  
  #caminoRoutesTable td:nth-child(5), /* Surface Types */
  #caminoRoutesTable th:nth-child(5) {
    min-width: 80px;
    max-width: 100px;
  }
  
  #caminoRoutesTable td:nth-child(6), /* Difficulty */
  #caminoRoutesTable th:nth-child(6) {
    min-width: 70px;
    max-width: 90px;
  }
  
  #caminoRoutesTable td:nth-child(7), /* Culture */
  #caminoRoutesTable th:nth-child(7) {
    min-width: 80px;
    max-width: 100px;
  }
  
  #caminoRoutesTable td:nth-child(8), /* Populated */
  #caminoRoutesTable th:nth-child(8) {
    min-width: 70px;
    max-width: 90px;
  }
  
  /* Specific column adjustments for Packing List table */
  #packingListTable td:nth-child(1), /* Item */
  #packingListTable th:nth-child(1) {
    min-width: 100px;
    max-width: 120px;
  }
  
  #packingListTable td:nth-child(2), /* Description */
  #packingListTable th:nth-child(2) {
    min-width: 150px;
    max-width: 200px;
  }
  
  #packingListTable td:nth-child(3), /* Qty */
  #packingListTable th:nth-child(3) {
    min-width: 40px;
    max-width: 60px;
  }
  
  #packingListTable td:nth-child(4), /* Category */
  #packingListTable th:nth-child(4) {
    min-width: 80px;
    max-width: 100px;
  }
  
  #packingListTable td:nth-child(5), /* Location Packed */
  #packingListTable th:nth-child(5) {
    min-width: 100px;
    max-width: 120px;
  }
  
  #packingListTable td:nth-child(6), /* Notes */
  #packingListTable th:nth-child(6) {
    min-width: 120px;
    max-width: 150px;
  }
  
  /* Specific column adjustments for Mobile Apps table */
  #mobileAppsTable td:nth-child(1), /* Mobile App */
  #mobileAppsTable th:nth-child(1) {
    min-width: 120px;
    max-width: 150px;
  }
  
  #mobileAppsTable td:nth-child(2), /* Description */
  #mobileAppsTable th:nth-child(2) {
    min-width: 150px;
    max-width: 200px;
  }
  
  #mobileAppsTable td:nth-child(3), /* Google Play */
  #mobileAppsTable th:nth-child(3) {
    min-width: 60px;
    max-width: 80px;
  }
  
  #mobileAppsTable td:nth-child(4), /* Apple Store */
  #mobileAppsTable th:nth-child(4) {
    min-width: 60px;
    max-width: 80px;
  }
  
  #mobileAppsTable td:nth-child(5), /* Category */
  #mobileAppsTable th:nth-child(5) {
    min-width: 80px;
    max-width: 100px;
  }
  
  /* Specific column adjustments for Camino Websites table */
  #caminoWebsitesTable td:nth-child(1), /* Resource Name */
  #caminoWebsitesTable th:nth-child(1) {
    min-width: 120px;
    max-width: 150px;
  }
  
  #caminoWebsitesTable td:nth-child(2), /* Category */
  #caminoWebsitesTable th:nth-child(2) {
    min-width: 100px;
    max-width: 120px;
  }
  
  #caminoWebsitesTable td:nth-child(3), /* Description */
  #caminoWebsitesTable th:nth-child(3) {
    min-width: 200px;
    max-width: 300px;
  }
}

@media (max-width: 1023px) {
  /* Hide less important columns on mobile for Camino Routes */
  #caminoRoutesTable th:nth-child(4),
  #caminoRoutesTable td:nth-child(4),
  #caminoRoutesTable th:nth-child(5),
  #caminoRoutesTable td:nth-child(5),
  #caminoRoutesTable th:nth-child(7),
  #caminoRoutesTable td:nth-child(7),
  #caminoRoutesTable th:nth-child(8),
  #caminoRoutesTable td:nth-child(8) {
    display: none !important;
  }
  
  /* Hide less important columns on mobile for Packing List */
  #packingListTable th:nth-child(5),
  #packingListTable td:nth-child(5),
  #packingListTable th:nth-child(6),
  #packingListTable td:nth-child(6) {
    display: none !important;
  }
  
  /* Hide less important columns on mobile for Mobile Apps */
  #mobileAppsTable th:nth-child(3),
  #mobileAppsTable td:nth-child(3),
  #mobileAppsTable th:nth-child(4),
  #mobileAppsTable td:nth-child(4) {
    display: none !important;
  }
  
  /* Adjust remaining columns */
  #caminoRoutesTable td,
  #caminoRoutesTable th,
  #packingListTable td,
  #packingListTable th,
  #mobileAppsTable td,
  #mobileAppsTable th,
  #caminoWebsitesTable td,
  #caminoWebsitesTable th {
    max-width: 100px;
    min-width: 60px;
    font-size: 12px;
    padding: 4px 2px;
  }
}

@media (max-width: 1023px) {
  /* Hide more columns on very small screens for Camino Routes */
  #caminoRoutesTable th:nth-child(3),
  #caminoRoutesTable td:nth-child(3),
  #caminoRoutesTable th:nth-child(6),
  #caminoRoutesTable td:nth-child(6) {
    display: none !important;
  }
  
  /* Hide more columns on very small screens for Packing List */
  #packingListTable th:nth-child(4),
  #packingListTable td:nth-child(4) {
    display: none !important;
  }
  
  /* Hide more columns on very small screens for Mobile Apps */
  #mobileAppsTable th:nth-child(5),
  #mobileAppsTable td:nth-child(5) {
    display: none !important;
  }
  
  /* Keep only essential columns */
  #caminoRoutesTable td,
  #caminoRoutesTable th,
  #packingListTable td,
  #packingListTable th,
  #mobileAppsTable td,
  #mobileAppsTable th,
  #caminoWebsitesTable td,
  #caminoWebsitesTable th {
    max-width: 120px;
    min-width: 80px;
    font-size: 11px;
    padding: 3px 1px;
  }
}

/* DataTables responsive styling */
.dtr-details {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  margin-top: 5px;
}

.dtr-details li {
  border-bottom: 1px solid #eee;
  padding: 8px 0;
  display: flex;
  flex-wrap: wrap;
}

.dtr-details li:last-child {
  border-bottom: none;
}

.dtr-title {
  font-weight: bold;
  color: #495057;
  min-width: 100px;
  flex: 0 0 120px;
  margin-right: 10px;
}

.dtr-data {
  color: #212529;
  flex: 1;
  word-wrap: break-word;
}

/* Ensure links are properly styled in responsive mode */
.dtr-data a {
  color: #007bff !important;
  text-decoration: underline;
}

/* Child row styling */
.dtr-bs-modal {
  background: rgba(0, 0, 0, 0.5);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dtr-bs-modal .dtr-modal-content {
  background: white;
  border-radius: 8px;
  padding: 20px;
  max-width: 90%;
  max-height: 90%;
  overflow-y: auto;
}

/* Responsive child row */
.dtr-child {
  background-color: #f8f9fa;
  padding: 10px;
  border-left: 4px solid #007bff;
  margin: 5px 0;
}

/* DataTables responsive button styling */
.dtr-button {
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  margin: 2px;
  cursor: pointer;
  font-size: 12px;
}

.dtr-button:hover {
  background: #0056b3;
}

/* Responsive breakpoint adjustments */
@media (max-width: 1023px) {
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    text-align: left;
    margin-bottom: 10px;
  }
  
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    text-align: center;
    margin-top: 10px;
  }
}

/* Ensure word wrap for Description columns */
#caminoWebsitesTable td:nth-child(3),
#caminoWebsitesTable th:nth-child(3) {
  white-space: normal !important;
  word-break: break-word;
  max-width: 350px;
}

/* Enhanced modal styling for clickable rows */
.dtr-modal {
  background: rgba(0, 0, 0, 0.7);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.dtr-modal-content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 90%;
  max-height: 90%;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  position: relative;
}

.dtr-modal-header {
  border-bottom: 2px solid #007bff;
  padding-bottom: 15px;
  margin-bottom: 20px;
  font-size: 1.5em;
  font-weight: bold;
  color: #007bff;
}

.dtr-modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dtr-modal-close:hover {
  background: #c82333;
}

/* Clickable row styling */
#caminoRoutesTable tbody tr,
#packingListTable tbody tr,
#mobileAppsTable tbody tr,
#caminoWebsitesTable tbody tr {
  transition: all 0.2s ease;
}

#caminoRoutesTable tbody tr:hover,
#packingListTable tbody tr:hover,
#mobileAppsTable tbody tr:hover,
#caminoWebsitesTable tbody tr:hover {
  background-color: #e3f2fd !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Modal table styling */
.dtr-modal .table {
  margin-bottom: 0;
}

.dtr-modal .table th {
  background-color: #f8f9fa;
  border-top: none;
  font-weight: 600;
  color: #495057;
}

.dtr-modal .table td {
  vertical-align: middle;
  border-top: 1px solid #dee2e6;
}

/* Responsive modal adjustments */
@media (max-width: 1023px) {
  .dtr-modal {
    padding: 10px;
  }
  
  .dtr-modal-content {
    padding: 20px;
    max-width: 95%;
  }
  
  .dtr-modal-header {
    font-size: 1.2em;
    padding-bottom: 10px;
    margin-bottom: 15px;
  }
}

/* Custom modal for row details */
.custom-modal {
  display: none;
  position: fixed;
  z-index: 1060;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.3s ease-in-out;
}

.custom-modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-modal-content {
  background-color: white;
  margin: auto;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 90%;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: slideIn 0.3s ease-out;
}

.custom-modal-header {
  border-bottom: 2px solid #007bff;
  padding-bottom: 15px;
  margin-bottom: 20px;
  font-size: 1.5em;
  font-weight: bold;
  color: #007bff;
}

.custom-modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.custom-modal-close:hover {
  background: #c82333;
}

.custom-modal-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.custom-modal-table th,
.custom-modal-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #dee2e6;
}

.custom-modal-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #495057;
  border-top: none;
}

.custom-modal-table tr:hover {
  background-color: #f8f9fa;
}

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

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

/* Mobile responsive for custom modal */
@media (max-width: 1023px) {
  .custom-modal-content {
    padding: 20px;
    width: 95%;
  }
  
  .custom-modal-header {
    font-size: 1.2em;
    padding-bottom: 10px;
    margin-bottom: 15px;
  }
  
  .custom-modal-table th,
  .custom-modal-table td {
    padding: 8px;
    font-size: 14px;
  }
}

/* App store link styling */
.app-store-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  transition: all 0.2s ease;
}

.app-store-link:hover {
  background-color: #e9ecef;
  border-color: #adb5bd;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.app-store-link img {
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.app-store-link span {
  font-weight: 500;
  font-size: 14px;
}

/* Platform detection styling */
.platform-message {
  color: #6c757d;
  font-style: italic;
  font-size: 13px;
} 