/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #ffffff;
}

/* Layout */
header {
  background-color: #00205b; /* TUI dark blue */
  color: white;
  padding: 0.5rem 2rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1000;
}

.header-title {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.home-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: white;
}

.home-link:hover {
  opacity: 0.9;
}

.tui-logo {
  height: 32px;
  margin-right: 12px;
}

header h1 {
  margin-bottom: 0;
  font-weight: bold;
  font-size: 1.25rem;
}

main {
  max-width: 1400px; /* Increased from 1200px to accommodate wider content like reports */
  margin: 1rem auto;
  padding: 0 1rem;
}

footer {
  text-align: center;
  padding: 1rem;
  background-color: #00205b; /* TUI dark blue */
  color: white;
  margin-top: 2rem;
}

/* Navigation */
nav ul {
  display: flex;
  list-style: none;
}

nav li {
  margin-right: 1.5rem;
  position: relative;
}

nav a {
  color: #ffffff;
  text-decoration: none;
  padding: 0.5rem 0;
  transition: color 0.3s;
  display: block;
  font-weight: 500;
}

nav a:hover {
  color: rgba(255, 255, 255, 0.8);
}

nav a.active {
  border-bottom: 2px solid #d40e14; /* TUI red */
}

/* Dropdown styles */
.dropdown-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
}

.dropdown-toggle::after {
  content: '▼';
  font-size: 0.7em;
  margin-left: 0.5rem;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #00205b; /* TUI dark blue */
  min-width: 160px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  z-index: 1001;
  border-radius: 0;
  padding: 0.5rem 0;
  margin-top: 0.5rem;
}

.dropdown-menu li {
  margin: 0;
}

.dropdown-menu a {
  padding: 0.5rem 1rem;
  border-radius: 0;
}

.dropdown-menu a:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Show dropdown menu when menu-active class is present (click behavior) */
/* Use direct child selector to avoid showing nested submenus prematurely */
.dropdown.menu-active > .dropdown-menu {
  display: block;
}

/* Table sections */
.table-section {
  display: none;
  margin-bottom: 2rem;
  width: 100%; /* Ensure full width */
}

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

/* Table section specifically for reports */
.table-section[data-report-id] {
  min-height: 700px; /* Give enough space for the report to render */
  width: 100%;
}

.table-section h2 {
  margin-bottom: 0.75rem;
  color: #00205b; /* TUI dark blue */
  font-size: 1.5rem;
  font-weight: bold;
}

/* Table controls */
.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0;
}

/* This class is no longer needed as we're using selector-container instead */
/* .filter-left {
  display: flex;
  align-items: center;
} */

.checkbox-container {
  display: flex;
  align-items: center;
  margin-right: 2rem;
}

.checkbox-container input[type="checkbox"] {
  margin-right: 0.5rem;
}

.checkbox-container label {
  font-weight: 500;
  cursor: pointer;
}

.selector-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.selector-container select {
  padding: 0.25rem 0.5rem;
  border: 1px solid #dee2e6;
  border-radius: 0;
  background-color: white;
  min-width: 120px;
  font-size: 0.875rem;
}

.selector-container select:focus {
  outline: none;
  border-color: #00205b;
}

/* Loading and error states */
.loading, .error-message {
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 0;
}

.loading {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
}

.error-message {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  display: none;
}

/* Table styling */
.table-container {
  overflow-x: auto;
  margin-bottom: 1rem;
  border: 1px solid #e0e0e0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: white;
  border: 1px solid #e0e0e0;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
  border-right: 1px solid #e0e0e0;
}

th:last-child, td:last-child {
  border-right: none;
}

th {
  background-color: #00205b; /* TUI dark blue */
  color: white;
  position: sticky;
  top: 0;
  font-weight: normal;
}

tr:nth-child(even) {
  background-color: #f9f9f9;
}

tr:hover {
  background-color: #f2f2f2;
}

/* Add a red banner for important messages, similar to TUI's banner */
.banner {
  background-color: #d40e14; /* TUI red */
  color: white;
  padding: 0.75rem;
  text-align: center;
  font-weight: bold;
}

/* Editable cells */
.editable {
  cursor: pointer;
  position: relative;
}

/* Edit mode enabled */
.edit-enabled:hover {
  background-color: #f0f0f0;
}

