/* ==========================================================================
   VIEW 1: PATCH MATRIX & COMPOSER (v5.6.0)
   Scoped to Composer runway, turn tabs, buffer card, and preview deck.
   ========================================================================== */

.tabs-runway-deck {
  display: flex;
  align-items: flex-end;
  background: #0e0e0e;
  padding: 6px 8px 0 8px;
  border-bottom: none;
  gap: 6px;
}

.tabs-runway {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  margin-bottom: 0;
}
.tabs-runway::-webkit-scrollbar { display: none; }

.matrix-turns-deck {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 6px 0;
}

.turn-tab, .matrix-turn-card, .matrix-turn-pill {
  position: relative;
  flex: 0 0 135px;
  height: 36px;
  background: #121212;
  border: 1px solid #1c1c1c;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  outline: none;
  color: var(--text-main, #f5f5f5);
  box-shadow: none;
  transition: all 0.12s ease;
  user-select: none;
}

.turn-tab:hover, .matrix-turn-card:hover, .matrix-turn-pill:hover {
  background: #0f0f10;
  border-color: #242426;
}

.turn-tab.active, .matrix-turn-card.active, .matrix-turn-pill.active {
  background: #121212 !important;
  border-color: #2a2a2a !important;
  border-bottom: none !important;
  z-index: 2;
}

@keyframes tabEntrance {
  from { opacity: 0; transform: scaleX(0.7); }
  to   { opacity: 1; transform: scaleX(1); }
}

@keyframes chromeSpecular {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.turn-tab.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.35) 20%,
    rgba(255, 255, 255, 0.95) 50%,
    rgba(255, 255, 255, 0.35) 80%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: tabEntrance 0.2s linear, chromeSpecular 5s linear infinite;
}

.turn-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tab-main {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  min-width: 0;
}

.tab-label, .turn-card-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.turn-tab.active .tab-label, .matrix-turn-card.active .turn-card-title {
  color: #ffffff;
  font-weight: 600;
}

.tab-status-pip {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--status-blue-text, #e5e5e5);
  flex-shrink: 0;
}

.tab-cluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tab-counter, .turn-card-count {
  pointer-events: none;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim, #525252);
  line-height: 1;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

.tab-counter.has-staged {
  color: var(--status-green-text, #34d399);
}

.turn-card-desc {
  font-size: 10px;
  color: var(--text-muted, #888888);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.turn-card-footer {
  font-family: var(--font-mono, monospace);
  font-size: 9px;
  color: var(--text-dim, #666666);
  margin-top: 2px;
}

.tab-close, .btn-turn-delete {
  opacity: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-pixel, var(--font-mono), monospace);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  padding: 0;
  transition: all 0.1s ease;
}

.turn-tab:hover .tab-close,
.turn-tab:hover .btn-turn-delete,
.turn-tab.active .tab-close,
.turn-tab.active .btn-turn-delete {
  opacity: 0.7;
}

.tab-close:hover, .btn-turn-delete:hover {
  opacity: 1 !important;
  background: transparent !important;
  color: #ffffff !important;
  transform: scale(1.2);
}

.runway-actions-cluster {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 5px;
  padding-right: 2px;
  flex-shrink: 0;
}

.runway-nav-btn, .btn-new-turn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--text-dim, #666666);
  cursor: pointer;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: color 0.12s ease, transform 0.12s ease;
  user-select: none;
}

.runway-nav-btn:hover, .btn-new-turn:hover {
  background: transparent !important;
  color: #ffffff !important;
  transform: scale(1.1);
}

.runway-nav-btn.btn-add-icon {
  color: var(--text-muted);
}

.btn-turn-inspect {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
.btn-turn-inspect:hover {
  color: var(--text-main);
  background: #1c1c1c;
}

.ingestion-buffer-card {
  flex: 1;
  min-height: 0;
  background: #121212;
  border: 2px solid #151515;
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.ingestion-buffer-inner {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.ingestion-buffer-card.is-streaming {
  border-color: #383838 !important;
}

.buffer-orb-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(8, 8, 8, 0.90);
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(18, 18, 18, 0.4) 0%, rgba(6, 6, 6, 0.96) 100%);
  background-size: 4px 4px, 100% 100%;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  z-index: 25;
  pointer-events: all;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
  contain: paint;
}

.buffer-orb-overlay.is-active {
  opacity: 1;
  transform: scale(1);
}

.buffer-orb-canvas {
  width: 180px;
  height: 180px;
}

.buffer-orb-status {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(
    90deg,
    #525252 0%,
    #a1a1aa 25%,
    #ffffff 50%,
    #a1a1aa 75%,
    #525252 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  animation: textShimmer 1.8s linear infinite;
}

@keyframes textShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.preflight-skeleton-card {
  background: #0e0e0e;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: diffDeckShimmer 1.4s ease-in-out infinite;
}

.preflight-skeleton-line {
  height: 11px;
  background: #141414;
  border-radius: 3px;
}

.buffer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ingestion-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.ingestion-find-strip, .ingestion-quick-actions, .ingestion-action-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ingestion-textarea {
  flex: 1;
  min-height: 220px;
  background: #0e0e0e;
  border: 2px solid #151515;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  resize: none;
  outline: none;
}

.detected-file-card {
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease !important;
}

.detected-file-card:hover {
  background: #161616 !important;
  border-color: #2a2a2a !important;
}

.detected-trimmed-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  overflow: hidden;
}

.detected-trimmed-text {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--status-yellow-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ingestion-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.ingestion-footer-bar .btn-sm {
  height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
}

.preflight-deck-viewport {
  flex: 1;
  min-height: 0;
  background: #0e0e0e;
  border: 2px solid #151515;
  border-radius: 15px;
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rubik-canvas-el {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.rubik-telemetry-hud {
  position: absolute;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid #222222;
  border-radius: 18px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
  z-index: 10;
}

.rubik-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  animation: rubikDotPulse 1.4s ease-in-out infinite;
}

@keyframes rubikDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

.rubik-status-label {
  font-family: var(--font-mono, monospace);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e5e5e5;
}