/* --- 🎨 CSS Variables for Easy Customization --- */
:root {
  --primary-color: #205069;
  --secondary-color: #2CB2D9;
  --accent-yellow: #FBDB2A;
  --accent-red: #B8403F;
  --background-color: #F9FAFA;
  --text-color: #333333;
  --light-text-color: #e0e0e0;
  --border-color: #98B4C0;
  --header-bg: #ffffff;
  --footer-bg: #205069;
  --footer-hyperlink-text-color: #ffffff;
  --footer-highlight-text-color: #2CB2D9;
  --font-body: 'Roboto', sans-serif;
  --font-heading: 'Lato', sans-serif;
}

/* --- Global Styles --- */
html, body {
  padding: 0;
  margin: 0;
  font-family: var(--font-body);
  background-color: var(--background-color);
  color: var(--text-color);
  height: 100%;
}

/* --- Main Layout & Sticky Footer --- */
#ig-viewer {
  position: relative;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

#ig-viewer .ig-view-content {
  flex: 1 0 auto;
}

/* --- Header & Navigation --- */
#ig-viewer .header {
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#ig-viewer .header .navbar {
  background: transparent !important;
  margin-bottom: 0;
  border: none;
}

#ig-viewer .header .navbar a {
  color: var(--primary-color) !important;
  font-family: var(--font-heading) !important;
  font-weight: 700;
  transition: color 0.2s ease-in-out;
}

#ig-viewer .header .navbar a:hover {
  color: var(--secondary-color) !important;
}

#ig-viewer .header .navbar .navbar-header {
  margin-bottom: 0;
}

/* --- Main Content Area --- */
#ig-viewer .content {
  margin-top: 30px;
  padding-bottom: 30px;
  padding-left: 2rem;
  padding-right: 2rem;
}

/* --- Two Column Layout (only when action boxes are present) --- */
body.has-action-boxes .page-wrapper {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  min-height: 60vh;
}

body.has-action-boxes .main-content-column {
  flex: 1;
  min-width: 0; /* Allows flex item to shrink below its content size */
}

body.has-action-boxes .action-sidebar-column {
  flex: 0 0 35%;
  background: rgba(250, 250, 250, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  backdrop-filter: blur(2px);
  max-height: 80vh;
  overflow-y: auto;
  position: sticky;
  top: 2rem;
}

/* Default layout when no action boxes */
body:not(.has-action-boxes) .main-content-column {
  width: 100%;
}

/* --- Action Box Styles (now inside sidebar column) --- */
.action-sidebar-column .action-box {
  border: none !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  margin: 0 0 2rem 0 !important;
  position: static !important;
  width: auto !important;
  max-width: none !important;
  float: none !important;
  border-radius: 0 !important;
}

.action-sidebar-column .action-box:last-child {
  margin-bottom: 0 !important;
}

/* Style for action box content */
.action-sidebar-column .action-box ul {
  list-style-type: none !important;
  padding-left: 0 !important;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.action-sidebar-column .action-box ul ul {
  padding-left: 20px !important;
  list-style-type: disc !important;
  margin-top: 5px;
  font-size: 0.9rem;
}

.action-sidebar-column .action-box li {
  margin-bottom: 10px;
}

.action-sidebar-column .action-box input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.1);
}

/* --- Floating Action Box Styles (for inline use) --- */
.action-box.floating {
  float: right;
  width: 40%;
  max-width: 420px;
  border: 1px solid #ddd;
  padding: 12px;
  background: #fafafa;
  margin: 0 0 1rem 1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  border-radius: 4px;
}

.action-box.floating ul {
  list-style-type: none;
  padding-left: 0;
  margin: 0;
}

.action-box.floating ul ul {
  padding-left: 20px;
  list-style-type: disc;
  margin-top: 5px;
}

.action-box.floating li {
  margin-top: 8px;
}

.action-box.floating input[type="checkbox"] {
  margin-right: 5px;
}

.action-box.floating p {
  margin-bottom: 8px;
  font-weight: 600;
}

.action-box.floating label {
  display: block;
  margin-top: 8px;
}

/* Responsive behavior for floating action boxes */
@media (max-width: 768px) {
  .action-box.floating {
    float: none;
    width: 100%;
    max-width: none;
    margin: 1rem 0;
  }
}

/* Responsive design for smaller screens */
@media (max-width: 1200px) {
  body.has-action-boxes .page-wrapper {
    flex-direction: column;
  }
  
  body.has-action-boxes .action-sidebar-column {
    flex: none;
    order: -1; /* Show action items first on mobile */
    position: relative;
    top: auto;
    max-height: none;
  }
}

#ig-viewer .content h1, #ig-viewer .content h2, #ig-viewer .content h3 {
  font-family: var(--font-heading);
  color: var(--primary-color);
}

/* --- Enhanced Table Styles for FQL Tables --- */
.table.table-bordered.fql-table {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin: 1.5rem 0;
  background: white;
}

.table.table-bordered.fql-table thead {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
}

.table.table-bordered.fql-table thead th {
  border: none;
  padding: 16px 20px;
  font-weight: 600;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
}

.table.table-bordered.fql-table thead th:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background: rgba(255,255,255,0.3);
}

.table.table-bordered.fql-table tbody tr {
  transition: all 0.2s ease;
}

