/* Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  background: #f7f1ed;
  color: #1f2d3d;
}

/* Header */
.header {
  background-image: url("../images/header_bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #2c5282;
  padding: 40px 0;
  color: white;
  position: relative;
}

.header-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  padding-left: 60px;
  padding-right: 60px;
}

.header h1 {
  font-size: 56px;
  font-weight: 400;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
  margin-left: 0;
}

.header p {
  font-size: 17px;
  opacity: 0.95;
  line-height: 1.5;
  margin-left: 0;
}

.header-right {
  position: absolute;
  top: 0;
  right: 0;
  text-align: right;
  z-index: 10;
}

.env {
  font-size: 11px;
  margin-bottom: 10px;
  text-align: right;
}

.logo-circle {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  padding: 10px;
  margin-left: auto;
  position: relative;
  z-index: 20;
}

.logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: invert(1);
}

/* Page Layout */
.page {
  padding: 40px 0 60px;
}

.page-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 15px;
}

/* Top Actions */
.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 25px;
}

.browse-btn {
  background: white;
  border: 1px solid #cbd5e0;
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 400;
}

.browse-btn:hover {
  background: #f7fafc;
}

.right-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.back-link {
  color: #3a5dbf;
  font-size: 14px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.back-icon {
  width: 16px;
  height: 16px;
}

.edit-btn {
  padding: 9px 20px;
  border: 1px solid #4c6ef5;
  background: white;
  color: #4c6ef5;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 400;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 20px;
}

.breadcrumb a {
  color: #3a5dbf;
  text-decoration: none;
}

.breadcrumb span {
  margin: 0 6px;
}

/* Cards */
.card {
  background: white;
  border-radius: 4px;
  padding: 30px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

.card h2 {
  font-size: 18px;
  font-weight: 400;
  margin-bottom: 24px;
  color: #2d3748;
}

/* Details Grid */
.details-grid {
  display: flex;
  flex-wrap: wrap;
  background: #e8f4f0;
  padding: 24px 24px 0 24px;
  border-radius: 4px;
}

.details-grid .field {
  width: var(--col-width, 20%);
  margin-right: var(--col-margin, 5%);
  margin-bottom: 25px;
}

.field label {
  font-size: 11px;
  color: #718096;
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
  text-transform: capitalize;
}

.value {
  font-size: 14px;
  font-weight: 600;
  color: #2d3748;
  word-wrap: break-word;
  line-height: 1.4;
}

.link {
  font-size: 14px;
  color: #214AE4;
  text-decoration: none;
  word-wrap: break-word;
}

.link:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .details-grid {
    flex-direction: column;
    padding: 4%;
  }

  .details-grid .field {
    width: 100% !important;
  }

  /* Emulate Angular nth-child pushing STD_PROGRAM and CERTIFICATION_NUMBER down */
  .details-grid .field:nth-child(4) {
    order: 7;
  }

  .details-grid .field:nth-child(8) {
    order: 8;
  }
}

/* Facility */
.facility-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.facility-links {
  display: flex;
  align-items: center;
}

.facility-links a {
  font-size: 13px;
  color: #214AE4;
  text-decoration: none;
  margin-right: 25px;
  display: flex;
  align-items: center;
}

.facility-links a:last-child {
  margin-right: 0;
}

.facility-links a:hover {
  text-decoration: underline;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

thead {
  background-color: #f8f9fa;
  border-bottom: 2px solid #e1e4e8;
}

thead th {
  font-size: 14px;
  font-weight: bold;
  text-align: left;
  padding: 12px 15px;
  color: #374151;
}

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

tbody td {
  font-size: 14px;
  padding: 14px 15px;
  border-bottom: 1px solid #eef0f3;
  vertical-align: top;
  word-break: break-word;
}

/* Specific Column Styles */
.footnote-column {
  background-color: rgba(229, 213, 199, 0.20) !important;
  text-align: center;
}

.footnote-column-header {
  text-align: center;
}

/* Footer Note */
.footer-note {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.6;
}

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  margin-bottom: 24px;
}

.card-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: #1f2d3d;
  margin: 0 0 4px 0;
}

.card-header .subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

.card-header .header-right-slot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 150px;
}

.card-header .header-logo {
  max-height: 80px;
  width: auto;
  object-fit: contain;
}

.card-header .value {
  font-size: 16px;
  font-weight: 500;
  color: #1f2d3d;
  text-align: right;
}

.card h3 {
  font-size: 18px;
  font-weight: 400;
  margin-bottom: 24px;
  color: #2d3748;
}

.cus-logo {
  max-height: 40px;
  width: auto;
  object-fit: contain;
}

/* Product Header */
.product-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  border: 2px solid #d32f2f;
  border-radius: 4px;
  padding: 20px 30px;
  margin-bottom: 24px;
}

.product-header-left h2 {
  font-size: 20px;
  font-weight: 600;
  color: #1f2d3d;
  margin-bottom: 4px;
}

.product-header-left p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

.product-header-right img {
  height: 60px;
  width: auto;
  object-fit: contain;
}

