/* ============================================
   HHMT Section Styles - Consolidated Version
   ============================================ */

/* ===========================================
   1. COLLAPSIBLE BUTTONS (Data/Log Files)
   =========================================== */

.hhmt-files-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 180px;
  margin-bottom: 0;
  overflow: hidden;
}

.hhmt-data-btn {
  background-color: #667eea;
  box-shadow: 0 3px 12px rgba(102, 126, 234, 0.3);
}

.hhmt-log-btn {
  background-color: #f093fb;
  box-shadow: 0 3px 12px rgba(240, 147, 251, 0.3);
}

.hhmt-files-btn:hover {
  transform: translateY(-2px);
}

.hhmt-data-btn:hover {
  background-color: #5568d3;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.hhmt-log-btn:hover {
  background-color: #d87ae6;
  box-shadow: 0 6px 20px rgba(240, 147, 251, 0.4);
}

.hhmt-files-btn:active {
  transform: translateY(-1px);
}

.hhmt-files-btn:focus {
  outline: none;
}

.hhmt-data-btn:focus {
  box-shadow: 0 3px 12px rgba(102, 126, 234, 0.3),
    0 0 0 3px rgba(102, 126, 234, 0.3);
}

.hhmt-log-btn:focus {
  box-shadow: 0 3px 12px rgba(240, 147, 251, 0.3),
    0 0 0 3px rgba(240, 147, 251, 0.3);
}

/* Hide state for collapsible buttons */
.hhmt-data-btn.hide-state,
.hhmt-log-btn.hide-state {
  background-color: #dc3545;
  box-shadow: 0 3px 12px rgba(220, 53, 69, 0.3);
}

.hhmt-data-btn.hide-state:hover,
.hhmt-log-btn.hide-state:hover {
  background-color: #c82333;
  box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

/* ===========================================
   2. MODAL BUTTONS (PScan, Trim, ConnCheck)
   =========================================== */

.hhmt-pscan-btn,
.hhmt-trim-btn,
.hhmt-conncheck-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  min-width: 220px;
}

/* Button-specific colors */
.hhmt-pscan-btn {
  background-color: #6c757d;
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
}

.hhmt-trim-btn {
  background-color: #ffc107;
  box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
}

.hhmt-conncheck-btn {
  background-color: #17a2b8;
  box-shadow: 0 4px 15px rgba(23, 162, 184, 0.4);
}

/* Hover states */
.hhmt-pscan-btn:hover,
.hhmt-trim-btn:hover,
.hhmt-conncheck-btn:hover {
  transform: translateY(-2px);
}

.hhmt-pscan-btn:hover {
  background-color: #5a6268;
  box-shadow: 0 8px 25px rgba(108, 117, 125, 0.5);
}

.hhmt-trim-btn:hover {
  background-color: #e0a800;
  box-shadow: 0 8px 25px rgba(255, 193, 7, 0.5);
}

.hhmt-conncheck-btn:hover {
  background-color: #138496;
  box-shadow: 0 8px 25px rgba(23, 162, 184, 0.5);
}

/* Active and focus states */
.hhmt-pscan-btn:active,
.hhmt-trim-btn:active,
.hhmt-conncheck-btn:active {
  transform: translateY(-1px);
}

.hhmt-pscan-btn:focus,
.hhmt-trim-btn:focus,
.hhmt-conncheck-btn:focus {
  outline: none;
}

/* Button icons */
.hhmt-pscan-icon,
.hhmt-trim-icon,
.hhmt-conncheck-icon,
.btn-icon {
  width: 20px;
  height: 20px;
  color: white;
  transition: transform 0.3s ease;
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.hhmt-pscan-btn:hover .hhmt-pscan-icon,
.hhmt-trim-btn:hover .hhmt-trim-icon,
.hhmt-conncheck-btn:hover .hhmt-conncheck-icon,
.hhmt-files-btn:hover .btn-icon {
  transform: scale(1.1);
}

.hhmt-pscan-btn span,
.hhmt-trim-btn span,
.hhmt-conncheck-btn span,
.hhmt-files-btn span {
  position: relative;
  z-index: 1;
}

/* ===========================================
   3. BUTTON SECTIONS (Positioning)
   =========================================== */

.hhmt-pscan-section,
.hhmt-trim-section,
.hhmt-conncheck-section {
  margin: 0;
  display: inline-block;
  vertical-align: middle;
}

.hhmt-pscan-section {
  text-align: left;
}

.hhmt-trim-section {
  text-align: center;
}

.hhmt-conncheck-section {
  text-align: right;
}

/* ===========================================
   4. MODALS (Common Styles)
   =========================================== */

.hhmt-pscan-modal,
.hhmt-trim-modal,
.hhmt-conncheck-modal,
#image-fullscreen-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.3s ease-in-out;
}

#image-fullscreen-modal {
  z-index: 2000;
  background-color: rgba(0, 0, 0, 0.9);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal content */
