/* =========================
   Phone Simulator
   ========================= */

.simulator-container {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
  height: calc(100vh - 180px);
  min-height: 500px;
}

.simulator-info {
  grid-column: 1 / -1;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.info-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface-50);
  border-radius: var(--r-full);
  border: 1px solid var(--border-200);
  font-size: 13px;
}

.info-badge .badge-icon {
  width: 16px;
  height: 16px;
  color: var(--brand-600);
}

.info-badge .badge-text {
  color: var(--text-700);
}

.info-badge strong {
  color: var(--text-900);
}

/* =========================
   Chat Area
   ========================= */
.simulator-chat {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  font-size: 14px;
  line-height: 1.5;
}

.message.user {
  align-self: flex-end;
  background: #035696;
  color: white;
  border-bottom-right-radius: var(--r-sm);
}

.message.assistant {
  align-self: flex-start;
  background: var(--surface-100);
  color: var(--text-900);
  border-bottom-left-radius: var(--r-sm);
}

.message.system {
  align-self: center;
  background: var(--surface-50);
  color: var(--text-600);
  font-size: 13px;
  text-align: center;
  border: 1px dashed var(--border-300);
}

.message.error {
  align-self: flex-start;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.typing-indicator .message-content {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-indicator .dot {
  width: 8px;
  height: 8px;
  background: var(--text-400);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.chat-input-area {
  padding: 16px;
  border-top: 1px solid var(--border-200);
  background: var(--surface-50);
}

.chat-input-area form {
  display: flex;
  gap: 12px;
}

.chat-input-area input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-300);
  border-radius: var(--r-lg);
  background: var(--surface);
  font-size: 14px;
  color: var(--text-900);
}

.chat-input-area input:focus {
  outline: none;
  border-color: #024a84;
  box-shadow: 0 0 0 3px rgba(2, 74, 132, 0.2);
}

.chat-input-area input:disabled {
  background: var(--surface-100);
  cursor: not-allowed;
}

/* =========================
   Sidebar
   ========================= */
.simulator-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-section {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-200);
  padding: 16px;
}

.sidebar-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-600);
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-200);
}

/* Sample Prompts */
.sample-prompts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sample-prompt {
  padding: 10px 12px;
  background: var(--surface-50);
  border: 1px solid var(--border-200);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-700);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sample-prompt:hover {
  background: #e6f2fa;
  border-color: #035696;
  color: #023d72;
}

.sample-prompt.test-scenario {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
  font-weight: 600;
}

.sample-prompt.test-scenario:hover {
  background: #fde68a;
  border-color: #d97706;
}

/* Tool Calls */
.tool-calls {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-calls .empty-state {
  color: var(--text-500);
  font-size: 13px;
  text-align: center;
  padding: 16px;
}

.tool-call {
  padding: 10px;
  background: var(--surface-50);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-200);
  font-size: 12px;
}

.tool-call-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.tool-name {
  font-weight: 600;
  color: var(--text-900);
  font-family: monospace;
}

.tool-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-full);
}

.tool-status.success {
  background: #d1fae5;
  color: #065f46;
}

.tool-status.error {
  background: #fee2e2;
  color: #991b1b;
}

.tool-call-args,
.tool-call-result {
  padding: 8px;
  background: var(--surface);
  border-radius: var(--r-sm);
  font-family: monospace;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 100px;
  overflow-y: auto;
  color: var(--text-700);
  margin-top: 6px;
}

.tool-call-args {
  color: #035696;
}

/* Session Info */
.session-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-100);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-size: 13px;
  color: var(--text-600);
}

.info-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-900);
  font-family: monospace;
}

/* =========================
   Mobile
   ========================= */
@media (max-width: 900px) {
  .simulator-container {
    grid-template-columns: 1fr;
    height: auto;
  }

  .simulator-sidebar {
    order: -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .sidebar-section:first-child {
    grid-column: 1 / -1;
  }

  .chat-messages {
    min-height: 300px;
    max-height: 400px;
  }
}

@media (max-width: 600px) {
  .simulator-sidebar {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 95%;
  }

  .chat-input-area form {
    flex-direction: column;
  }

  .chat-input-area .btn {
    width: 100%;
    justify-content: center;
  }
}