/* Responsive Visibility */
@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }

  .header {
    background-image: none;
  }

  .header-right {
    top: 5px;
    right: 15px;
  }

  .header-right img {
    max-height: 50px;
    width: auto;
  }

  .details-grid {
    grid-template-columns: 1fr !important;
  }

  .header-container {
    padding-left: 15px;
    padding-right: 15px;
  }

  .header h1 {
    font-size: 32px;
    padding-right: 55px;
    /* Prevent overlap with right logo */
  }

  .header p {
    font-size: 15px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-header .header-right-slot {
    margin-top: 15px;
    justify-content: flex-start;
  }

  .product-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
  }

  .product-header-right {
    margin-top: 15px;
  }
}

@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
}

/* Footnotes */
.footnote-row {
  background-color: #f7f1ed;
}

.footnote-content {
  padding: 12px 20px;
  font-size: 14px;
  color: #333;
  line-height: 1.5;
  border-bottom: 1px solid #eef0f3;
  word-break: break-word;
  /* Ensure words break if too long */
}

.footnote-content pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-all;
  /* Aggressive break to prevent any layout collapse */
  font-family: inherit;
  font-size: 14px;
  margin: 0;
}

.footnote-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #2D74DA;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  text-decoration: underline;
  padding: 8px 12px;
  transition: all 0.2s;
  border-radius: 2px;
}

.footnote-toggle.expanded {
  background-color: #8E8E8E;
  color: white !important;
  text-decoration: underline;
}

.footnote-toggle img {
  width: 10px;
  height: 10px;
  transition: transform 0.2s;
}

.footnote-toggle.expanded img {
  transform: rotate(180deg);
  filter: brightness(0) invert(1);
}

.footnote-sec {
  padding: 15px;
  background: #fdfdfd;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  margin-top: 10px;
}

.footnote-sec pre {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 13px;
}

/* Share Modal Popup */
.share-container {
  position: relative;
  display: inline-block;
}

.share-popup {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 319px;
  background: #FFFFFF;
  border: 1px solid #E5D5C7;
  border-radius: 5px 0px 5px 5px;
  padding: 16px 25px;
  box-shadow: -10px 10px 15px rgba(0, 0, 0, 0.16);
  z-index: 1000;
  margin-top: 5px;
}

.share-popup label {
  color: #14244E;
  font-size: 14px;
  font-weight: 700;
  display: block;
  margin-bottom: 8px;
  text-align: center;
}

.share-input-row {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.share-url-box {
  flex-grow: 1;
  border: 1px solid #E5D5C7;
  border-radius: 4px;
  padding: 0 9px;
  height: 30px;
  display: flex;
  align-items: center;
  background: white;
  min-width: 0;
  /* Important for flex child overflow */
}

.share-url-text {
  font-size: 10px;
  color: #14244E;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 28px;
  width: 100%;
  display: block;
}

.share-copy-btn {
  width: 30px;
  height: 30px;
  background-color: #214AE4;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.share-copy-btn img {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
  /* Ensure icon is white */
}

.share-divider-row {
  display: flex;
  align-items: center;
  margin: 10px 15px 16px;
}

.share-divider-line {
  flex-grow: 1;
  height: 1px;
  background-color: #9f9f9f;
}

.share-divider-text {
  margin: 0 15px;
  color: #14244E;
  font-size: 14px;
}

.share-actions-row {
  display: flex;
  justify-content: center;
}

.share-action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
}

.share-action-item img {
  width: 32px;
  height: 25px;
  margin-bottom: 5px;
}

.share-action-item span {
  color: #214AE4;
  font-size: 10px;
}

/* Share Link Active State (when popup is open) */
.share-link-active {
  /* Optional: style the link/button when popup is open 
       UI project has styling: 
       background: #FFFFFF; border: 1px solid #E5D5C7; 
       border-bottom: 0px; z-index: 1001; 
       We might simulate this if we wrap the link in a container 
    */
}

@media screen and (max-width: 768px) {
  .share-popup {
    width: 280px;
  }
}

/* Popup Window */
.kendo-window {
  width: 1100px;
  height: 600px;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: 1px solid #ccc;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  display: none;
  flex-direction: column;
  border-radius: 4px;
}

.window-header {
  background-color: #2c6090;
  padding: 6px 10px;
  border-bottom: 2px solid #1e4d74;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  font-size: 13px;
  color: #ffffff;
  user-select: none;
  cursor: default;
}

.window-controls {
  display: flex;
  align-items: center;
  gap: 2px;
}

.win-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 18px;
  font-size: 12px;
  line-height: 18px;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 2px;
  transition: background 0.15s;
  flex-shrink: 0;
  text-align: center;
  vertical-align: middle;
  overflow: hidden;
}

.win-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.win-btn.close-btn:hover {
  background: #c0392b;
  border-color: #c0392b;
}

.window-content {
  flex-grow: 1;
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.window-content iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Legacy .close-btn standalone (kept for any other usage) */
.close-btn:not(.win-btn) {
  cursor: pointer;
  font-size: 24px;
  line-height: 24px;
  color: #666;
}

.close-btn:not(.win-btn):hover {
  color: #000;
}

.grid-atag {
  color: #2D74DA;
  cursor: pointer;
  text-decoration: underline;
}

@media screen and (max-width: 1200px) {
  .kendo-window {
    width: 96%;
    height: 70%;
  }
}

@media screen and (max-width: 768px) {
  .kendo-window {
    width: 98%;
    height: 80%;
  }
}