.table.table-bordered.fql-table tbody tr:hover {
  background: #f8f9fa;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.table.table-bordered.fql-table tbody tr:nth-child(even) {
  background: rgba(32,80,105,0.03);
}

.table.table-bordered.fql-table tbody tr:nth-child(even):hover {
  background: #f8f9fa;
}

.table.table-bordered.fql-table tbody td {
  padding: 16px 20px;
  border: 1px solid #e9ecef;
  vertical-align: middle;
  line-height: 1.5;
}

.table.table-bordered.fql-table tbody td:first-child {
  font-weight: 500;
  color: var(--primary-color);
}

.table.table-bordered.fql-table tbody td a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
}

.table.table-bordered.fql-table tbody td a:hover {
  color: #154257;
  border-bottom-color: #154257;
  text-decoration: none;
}

.table.table-bordered.fql-table tbody td p {
  margin: 0;
  color: #555;
  line-height: 1.4;
}

/* Responsive table design */
@media (max-width: 768px) {
  .table.table-bordered.fql-table {
    font-size: 0.9rem;
  }
  
  .table.table-bordered.fql-table thead th,
  .table.table-bordered.fql-table tbody td {
    padding: 12px 16px;
  }
  
  .table.table-bordered.fql-table thead th {
    font-size: 0.85rem;
  }
}

/* --- Resource Meta Table Styles (lighter styling) --- */
.table.meta-table {
  background: #fafbfc;
  border: 1px solid #e1e5e9;
  border-radius: 6px;
  margin: 1rem 0 2rem 0;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.table.meta-table td {
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid #e9ecef;
  vertical-align: middle;
  font-size: 0.9rem;
  line-height: 1.4;
}

.table.meta-table tr:last-child td {
  border-bottom: none;
}

.table.meta-table td i {
  color: #6c757d;
  font-style: normal;
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-block;
  min-width: 90px;
}

.table.meta-table .copy-text {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  background: #f8f9fa;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #495057;
  border: 1px solid #e9ecef;
  display: inline-block;
  margin-left: 8px;
  position: relative;
}

.table.meta-table .btn-copy {
  background: transparent;
  border: none;
  padding: 2px 6px;
  margin-left: 4px;
  border-radius: 3px;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.2s ease;
  font-size: 0.8rem;
}

.table.meta-table .btn-copy:hover {
  opacity: 1;
  background: #e9ecef;
}

.table.meta-table .btn-copy::before {
  content: "📋";
  font-size: 0.8rem;
}

.table.meta-table span[style*="monospace"] {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
  background: #f8f9fa;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #495057;
  border: 1px solid #e9ecef;
}

/* Subtle hover effect for meta table */
.table.meta-table tr:hover {
  background: #f5f6f7;
}

/* Responsive design for meta table */
@media (max-width: 768px) {
  .table.meta-table {
    font-size: 0.85rem;
  }
  
  .table.meta-table td {
    padding: 10px 12px;
  }
  
  .table.meta-table td i {
    min-width: 70px;
    font-size: 0.8rem;
  }
  
  .table.meta-table .copy-text,
  .table.meta-table span[style*="monospace"] {
    font-size: 0.8rem;
    padding: 3px 6px;
  }
}

/* --- Navigation Button Styles --- */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--border-color);
}

.nav-button {
  display: inline-flex;
  align-items: center;
  padding: 12px 20px;
  background: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-button:hover {
  background: #154257;
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.nav-button:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.nav-button-left::before {
  content: "← ";
  margin-right: 8px;
}

.nav-button-right::after {
  content: " →";
  margin-left: 8px;
}

.nav-button-left {
  margin-right: auto;
}

.nav-button-right {
  margin-left: auto;
}

/* If only one button, center it */
.nav-buttons .nav-button:only-child {
  margin: 0 auto;
}

/* Responsive design for navigation buttons */
@media (max-width: 768px) {
  .nav-buttons {
    flex-direction: column;
    gap: 1rem;
  }
  
  .nav-button {
    width: 100%;
    justify-content: center;
    margin: 0 !important;
  }
}

/* --- Dynamic Banner Styles (from your original file) --- */

#ig-viewer .content .nav-pills > li > a {
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 4px;
}

/* --- Footer --- */
#ig-viewer .ig-view-footer {
  background-color: var(--footer-bg);
  color: var(--light-text-color);
  padding: 40px 0;
  flex-shrink: 0; /* Prevents footer from shrinking */
}

#ig-viewer .ig-view-footer p {
  margin: 0;
  text-align: center;
  font-size: 14px;
}

#ig-viewer .ig-view-footer a {
  color: var(--footer-hyperlink-text-color);
  text-decoration: underline;
  transition: opacity 0.2s ease-in-out;
}

#ig-viewer .ig-view-footer a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* --- Dynamic Banner Styles (from your original file) --- */
.dynamic {
  display: none;
  background-color: transparent;
  color: transparent;
  padding: 5px;
  text-align: center;
  height: 30px;
}

.dynamic.versions-banner.not-latest {
  display: block;
  background-color: #f0ad4e;
  color: #fff;
}

.dynamic.versions-banner.latest {
  display: block;
  background-color: #5cb85c;
  color: #fff;
}