/* Design Pane — embedded in tab panel (left chat + right gallery) */

.design-pane-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* Chat section (left) */
.design-chat-section {
  width: 40%;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.design-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

.chat-msg.ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  border-bottom-left-radius: 4px;
  max-width: 90%;
}

.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-bottom-right-radius: 4px;
  max-width: 80%;
}

.chat-msg.streaming-cursor::after {
  content: '|';
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Chat input */
.design-chat-input {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 8px;
}

.design-chat-input input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.design-chat-input input:focus {
  border-color: rgba(99, 102, 241, 0.5);
}

.design-chat-input input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.design-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.design-upload-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.design-chat-input button {
  padding: 8px 14px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.8);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

.design-chat-input button:hover {
  background: rgba(99, 102, 241, 1);
}

.design-chat-input button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Gallery section (right) */
.design-gallery-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Gallery toolbar */
.design-gallery-toolbar {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.design-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.design-tool-btn:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
}

.design-tool-btn:active {
  transform: scale(0.96);
}

.design-tool-btn svg {
  flex-shrink: 0;
}

.design-gallery-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  align-content: start;
}

/* Gallery footer — AI icon + confirm button */
.design-gallery-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.design-confirm-btn {
  flex: 1;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.design-confirm-btn:hover:not(.disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.design-confirm-btn.disabled {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.3);
  box-shadow: none;
  cursor: not-allowed;
}

/* Reference cards (screenshot or proposal) */
.design-ref-card {
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.design-ref-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}

.design-ref-card.selected {
  border-color: #6366f1;
  box-shadow: 0 0 0 1px #6366f1, 0 4px 12px rgba(99, 102, 241, 0.25);
}

.design-ref-card.selected::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #6366f1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
}

.design-ref-card {
  position: relative;
}

.design-ref-card .img-wrapper {
  position: relative;
  overflow: hidden;
  height: 180px;
}

.design-ref-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  transition: transform 0.3s ease;
}

.design-ref-card:hover img {
  transform: scale(1.08);
}

.design-ref-card .img-zoom-hint {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  cursor: zoom-in;
  z-index: 2;
}

.design-ref-card .img-zoom-hint:hover {
  background: rgba(99, 102, 241, 0.8);
}

.design-ref-card:hover .img-zoom-hint {
  opacity: 1;
}

.design-ref-card .select-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 10px;
  background: linear-gradient(transparent, rgba(99, 102, 241, 0.85));
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.design-ref-card:hover .select-hint {
  opacity: 1;
  transform: translateY(0);
}

.design-ref-card.selected .select-hint {
  display: none;
}

.ref-card-url {
  padding: 5px 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.3);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* Proposal-type card header */
.ref-card-proposal-header {
  padding: 14px 14px 10px;
}

.ref-card-proposal-header h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.ref-card-proposal-header p {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Color palette strip below card */
.ref-card-palette {
  display: flex;
  height: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ref-card-swatch {
  flex: 1;
  transition: transform 0.15s;
}

.ref-card-swatch:hover {
  transform: scaleY(1.3);
  z-index: 1;
}

.design-gallery-hint {
  padding: 8px 14px;
  font-size: 12px;
  color: rgba(99, 102, 241, 0.9);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 6px;
  text-align: center;
  margin: 0 12px 10px;
  animation: hint-pulse 2s ease-in-out infinite;
}

.design-gallery-hint.hidden {
  display: none;
}

@keyframes hint-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Loading state */
.design-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

.design-loading .dot-pulse {
  display: inline-flex;
  gap: 4px;
}

.design-loading .dot-pulse span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.6);
  animation: dotPulse 1.4s ease-in-out infinite;
}

.design-loading .dot-pulse span:nth-child(2) { animation-delay: 0.2s; }
.design-loading .dot-pulse span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Screenshot Lightbox */
.screenshot-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  cursor: zoom-out;
  padding: 40px 20px;
}

.screenshot-lightbox.hidden {
  display: none;
}