.edit-enabled:hover::after {
  content: '✏️';
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  opacity: 0.5;
}

/* Edit mode disabled */
.edit-disabled {
  cursor: default;
}

.edit-disabled:hover {
  background-color: inherit;
}

.edit-disabled:hover::after {
  content: none;
}

/* Non-editable cells */
.non-editable {
  color: #6c757d;
  font-style: italic;
}

/* Ensure striped background works with non-editable cells */
tr:nth-child(even) .non-editable {
  background-color: #f9f9f9;
}

tr:hover .non-editable {
  background-color: #f2f2f2;
}

/* Edit inputs */
.edit-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #00205b;
  border-radius: 0;
  font-family: inherit;
  font-size: inherit;
}

textarea.edit-input {
  resize: vertical;
  min-height: 60px;
}

/* Action buttons */
.save-btn, .cancel-btn {
  padding: 0.3rem 0.6rem;
  margin-right: 0.3rem;
  border: none;
  border-radius: 0;
  cursor: pointer;
  font-size: 0.8rem;
}

.save-btn {
  background-color: #00205b;
  color: white;
}

.save-btn:hover {
  background-color: #001a49;
}

.cancel-btn {
  background-color: #f2f2f2;
  color: #333;
  border: 1px solid #ddd;
}

.cancel-btn:hover {
  background-color: #e6e6e6;
}

/* Icon buttons */
.icon-btn {
  background: none;
  border: 2px solid #00205b; /* TUI blue border */
  border-radius: 4px; /* Slightly rounded corners */
  cursor: pointer;
  font-size: 1.2rem;
  color: #00205b;
  padding: 0.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
  background-color: rgba(0, 32, 91, 0.05); /* Light blue background */
}

.icon-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn:hover {
  color: #001a49;
}

.view-icon::before {
  content: '👁️';
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
}

.view-icon {
  cursor: pointer;
  color: #00205b;
}

.view-icon:hover {
  opacity: 0.8;
}

.save-icon::before {
  content: '💾';
}

.cancel-icon::before {
  content: '❌';
}

/* Edit icon styling */

.edit-icon-active {
  color: #d40e14; /* TUI red for active state */
  border-color: #d40e14 !important; /* TUI red border for active state */
  background-color: rgba(212, 14, 20, 0.1); /* Light red background */
}

.edit-icon-inactive {
  color: #00205b; /* TUI blue for inactive state */
  border-color: #00205b; /* TUI blue border for inactive state */
  background-color: rgba(0, 32, 91, 0.05); /* Light blue background */
}

/* Action column styling */
.actions-cell {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-width: 120px;
  white-space: nowrap;
}

/* Sort icons and styling */
th {
  position: relative;
  cursor: pointer;
}

th.sortable {
  padding-right: 25px; /* Make room for the sort icons */
}

th.sortable:hover {
  background-color: #001a49;
}

.sort-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  opacity: 0.5;
}

.sort-asc::after {
  content: '▲';
}

.sort-desc::after {
  content: '▼';
}

th.sort-active .sort-icon {
  opacity: 1;
}

/* Notification */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 10px 20px;
  border-radius: 0;
  color: white;
  font-weight: bold;
  z-index: 1000;
  display: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.notification.success {
  background-color: #28a745;
}

.notification.error {
  background-color: #d40e14;
}

/* Modal styles */
.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.5);
}

/* Special styling for expanded modal (used by explorer tabs) */
.modal-expanded {
  width: 100% !important;
  height: 100% !important;
  padding: 20px;
}

.modal-expanded .modal-content {
  width: 98% !important;
  max-width: 1800px !important;
  height: 90vh !important;
  margin: 2vh auto !important;
}

.modal-expanded .modal-body {
  height: calc(90vh - 120px) !important;
  overflow: auto;
}

/* Specific styles for explorer content in expanded modals */
.modal-expanded .explorer-diagram {
  min-width: 600px !important;
  min-height: 500px !important;
  border: 1px solid #ccc;
  background-color: #f9f9f9;
  flex: 3 !important;
  width: 75% !important;
}

.modal-expanded .explorer-details {
  min-width: 200px !important;
  flex: 1 !important;
  width: 25% !important;
  padding: 0 10px;
}

