/* ── Vibe Builder ── */

#vibe-content.standalone-tab-container {
  height: calc(100vh - 210px);
  overflow: hidden;
}

.vibe-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  height: calc(100vh - 210px);
  overflow: hidden;
}

/* Left Panel */
.vibe-left {
  display: flex;
  flex-direction: column;
  background: var(--secondary-bg, #f8f9fa);
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 16px 0 0 16px;
  overflow: hidden;
}

.vibe-left-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color, #dee2e6);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.vibe-left-header h6 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}
.vibe-add-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}

.vibe-conversation {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vibe-welcome {
  color: #94a3b8;
  font-size: 0.9rem;
  font-style: italic;
  padding: 8px 0;
}

.vibe-msg {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 95%;
}
.vibe-msg-user {
  background: #dbeafe;
  color: #1e3a5f;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}
.vibe-msg-ai {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #dee2e6);
  color: var(--text-primary, #333);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.vibe-chat-input {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color, #dee2e6);
  flex-shrink: 0;
}
.vibe-chat-input textarea {
  resize: none;
  font-size: 0.85rem;
  border-radius: 8px;
}
.vibe-chat-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}

/* Right Panel */
.vibe-right {
  display: flex;
  flex-direction: column;
  background: var(--secondary-bg, #f8f9fa);
  border: 1px solid var(--border-color, #dee2e6);
  border-left: none;
  border-radius: 0 16px 16px 0;
  overflow: hidden;
}

.vibe-right-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color, #dee2e6);
  flex-shrink: 0;
}
.vibe-right-header-left {
  display: flex;
  gap: 6px;
  align-items: center;
}
.vibe-right-header-center {
  display: flex;
  gap: 2px;
}
.vibe-right-header-right {
  display: flex;
  gap: 6px;
  align-items: center;
}

.vibe-device-btn {
  width: 34px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vibe-device-btn.active {
  background: #1565c0 !important;
  color: #fff !important;
  border-color: #1565c0 !important;
}

.vibe-app-name-bar {
  padding: 6px 16px;
  border-bottom: 1px solid var(--border-color, #dee2e6);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.vibe-app-name-bar > #vibe-app-name {
  flex: 1;
  min-width: 0;
}
.vibe-app-name-bar > #vibe-approval-slot {
  margin-left: auto;
  flex-shrink: 0;
}
#vibe-app-name {
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 8px;
  border-radius: 6px;
}
#vibe-app-name:focus {
  border-color: var(--border-color, #dee2e6);
  background: var(--card-bg, #fff);
}

.vibe-display {
  flex: 1;
  overflow: auto;
  background: #fff;
  position: relative;
  display: flex;
  justify-content: center;
}
#vibe-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

/* Device mode sizing */
.vibe-display[data-device="tablet"] #vibe-iframe {
  max-width: 768px;
  border-left: 1px solid var(--border-color, #dee2e6);
  border-right: 1px solid var(--border-color, #dee2e6);
}
.vibe-display[data-device="mobile"] #vibe-iframe {
  max-width: 375px;
  border-left: 1px solid var(--border-color, #dee2e6);
  border-right: 1px solid var(--border-color, #dee2e6);
}

.vibe-footer-right {
  display: flex;
  gap: 6px;
  align-items: center;
}

.vibe-right-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--border-color, #dee2e6);
  flex-shrink: 0;
}

/* Connections modal */
.vibe-conn-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.vibe-conn-modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.vibe-conn-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #e5e7eb;
}
.vibe-conn-modal-header h5 {
  margin: 0;
  font-size: 1rem;
}
.vibe-conn-modal-header h5 i {
  color: #2563eb;
  margin-right: 6px;
}
.vibe-conn-modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #6b7280;
  line-height: 1;
  padding: 0 4px;
}
.vibe-conn-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}
.vibe-conn-loading,
.vibe-conn-empty,
.vibe-conn-error {
  padding: 20px;
  text-align: center;
  color: #6b7280;
  font-size: 0.9rem;
}
.vibe-conn-error { color: #dc2626; }

.vibe-conn-intro {
  font-size: 0.85rem;
  color: #4b5563;
  margin: 0 0 14px 0;
  line-height: 1.5;
}
.vibe-conn-intro code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 3px;
}

.vibe-conn-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vibe-conn-group-title {
  margin: 14px 0 4px 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 4px;
}
.vibe-conn-group-title:first-child { margin-top: 4px; }
.vibe-conn-cat {
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin: 10px 0 2px 0;
}
.vibe-conn-card-roadmap {
  background: #fafafa;
  opacity: 0.75;
}
.vibe-conn-card-roadmap .vibe-conn-card-title strong {
  color: #4b5563;
  font-weight: 500;
}
.vibe-conn-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}
.vibe-conn-card.disabled {
  background: #f9fafb;
  opacity: 0.85;
}
.vibe-conn-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.vibe-conn-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.vibe-conn-card-title strong {
  font-size: 0.95rem;
  color: #111827;
}
.vibe-conn-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  background: #eef2ff;
  color: #3730a3;
  padding: 2px 6px;
  border-radius: 3px;
}
.vibe-conn-card-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.vibe-conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.vibe-conn-badge-on      { background: #d1fae5; color: #065f46; }
.vibe-conn-badge-off     { background: #fee2e2; color: #991b1b; }
.vibe-conn-badge-key     { background: #dbeafe; color: #1e40af; }
.vibe-conn-badge-neutral { background: #e5e7eb; color: #374151; }
.vibe-conn-badge-warn    { background: #fef3c7; color: #92400e; }

.vibe-conn-card-desc {
  font-size: 0.82rem;
  color: #4b5563;
  line-height: 1.5;
  margin-bottom: 8px;
}
.vibe-conn-snippet {
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  padding: 10px 12px;
  border-radius: 6px;
  margin: 0 0 10px 0;
  overflow-x: auto;
  white-space: pre;
}
.vibe-conn-snippet code {
  color: inherit;
  background: transparent;
  padding: 0;
}
.vibe-conn-card-actions {
  display: flex;
  justify-content: flex-end;
}

/* Responsive */
@media (max-width: 900px) {
  .vibe-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .vibe-left { border-radius: 16px 16px 0 0; }
  .vibe-right { border-left: 1px solid var(--border-color, #dee2e6); border-radius: 0 0 16px 16px; }
}