.screenshot-lightbox img {
  max-width: 90%;
  width: auto;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Color confirmation panel */
.color-confirm-panel {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.color-confirm-panel.hidden {
  display: none;
}

.color-confirm-content {
  background: #1a1a1f;
  border-radius: 16px;
  padding: 32px;
  max-width: 560px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.color-confirm-content h3 {
  margin: 0 0 20px;
  font-size: 18px;
  color: #fff;
  text-align: center;
}

.color-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.color-swatch {
  text-align: center;
}

.color-swatch .swatch-box {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  margin-bottom: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  position: relative;
}

.color-swatch .swatch-box input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.color-swatch .swatch-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
}

.color-swatch .swatch-value {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  font-family: monospace;
}

.color-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.color-confirm-actions button {
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  border: none;
  transition: transform 0.1s;
}

.color-confirm-actions button:hover {
  transform: translateY(-1px);
}

.color-confirm-actions .btn-approve {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}

.color-confirm-actions .btn-adjust {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.color-confirm-actions .btn-restart {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
  .design-pane-layout {
    flex-direction: column;
  }

  .design-chat-section {
    width: 100%;
    min-width: unset;
    height: 50%;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .design-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

/* Button loading spinner */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

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

/* ── Design Log Entries (tool call indicators) ── */

.design-log-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary, #8b8fa3);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  animation: log-fade-in 0.2s ease;
}

.design-log-entry.active {
  border-color: rgba(103, 232, 249, 0.2);
  background: rgba(103, 232, 249, 0.04);
}

.design-log-entry.done {
  opacity: 0.7;
}

.design-log-entry.failed {
  border-color: rgba(248, 113, 113, 0.2);
  background: rgba(248, 113, 113, 0.04);
}

.design-log-icon {
  font-size: 12px;
  flex-shrink: 0;
}

.design-log-label {
  font-weight: 500;
  color: var(--text, #e2e4ed);
  white-space: nowrap;
}

.design-log-detail {
  color: var(--text-secondary, #8b8fa3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.design-log-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(103, 232, 249, 0.3);
  border-top-color: #67e8f9;
  border-radius: 50%;
  animation: design-log-spin 0.8s linear infinite;
  flex-shrink: 0;
  margin-left: auto;
}

.design-log-status {
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
  flex-shrink: 0;
}

.design-log-status.ok {
  color: #34d399;
}

.design-log-status.fail {
  color: #f87171;
}

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

@keyframes log-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── @ Mention Dropdown ── */

.mention-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: #1e1f2e;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 8px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
  margin-bottom: 4px;
  z-index: 100;
}

.mention-dropdown.hidden {
  display: none;
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.mention-item:hover,
.mention-item.active {
  background: rgba(99, 102, 241, 0.15);
}

.mention-thumb {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.mention-label {
  font-size: 12px;
  color: var(--text, #e2e4ed);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Design suggestions (quick action chips) */
.design-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
}

.design-suggestions-hint {
  width: 100%;
  font-size: 13px;
  color: var(--text-muted, #8b8fa3);
  margin-bottom: 4px;
}

.design-suggestion-chip {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--text, #e2e4ed);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.design-suggestion-chip:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.6);
}

/* ── Design Toast Notification ──────────────────────────────── */
.design-toast {
  position: fixed;
  top: 24px;
  right: -380px;
  width: 340px;
  background: rgba(24, 24, 32, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  z-index: 10001;
  transition: right 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.design-toast.show {
  right: 24px;
}

.design-toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.design-toast-body {
  flex: 1;
  min-width: 0;
}

.design-toast-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.design-toast-msg {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
}

.design-toast-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.design-toast-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}

.design-toast-progress {
  position: absolute;
  bottom: 0;
  left: 18px;
  right: 18px;
  height: 2px;
  border-radius: 1px;
  background: rgba(99, 102, 241, 0.2);
  overflow: hidden;
}

.design-toast-progress::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #6366f1, #a78bfa);
  border-radius: 1px;
  animation: toast-countdown 5s linear forwards;
}

@keyframes toast-countdown {
  from { width: 100%; }
  to { width: 0%; }
}
