/* ===== Base / Global ===== */
* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f7fb;
  color: #1f2937;
  overflow-x: hidden;
  width: 100%;
}

main {
  max-width: 100%;
  min-width: 0;
}

img,
video {
  max-width: 100%;
  height: auto;
}

.navbar {
/* ===== Shared Layout / Navigation ===== */
  background: #fff;
  border-bottom: 3px solid #0d47a1;
  position: sticky;
  top: 0;
  z-index: 10;
}

.navbar-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  min-width: 0;
}

.orca-logo {
  height: 54px;
}

.nav-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
  flex: 1 1 auto;
}

.nav-btn {
  text-decoration: none;
  color: #0d47a1;
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
}

.nav-btn.active {
  background: #0d47a1;
  color: #fff;
}

.page-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 20px;
  padding: 24px;
  min-width: 0;
}

.left-panel,
.right-panel {
  min-width: 0;
}

.panel-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 18px;
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.panel-header h1 {
  margin: 0;
  font-size: 28px;
}

.step-card {
/* ===== CPIX Packager Page ===== */
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.chip {
  background: #2563eb;
  color: #fff;
  border-radius: 999px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.chip.success {
  background: #16a34a;
}

.chip.error {
  background: #dc2626;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.two-col {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.three-col {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
}

.one-col {
  grid-template-columns: minmax(0, 1fr);
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
}

input {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

input:disabled {
  background: #f3f4f6;
}

textarea {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  resize: vertical;
  min-height: 240px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

textarea:disabled {
  background: #f3f4f6;
}

.form-actions {
  margin-top: 4px;
}

.full-width {
  grid-column: 1 / -1;
}

.btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-small {
  padding: 6px 10px;
  font-size: 12px;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-outline {
  border-color: #9ca3af;
  background: #fff;
  color: #111827;
}

.alert {
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid transparent;
  font-size: 14px;
}

/* Keep feedback/status visually separated from form controls */
#step-1-feedback,
#step-2-feedback,
#step-3-feedback,
#step-4-feedback,
#set-crt-error,
#set-crt-success,
#videojs-status,
#prestoplay-status {
  margin-top: 12px;
}

#step-1-feedback:empty,
#step-2-feedback:empty,
#step-3-feedback:empty,
#step-4-feedback:empty,
#set-crt-error:empty,
#set-crt-success:empty,
#videojs-status:empty,
#prestoplay-status:empty {
  display: none;
}

.alert code {
  display: block;
  margin-top: 8px;
  background: rgba(17, 24, 39, 0.08);
  padding: 8px;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.alert-info {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.alert-success {
  background: #ecfdf5;
  border-color: #86efac;
}

.alert-error {
  background: #fef2f2;
  border-color: #fecaca;
}

.hidden {
  display: none;
}

.video-source-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

.video-source-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.sticky {
  position: sticky;
  top: 92px;
}

.history-item {
  border-left: 3px solid #94a3b8;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 0 8px 8px 0;
  margin-bottom: 10px;
}

.history-item.success {
  border-left-color: #16a34a;
}

.history-item.error {
  border-left-color: #dc2626;
}

.history-item.info {
  border-left-color: #2563eb;
}

.history-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  flex-wrap: wrap;
  min-width: 0;
}

.history-message {
  margin: 0;
  font-size: 14px;
}

.history-data {
  margin-top: 8px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.empty-state {
  color: #6b7280;
  font-size: 14px;
}

.single-page-container {
/* ===== Single-page Views (Docs / Set CRT / Demos) ===== */
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
  min-width: 0;
}

.single-page-section {
  width: 100%;
}

.panel-header.centered {
  justify-content: center;
}

.action-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.json-textarea {
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.4;
}

select {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.mt-16 {
  margin-top: 16px;
}

.video-stage {
/* ===== VideoJS / PRESTOplay Demo Pages ===== */
  width: 100%;
  max-width: 100%;
  min-height: 280px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  padding: 12px;
  min-width: 0;
  overflow: hidden;
}

.video-stage video {
  max-width: 100%;
}

.collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.json-preview {
  margin: 0;
  max-height: 500px;
  overflow: auto;
  background: #f5f5f5;
  border-radius: 6px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.checkbox-label input {
  width: auto;
}

.drm-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
}

.drm-box h3 {
  margin-top: 2px;
  margin-bottom: 10px;
}

.demo-grid {
/* ===== Player Demos Index ===== */
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.demo-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.2s ease-in-out;
}

.demo-card:hover {
  transform: translateY(-8px);
}

.demo-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.demo-card-image {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #e5e7eb;
}

.demo-card-body {
  padding: 14px;
}

.demo-card-body h3 {
  margin: 0 0 8px;
}

.demo-card-body p {
  margin: 0 0 10px;
  color: #4b5563;
}

.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-chip {
  background: #2563eb;
  color: #fff;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.demo-card-actions {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
}

.demo-card-actions .btn {
  text-align: center;
  text-decoration: none;
}

.doc-page {
/* ===== Documentation Pages ===== */
  max-width: 900px;
  margin: 0 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.doc-page h1,
.doc-page h2,
.doc-page h3,
.doc-page h4 {
  color: #007acc;
  margin-top: 1.2em;
}

.doc-page h2 {
  border-bottom: 2px solid #eee;
  padding-bottom: 4px;
}

.doc-page pre,
.doc-page code {
  background: #f4f4f4;
  border-radius: 4px;
}

.doc-page pre {
  padding: 12px;
  overflow-x: auto;
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.doc-page code {
  padding: 2px 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.doc-page table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.doc-page th,
.doc-page td {
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.auth-image img {
  max-width: 100%;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 0;
}

.loading-wrap.hidden {
  display: none;
}

.loader {
  width: 28px;
  height: 28px;
  border: 3px solid #bfdbfe;
  border-top-color: #2563eb;
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  .page-container {
    grid-template-columns: 1fr;
  }

  .sticky {
    position: static;
  }

  .three-col,
  .two-col {
    grid-template-columns: 1fr;
  }

  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .demo-grid {
    grid-template-columns: 1fr;
  }

  .single-page-container {
    padding: 16px;
  }
}
