/**
 * CSS Styles for Excel Reader Module
 *
 * This stylesheet provides a structured layout and design for the Excel reader module, including form elements, table styles, and interactive components.
 *
 * Sections:
 * - Global Styles: Basic styling for the page and typography.
 * - Form Styles: Styling for form elements and layout.
 * - Table Styles: Styling for table presentation and interactivity.
 * - Interactive Components: Styling for modals, popups, and interactive buttons.
 * - Utility Classes: Additional styles for specific use cases.
 */

/* Z-index scale */
:root {
  --z-sticky-cell: 1;
  --z-sticky-header: 2;
  --z-sticky-col-header: 3;
  --z-popup-overlay: 15;
  --z-modal: 20;
  --z-overlay: 999;
  --z-loader: 1000;
  --z-tooltip: 1000;
}

/* Global Styles */
body {
  font-family: Arial, sans-serif;
  margin: 20px;
  background-color: #e0f7fa;
  color: #263238;
}

h1 {
  color: #004d40;
  display: inline-block;
}

label {
  font-weight: bold;
  margin-top: 10px;
  display: inline-block;
  width: 100%;
  color: #004d40;
}

/* Form Styles */
input[type="file"],
input[type="text"].editable,
select {
  margin-top: 10px;
  padding: 8px;
  border: 2px solid #00796b;
  border-radius: 4px;
  background-color: #b2dfdb;
  color: #004d40;
  width: 100%;
}

input[type="text"].filter {
  width: calc(100% - 16px);
  margin-right: 8px;
}

input[type="text"].non-editable {
  margin-top: 10px;
  padding: 8px;
  border: 2px solid #ccc;
  border-radius: 4px;
  background-color: #e0e0e0;
  color: #555;
  width: 100%;
}

.form-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.form-column {
  width: 45%;
}

form {
  background-color: #ffffff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
  display: none; /* Hide the form by default */
}

select:focus,
input[type="text"]:focus,
input[type="file"]:focus {
  background-color: #80cbc4;
  outline: none;
}

/* Table Styles */
table {
  border-collapse: collapse;
  margin-top: 20px;
  table-layout: fixed;
}

th,
td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
  max-width: 600px; 
  max-height: 200px; 
  overflow: hidden;
 /* text-overflow: ellipsis; /* Show ellipsis for overflow text */
  white-space: normal;  
  line-height: normal; 
  box-sizing: border-box; 
}

th {
  background-color: #00796b;
  color: white;
  position: -webkit-sticky; /* For Safari */
  position: sticky;
  top: 0;
  z-index: var(--z-sticky-header);
}

th.sticky-col,
td.sticky-col {
  position: -webkit-sticky; /* For Safari */
  position: sticky;
  left: 0;
  z-index: var(--z-sticky-col-header);
}

td.sticky-col {
  background-color: #e0f7fa;
  z-index: var(--z-sticky-cell);
}

tr.selected td,
tr.selected th {
  background-color: #b2dfdb;
}

/* Interactive Components */
.toggle-container {
  display: inline-flex;
  align-items: center;
  position: absolute;
  top: 20px;
  right: 20px;
  background-color: #b2dfdb;
  border-radius: 8px;
  padding: 5px;
}

.toggle-option {
  padding: 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.toggle-option.active {
  background-color: #00796b;
  color: white;
}

.scroll-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #00796b;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.3s;
}

.scroll-to-top:hover {
  opacity: 1;
}

.scroll-to-top.hidden {
  display: none;
}

.hyperlink-cell {
  color: #00796b;
  cursor: pointer;
  text-decoration: underline;
}

.file-worksheet-container {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  transition: max-height 0.3s ease;
}

.file-worksheet-container > div {
  width: 48%;
}

.info-icon {
  font-size: 16px;
  color: #00796b;
  cursor: pointer;
  margin-left: 8px;
}

.popup-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: var(--z-popup-overlay);
}

.popup {
  background-color: #ffffff;
  border: 2px solid #00796b;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
  z-index: 10;
  max-width: 400px;
  width: 100%;
  position: relative;
}

.popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  font-size: 18px;
  color: #00796b;
}

.popup em {
  font-style: italic;
}

.column-selection-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #ffffff;
  border: 2px solid #00796b;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
  z-index: var(--z-modal);
  max-height: 75vh;
  max-width: 75vw;
  overflow-y: auto;
}

.column-selection-modal h3 {
  color: #004d40;
  text-align: center;
  margin-bottom: 20px;
}

.column-selection-modal .column-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: 20px;
}

.column-selection-modal .column-list label {
  width: 48%;
  margin-bottom: 10px;
}

.column-selection-modal .actions {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

.column-selection-modal .actions-full {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.column-selection-modal button {
  padding: 8px 16px;
  background-color: #00796b;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.column-selection-modal button:hover {
  background-color: #004d40;
}

.column-selection-modal .apply-button {
  width: 100%;
}

.action-icon {
  font-size: 14px;
  color: #00796b;
  cursor: pointer;
  position: relative;
}

.action-icon:hover {
  color: #004d40;
}

.action-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #00796b;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
}

.action-icon:hover::after {
  opacity: 1;
}

.collapsible-section {
  position: relative;
  margin-top: 20px;
}

.toggle-button {
  position: absolute;
  top: 0;
  right: 0;
  background-color: #b2dfdb;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  padding: 5px 10px;
  color: #00796b;
}

.no-bullets {
  list-style-type: none; /* Remove bullets */
  padding: 0; /* Remove padding */
  margin: 20px; /* Remove margins */
}

.ignore-container {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ignore-container label {
  width: auto;
  margin-top: 0;
}

.ignore-container input {
  width: auto;
  flex-grow: 1;
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  font-size: 18px;
  color: #00796b;
}

.action-button {
  min-width: 200px;
}

#loadingIndicator {
  display: none;
  position: fixed; /* Fixed position to overlay on top of the page */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); /* Center the loading indicator */
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 2s linear infinite;
  z-index: var(--z-loader);
}
@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}
#overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
  z-index: var(--z-overlay);
}

.tooltip {
  display: none;
  position: absolute;
  background-color: #b2dfdb;
  color: #555;
  border: 2px solid #ccc;
  padding: 8px;
  border-radius: 4px;
  z-index: var(--z-tooltip);
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Responsive Styles */
@media (max-width: 768px) {
  body {
    margin: 10px;
  }

  .file-worksheet-container {
    flex-direction: column;
  }

  .file-worksheet-container > div {
    width: 100%;
  }

  .toggle-container {
    position: static;
    margin-top: 10px;
  }

  .form-row {
    flex-direction: column;
  }

  .form-column {
    width: 100%;
  }

  th,
  td {
    max-width: 200px;
    font-size: 14px;
  }

  .column-selection-modal {
    max-width: 95vw;
    max-height: 85vh;
  }

  .column-selection-modal .column-list label {
    width: 100%;
  }

  .action-button {
    min-width: auto;
    width: 48%;
  }
}