.modal-expanded .explorer-content-layout {
  display: flex !important;
  width: 100% !important;
  height: calc(90vh - 180px) !important;
  min-height: 500px !important;
}

.modal-content {
  background-color: #fff;
  margin: 10% auto;
  padding: 0;
  border: 1px solid #888;
  width: 70%;
  max-width: 800px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  position: relative;
}

/* Wider modal for Web Component Implementation */
#web-component-implementation-modal .modal-content {
  width: 95%;
  max-width: 1200px;
}

/* Wider modal for USL Service */
#usl-service-modal .modal-content {
  width: 95%;
  max-width: 1200px;
}

/* USL Service explorer table column widths */
#usl-service-explorer-content .details-table th:nth-child(1) {
  width: 15%; /* Name column */
}

#usl-service-explorer-content .details-table th:nth-child(2) {
  width: 35%; /* Description column - make this wider */
}

#usl-service-explorer-content .details-table th:nth-child(3) {
  width: 25%; /* Key column */
}

#usl-service-explorer-content .details-table th:nth-child(4),
#usl-service-explorer-content .details-table th:nth-child(5) {
  width: 12.5%; /* Status and Project columns */
}

.modal-header {
  padding: 15px 20px;
  background-color: #00205b;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.close-modal {
  color: white;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close-modal:hover {
  color: #ddd;
}

.modal-body {
  padding: 20px;
}

.modal-tabs {
  display: flex;
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.tab-button {
  padding: 10px 20px;
  background-color: transparent;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s;
}

.tab-button:hover {
  background-color: #e9ecef;
}

.tab-button.active {
  background-color: white;
  border-bottom: 2px solid #00205b;
}

.tab-content {
  display: none;
  padding: 15px 0;
}

.tab-content.active {
  display: block;
}

.details-table {
  width: 100%;
  border-collapse: collapse;
}

.details-table th {
  width: 30%;
  text-align: left;
  padding: 10px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  font-weight: 500;
  color: #333;
}

.details-table td {
  width: 70%;
  padding: 10px;
  border: 1px solid #dee2e6;
}

/* Home page styles */
.home-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.home-container h2 {
  margin-bottom: 2rem;
  color: #00205b;
  font-size: 2.5rem;
  text-align: center;
}

.home-content {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.home-section h3 {
  margin-bottom: 1.5rem;
  color: #00205b;
  font-size: 1.8rem;
  border-bottom: 2px solid #d40e14;
  padding-bottom: 0.5rem;
}

.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.card-container.reference-data {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.card {
  background-color: white;
  border: 1px solid #e0e0e0;
  border-radius: 0;
  padding: 1.5rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card h4 {
  color: #00205b;
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.card p {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 0;
}

.reference-data .card {
  text-align: center;
  padding: 1rem;
}

.reference-data .card h4 {
  margin-bottom: 0;
}

/* User Guide styles */
.user-guide-section {
  margin-top: 3rem;
}

.user-guide {
  background-color: white;
  border: 1px solid #e0e0e0;
  border-radius: 0;
  padding: 2rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.guide-section {
  margin-bottom: 2rem;
}

.guide-section:last-child {
  margin-bottom: 0;
}

.guide-section h4 {
  color: #00205b;
  margin-bottom: 1rem;
  font-size: 1.3rem;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 0.5rem;
}

.guide-section p {
  margin-bottom: 1rem;
  line-height: 1.6;
}

.guide-section ul, 
.guide-section ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.guide-section li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.guide-section a {
  color: #00205b;
  text-decoration: none;
}

.guide-section a:hover {
  text-decoration: underline;
}

.guide-section strong {
  color: #00205b;
  font-weight: bold;
}

.important-note {
  background-color: #f8f9fa;
  border-left: 4px solid #d40e14;
  padding: 1rem;
  margin: 1rem 0;
}

.important-note p {
  margin-bottom: 0;
}

.important-note strong {
  color: #d40e14;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  header {
    padding: 1rem;
  }
  
  nav ul {
    flex-direction: column;
  }
  
  nav li {
    margin-right: 0;
    margin-bottom: 0.5rem;
  }
  
  /* Mobile: top-level dropdown menus only */
  .dropdown > .dropdown-menu {
    position: static;
    box-shadow: none;
    background-color: rgba(255, 255, 255, 0.1);
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding-left: 1rem;
  }

  .dropdown:hover > .dropdown-menu {
    display: none;
  }

  .dropdown.active > .dropdown-menu {
    display: block;
  }
  
  th, td {
    padding: 0.5rem;
  }
  
  .notification {
    top: 10px;
    right: 10px;
    left: 10px;
    width: calc(100% - 20px);
    text-align: center;
  }
}

/* Loading indicators - Enhanced for lazy loading */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.loading-indicator .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Global loading indicator */
.global-loading-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: rgba(0, 32, 91, 0.9);
  color: white;
  padding: 15px;
  border-radius: 4px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.global-loading-indicator .spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

/* Global progress indicator */
.global-progress-indicator {
  position: fixed;
  padding: 15px;
  background-color: rgba(0, 32, 91, 0.9);
  color: white;
  border-radius: 4px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  min-width: 250px;
}

/* Position variations */
.global-progress-indicator.position-bottom-right {
  bottom: 20px;
  right: 20px;
}

.global-progress-indicator.position-bottom-left {
  bottom: 20px;
  left: 20px;
}

.global-progress-indicator.position-top-right {
  top: 20px;
  right: 20px;
}

.global-progress-indicator.position-top-left {
  top: 20px;
  left: 20px;
}

.global-progress-indicator.position-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.global-progress-indicator .spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

.global-progress-indicator .progress-message {
  margin-bottom: 10px;
  text-align: center;
}

.global-progress-indicator .progress-container {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  margin-bottom: 5px;
  position: relative;
  height: 20px;
}

.global-progress-indicator .progress-bar {
  height: 100%;
  background-color: #d40e14; /* TUI red */
  border-radius: 4px;
  transition: width 0.3s ease;
}

.global-progress-indicator .progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

/* Section loading state */
.table-section.loading-state {
  position: relative;
  min-height: 200px;
}

.table-section.loading-state::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.7);
  z-index: 10;
}

.table-section.loading-state .loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
}

/* Action buttons (row-level delete, etc.) */
.action-button-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.action-btn {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid;
}

.action-btn-delete {
  background-color: #f8f8f8;
  border-color: #ccc;
  color: #666;
}

.action-btn-delete[data-loading="true"] {
  background-color: #f0f0f0;
  border-color: #ddd;
  color: #999;
  cursor: wait;
}

.action-btn-delete.action-btn-enabled {
  background-color: #dc3545;
  border-color: #dc3545;
  color: white;
}

.action-btn-delete.action-btn-enabled:hover {
  background-color: #c82333;
  border-color: #bd2130;
}

.action-btn-delete.action-btn-disabled {
  background-color: #f8f8f8;
  border-color: #ddd;
  color: #aaa;
  cursor: not-allowed;
}

.action-btn-delete.action-btn-error {
  background-color: #fff3cd;
  border-color: #ffc107;
  color: #856404;
  cursor: not-allowed;
}

.action-btn-ignore {
  background-color: #6c757d;
  border-color: #6c757d;
  color: white;
}

.action-btn-ignore:hover {
  background-color: #5a6268;
  border-color: #545b62;
}

.action-btn-ignore:disabled {
  background-color: #adb5bd;
  border-color: #adb5bd;
  cursor: not-allowed;
}

/* Table tooltips */
.has-tooltip {
  position: relative;
}

.has-tooltip::after {
  content: ' ?';
  color: #00205b;
  font-weight: bold;
  font-size: 0.8em;
}

.table-tooltip {
  display: none;
  position: fixed;
  z-index: 10000;
  background-color: #333;
  color: #fff;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  max-width: 400px;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.table-tooltip strong {
  display: block;
  margin-bottom: 4px;
  color: #fff;
  font-size: 0.95rem;
}

.table-tooltip em {
  color: #90caf9;
}

.table-tooltip code {
  display: block;
  margin-top: 6px;
  padding: 8px;
  background-color: #1e1e1e;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.8rem;
  color: #a5d6a7;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Import specific stylesheets */
@import url('/styles/navigation.css');
@import url('/styles/tables.css');
@import url('/styles/modals.css');
@import url('/styles/forms.css');
@import url('/styles/reports.css');
@import url('/styles/graphql-sandbox.css');
/* Performance optimization styles */
@import url('styles/performance-optimizations.css');