/* Dashboard styles — updated to prevent ellipsis/truncation, enable dynamic column sizing,
   keep responsive behavior, and make iframe containers flexible. */

:root {
  color-scheme: light;
}

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background-color: #f8f9fb;
  min-height: 100vh;
}

/* Keep navbar above content */
header.navbar {
  z-index: 1040;
}

/* Sidebar */
.sidebar {
  min-height: 100vh;
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.05);
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  font-weight: 500;
  color: #495057;
  border-radius: 0.75rem;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

/* icon wrapper stays as visual */
.sidebar .nav-link .icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.75rem;
  background: rgba(13, 110, 253, 0.12);
  color: #0d6efd;
  font-size: 1.1rem;
}

/* main content container — prevent accidental X overflow hiding */
.main-content {
  background-color: transparent;
  overflow-x: hidden;
  max-width: 100%;
}

/* Hero & headings */
.page-heading {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.overview-hero {
  border-radius: 1.5rem;
  background: linear-gradient(135deg, rgba(13, 110, 253, 0.1), rgba(13, 202, 240, 0.12));
  box-shadow: 0 1.5rem 3.5rem -2rem rgba(13, 71, 161, 0.55);
}

.overview-hero h1 {
  font-weight: 600;
}

/* Forecast shell (iframe container) */
.forecast-shell {
  max-width: 1320px;
  margin: 0 auto;
}

/* Allow the frame wrapper to horizontally scroll when needed; don't hide overflow vertically */
.forecast-frame-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 1rem;
  background: #ffffff;
  position: relative;
}

/* Iframe itself:
   - width 100% (fill wrapper)
   - min-width 0 to prevent flex items from forcing overflow
   - default height is a safe fallback; adjusted at runtime by JS
*/
.forecast-frame {
  width: 100%;
  display: block;
  border: 0;
  min-width: 0;
  height: 640px; /* safe fallback; JS will adjust for same-origin frames */
  transition: height 0.3s ease;
  background-color: #ffffff;
}

/* Table-like overview / forecast table (index.html) */
.forecast-table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border-radius: 1rem;
  box-shadow: 0 1rem 3rem -1rem rgba(15, 23, 42, 0.3);
  background: white;
}

/* Use automatic table layout so columns size to content; allow wrapping */
.forecast-table {
  width: 100%;
  table-layout: auto; /* dynamic column widths */
  border-collapse: collapse;
  margin: 0;
  background: #ffffff;
  border-radius: 1rem;
}

.forecast-table th,
.forecast-table td {
  padding: 1rem 1.25rem;
  vertical-align: middle;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  white-space: normal;        /* allow wrapping */
  word-break: break-word;     /* break long words/URLs */
}

/* Final row: remove bottom border */
.forecast-table tr:last-child td {
  border-bottom: none;
}

/* Info wrappers used in the index overview */
.forecast-info-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.forecast-info-icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: rgba(13, 110, 253, 0.12);
  color: #0d6efd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.forecast-info-content {
  min-width: 0;
}

.forecast-info-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: clip; /* ensure full words available, do not ellipsize */
}

.forecast-info-description {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.4;
}

/* Forecast-card appearance retained for pages that still use the card wrapper */
.forecast-card .card {
  border: 0;
  border-radius: 1.25rem;
  box-shadow: 0 2rem 4rem -2rem rgba(15, 23, 42, 0.45);
  overflow: visible;
  background-color: transparent;
}

.forecast-card .card-header {
  background: linear-gradient(135deg, rgba(13, 110, 253, 0.12), rgba(13, 202, 240, 0.22));
  border-bottom: 0;
  padding: 1.5rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.forecast-card .card-body {
  padding: 1.75rem;
  background-color: #ffffff;
  border-radius: 0 0 1.25rem 1.25rem;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
  .forecast-shell {
    max-width: 100%;
  }
}

@media (max-width: 767.98px) {
  .sidebar {
    min-height: auto;
    box-shadow: none;
  }

  .overview-hero {
    border-radius: 1rem;
    padding: 1.5rem !important;
  }

  .forecast-info-wrapper {
    gap: 0.75rem;
  }

  .forecast-info-icon {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
  }

  .forecast-table th,
  .forecast-table td {
    padding: 0.75rem 1rem;
  }

  .forecast-card .card-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.25rem;
  }

  .forecast-card .card-body {
    padding: 1.25rem;
  }

  /* allow iframe to be taller on mobile; JS may override if possible */
  .forecast-frame {
    height: auto;
    min-width: 0;
  }
}