.hhmt-pscan-modal-content,
.hhmt-trim-modal-content {
  background-color: #fefefe;
  padding: 20px;
  margin: 5% auto;
  border: 1px solid #888;
  width: 90%;
  max-width: 1200px;
  border-radius: 8px;
  position: relative;
  animation: slideInCenter 0.3s ease-in-out;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  /* Centered positioning with transform */
  position: fixed;
  top: 50%;
  left: 40%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.hhmt-conncheck-modal-content {
  background-color: #fefefe;
  padding: 20px;
  border: 1px solid #888;
  width: 90%;
  max-width: 1400px;
  max-height: 75vh;
  overflow-y: auto;
  border-radius: 8px;
  position: fixed;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: slideInCenter 0.3s ease-in-out;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  margin: 0;
}

@keyframes slideInCenter {
  from {
    transform: translate(-50%, -60%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

/* Close buttons */
.hhmt-pscan-close,
.hhmt-trim-close,
.hhmt-conncheck-close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  top: 10px;
  right: 15px;
  transition: color 0.3s ease;
}

.hhmt-pscan-close:hover,
.hhmt-pscan-close:focus,
.hhmt-trim-close:hover,
.hhmt-trim-close:focus,
.hhmt-conncheck-close:hover,
.hhmt-conncheck-close:focus {
  color: #dc3545;
  text-decoration: none;
}

/* Modal body layout */
.hhmt-pscan-modal-body,
.hhmt-trim-modal-body {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

/* Modal headers */
.hhmt-pscan-modal h2,
.hhmt-trim-modal h2,
.hhmt-conncheck-modal h2 {
  margin-top: 0;
  border-bottom: 2px solid;
  padding-bottom: 10px;
}

.hhmt-pscan-modal h2 {
  color: #007bff;
  border-bottom-color: #007bff;
}

.hhmt-trim-modal h2 {
  color: #ffc107;
  border-bottom-color: #ffc107;
}

.hhmt-conncheck-modal h2 {
  color: #17a2b8;
  border-bottom-color: #17a2b8;
}

.hhmt-pscan-modal h3,
.hhmt-trim-modal h3,
.hhmt-conncheck-modal h3 {
  margin-bottom: 15px;
  padding-bottom: 5px;
  font-size: 18px;
}

.hhmt-conncheck-modal h3 {
  color: #6c757d;
  margin-bottom: 20px;
}

/* ===========================================
   5. FILE LISTS (Common Styles)
   =========================================== */

.file-list {
  max-height: 150px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
  background-color: #f8f9fa;
}

.file-list::-webkit-scrollbar {
  width: 8px;
}

.file-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.file-list::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.file-list::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.file-item {
  padding: 8px;
  margin-bottom: 8px;
  background-color: #ffffff;
  border-radius: 4px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.file-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.file-item a {
  color: #007bff;
  text-decoration: none;
  font-weight: bold;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item a:hover {
  color: #0056b3;
  text-decoration: underline;
}

/* Specific file item borders */
.hhmt-pscan-txt-files .file-item {
  border-left: 4px solid #dc3545;
}

.hhmt-pscan-root-files .file-item {
  border-left: 4px solid #fd7e14;
}

/* ===========================================
   6. PSCAN SPECIFIC STYLES
   =========================================== */

.hhmt-pscan-pdf-section {
  flex: 2;
  min-height: 400px;
}

.hhmt-pscan-files-section {
  flex: 1;
  min-width: 300px;
}

.hhmt-pscan-txt-files h3 {
  color: #dc3545;
  border-bottom: 2px solid #dc3545;
}

.hhmt-pscan-root-files h3 {
  color: #fd7e14;
  border-bottom: 2px solid #fd7e14;
}

.hhmt-pscan-pdf-section h3 {
  color: #28a745;
  border-bottom: 2px solid #28a745;
}

.hhmt-pscan-modal iframe {
  width: 100%;
  height: 350px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Loading animation for iframe */
.hhmt-pscan-pdf-section::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ===========================================
   7. CONNECTIVITY CHECK SPECIFIC STYLES
   =========================================== */

.hhmt-conncheck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 10px 0;
}

.conncheck-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  background-color: #f8f9fa;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  cursor: pointer;
}

.conncheck-card:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Image preview container - reduced height */
.conncheck-image-container {
  width: 100%;
  height: 150px;
  border-radius: 4px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  cursor: zoom-in;
  background-color: #f0f0f0;
}

.conncheck-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.conncheck-image-container:hover img {
  transform: scale(1.05);
}

/* TXT placeholder (when no PNG) */
.conncheck-card .txt-placeholder {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
  position: relative;
  overflow: hidden;
}

.conncheck-card .txt-placeholder .icon-overlay {
  text-align: center;
  color: white;
  z-index: 1;
  position: relative;
}

.conncheck-card .txt-placeholder .icon-overlay .icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.conncheck-card .txt-placeholder .icon-overlay .label {
  font-size: 14px;
  font-weight: bold;
}

.conncheck-card .txt-placeholder .icon-overlay .sublabel {
  font-size: 11px;
  opacity: 0.9;
  margin-top: 5px;
}

.conncheck-card .txt-placeholder .bg-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.1;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255, 255, 255, 0.5) 10px,
    rgba(255, 255, 255, 0.5) 20px
  );
}

/* File info */
.conncheck-card .file-info .filename {
  font-weight: bold;
  margin-bottom: 8px;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.4;
  color: #333;
}

.conncheck-card .file-info .file-details {
  font-size: 11px;
  color: #666;
  margin-bottom: 8px;
}

.conncheck-card .file-info .view-txt-btn {
  display: block;
  text-align: center;
  padding: 8px 12px;
  background-color: #007bff;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  transition: background-color 0.2s ease;
}

.conncheck-card .file-info .view-txt-btn:hover {
  background-color: #0056b3;
}

.preview-available {
  color: #28a745;
  font-size: 11px;
  font-weight: bold;
}

/* Zoom indicator */
.conncheck-image-container .zoom-indicator {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  pointer-events: none;
}

/* ===========================================
   8. FULLSCREEN IMAGE MODAL
   =========================================== */

#image-fullscreen-modal img {
  max-width: 90%;
  max-height: 85vh;
  margin: auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: zoomIn 0.3s ease-in-out;
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

#image-fullscreen-modal #image-caption {
  color: white;
  font-size: 18px;
  margin-top: 20px;
  text-align: center;
  padding: 0 20px;
}

/* ===========================================
   9. RESPONSIVE DESIGN
   =========================================== */

@media (max-width: 768px) {
  /* Modal content */
  .hhmt-pscan-modal-content,
  .hhmt-trim-modal-content,
  .hhmt-conncheck-modal-content {
    width: 95%;
    padding: 15px;
    max-height: 90vh;
  }

  /* Modal bodies */
  .hhmt-pscan-modal-body,
  .hhmt-trim-modal-body {
    flex-direction: column;
    gap: 15px;
  }

  /* PScan sections */
  .hhmt-pscan-pdf-section {
    min-height: 300px;
  }

  .hhmt-pscan-modal iframe {
    height: 300px;
  }

  .hhmt-pscan-files-section {
    min-width: auto;
  }

  /* File lists */
  .file-list {
    max-height: 200px;
  }

  /* Connectivity check grid */
  .hhmt-conncheck-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
  }

  .conncheck-card {
    padding: 12px;
  }

  .conncheck-image-container,
  .conncheck-card .txt-placeholder {
    height: 150px;
  }

  .conncheck-card .txt-placeholder .icon-overlay .icon {
    font-size: 36px;
  }

  /* Buttons */
  .hhmt-pscan-btn,
  .hhmt-trim-btn,
  .hhmt-conncheck-btn {
    min-width: 180px;
    padding: 10px 20px;
    font-size: 14px;
  }

  /* Fullscreen image */
  #image-fullscreen-modal img {
    max-width: 95%;
    max-height: 80vh;
  }

  #image-fullscreen-modal #image-caption {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  /* Modal content */
  .hhmt-pscan-modal-content,
  .hhmt-trim-modal-content,
  .hhmt-conncheck-modal-content {
    width: 98%;
    padding: 10px;
  }

  /* Modal headers */
  .hhmt-pscan-modal h2,
  .hhmt-trim-modal h2,
  .hhmt-conncheck-modal h2 {
    font-size: 18px;
  }

  .hhmt-pscan-modal h3,
  .hhmt-trim-modal h3,
  .hhmt-conncheck-modal h3 {
    font-size: 16px;
  }

  /* PScan iframe */
  .hhmt-pscan-modal iframe {
    height: 250px;
  }

  /* File lists */
  .file-list {
    max-height: 120px;
  }

  /* Connectivity check grid */
  .hhmt-conncheck-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .conncheck-image-container,
  .conncheck-card .txt-placeholder {
    height: 120px;
  }

  /* Buttons */
  .hhmt-pscan-btn,
  .hhmt-trim-btn,
  .hhmt-conncheck-btn {
    min-width: 150px;
    padding: 8px 16px;
    font-size: 13px;
  }

  /* Fullscreen image */
  #image-fullscreen-modal img {
    max-width: 98%;
  }

  #image-fullscreen-modal #image-caption {
    font-size: 14px;
  }
}

/* ===========================================
   10. SCROLLBAR STYLING
   =========================================== */

.hhmt-pscan-modal-content::-webkit-scrollbar,
.hhmt-trim-modal-content::-webkit-scrollbar,
.hhmt-conncheck-modal-content::-webkit-scrollbar {
  width: 10px;
}

.hhmt-pscan-modal-content::-webkit-scrollbar-track,
.hhmt-trim-modal-content::-webkit-scrollbar-track,
.hhmt-conncheck-modal-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 5px;
}

.hhmt-pscan-modal-content::-webkit-scrollbar-thumb,
.hhmt-trim-modal-content::-webkit-scrollbar-thumb,
.hhmt-conncheck-modal-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 5px;
}

.hhmt-pscan-modal-content::-webkit-scrollbar-thumb:hover,
.hhmt-trim-modal-content::-webkit-scrollbar-thumb:hover,
.hhmt-conncheck-modal-content::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
