/*
 * Jeen AI Assistant – Task Pane Styles
 * Design tokens matched to product frontend.
 */

@import url("https://fonts.googleapis.com/css2?family=Urbanist:wght@400;500;600;700&display=swap");

/* ── Reset ─────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  font-family: "Urbanist", "Noto Sans Hebrew", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #030712;
  background: #ffffff;
}

/* ── Sideload notice ───────────────────────────────────────────────── */

.sideload-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  text-align: center;
}

.sideload-notice h2 {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
}

.sideload-notice a {
  color: #7a7afe;
}

/* ── Chat container (full-height flex column) ──────────────────────── */

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Header ────────────────────────────────────────────────────────── */

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: contain;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
  color: #030712;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Connection status */

.connection-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #6b7280;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.connected {
  background: #10b981;
}

.status-dot.connecting {
  background: #f59e0b;
  animation: pulse 1s infinite;
}

.status-dot.disconnected {
  background: #9ca3af;
}

.status-dot.error {
  background: #ef4444;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.icon-btn {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.icon-btn:hover {
  background: #f3f4f6;
  color: #030712;
  border-color: #d1d5db;
}

/* ── Model selector ────────────────────────────────────────────────── */

.model-select {
  font-family: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  background: #f9fafb;
  color: #374151;
  outline: none;
  cursor: pointer;
  max-width: 160px;
}

.model-select:focus {
  border-color: #7a7afe;
}

/* ── Messages area ─────────────────────────────────────────────────── */

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

/* Message bubble */

.message {
  max-width: 90%;
  padding: 12px 16px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  align-self: flex-end;
  background: rgba(122, 122, 254, 0.1);
  color: #030712;
  border-radius: 16px 0 16px 16px;
}

.message.agent {
  align-self: flex-start;
  background: transparent;
  color: #030712;
  border-radius: 4px 12px 12px 12px;
}

/* Content inside agent bubbles */

.message-content {
  white-space: pre-wrap;
}

.message-content code {
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13px;
}

.message-content pre {
  background: #f3f4f6;
  padding: 10px 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid #e5e7eb;
}

.message-content pre code {
  background: none;
  padding: 0;
}

.message-content strong {
  font-weight: 600;
}

/* Typing dots animation */

.typing-dots {
  display: inline-flex;
  gap: 2px;
  margin-left: 4px;
  vertical-align: middle;
}

.typing-dots span {
  animation: blink 1.4s infinite both;
  font-weight: bold;
  font-size: 16px;
  line-height: 1;
  color: #7a7afe;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* ── Tool card (matches product ToolCard component) ───────────────── */

.tool-card {
  align-self: stretch;
  margin: 8px 0;
  animation: fadeIn 0.15s ease-out;
}

.tool-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
  overflow: hidden;
}

.tool-card-header:hover {
  background: #f9fafb;
}

.tool-card-header .tool-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #7a7afe;
}

.tool-card-header .tool-name {
  font-size: 14px;
  font-weight: 500;
  color: #030712;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-card-header .tool-expand {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #9ca3af;
  transition: transform 0.3s ease;
}

.tool-card-header .tool-expand.expanded {
  transform: rotate(180deg);
}

.tool-card-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: #f3f4f6;
  overflow: hidden;
}

.tool-card-progress::after {
  content: "";
  position: absolute;
  top: 0;
  left: -40%;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #7a7afe, #a78bfa, #7a7afe);
  animation: tool-progress 1.5s ease-in-out infinite;
}

@keyframes tool-progress {
  0% { left: -40%; }
  100% { left: 100%; }
}

.tool-card-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease-in-out, opacity 0.2s ease-in-out;
}

.tool-card-content.expanded {
  max-height: 400px;
  opacity: 1;
  overflow-y: auto;
}

.tool-card-body {
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 8px 8px;
  font-size: 12px;
  line-height: 1.5;
  color: #374151;
  font-family: "Consolas", "Menlo", monospace;
  white-space: pre-wrap;
  word-break: break-all;
  background: #f9fafb;
}

/* ── Action notifications (success/error pills) ──────────────────── */

.action-notification {
  align-self: center;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  animation: fadeIn 0.15s ease-out;
}

.action-notification.success {
  background: #ecfdf5;
  color: #059669;
}

.action-notification.error {
  background: #fef2f2;
  color: #dc2626;
}

/* ── Input section (matches product InputContainer + InputBox) ──── */

.chat-input-section {
  flex-shrink: 0;
  padding: 0 16px;
  background: #ffffff;
}

.input-box {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 8px 16px 0 rgba(209, 213, 219, 0.18);
  padding: 8px 8px 12px 8px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.input-box:focus-within {
  border-color: #7a7afe;
  box-shadow: 0 8px 16px 0 rgba(122, 122, 254, 0.12);
}

.chat-input {
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  line-height: normal;
  padding: 8px;
  width: 100%;
  background: transparent;
  resize: none;
  min-height: 40px;
  max-height: 160px;
  color: #030712;
}

.chat-input::placeholder {
  color: #9ca3af;
}

.chat-input:disabled {
  color: #9ca3af;
}

.input-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding: 0 4px;
}

.input-left-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 1;
  min-width: 0;
}

.input-right-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.send-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #7a7afe;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
  background: #6366f1;
}

.send-btn:disabled {
  background: #d1d5db;
  cursor: default;
}

.send-btn.stop-mode {
  background: #ef4444;
}

.send-btn.stop-mode:hover {
  background: #dc2626;
}

/* ── Footer note ──────────────────────────────────────────────────── */

.footer-note {
  text-align: center;
  padding: 8px 16px;
  font-size: 12px;
  color: #9ca3af;
  flex-shrink: 0;
}

/* ── Welcome / empty state ────────────────────────────────────────── */

.welcome-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 32px 24px;
  text-align: center;
  gap: 12px;
}

.welcome-logo {
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  border-radius: 10px;
  object-fit: contain;
}

.welcome-greeting {
  font-size: 20px;
  font-weight: 500;
  color: #030712;
  line-height: 1.3;
}

/* ── Login section ─────────────────────────────────────────────────── */

.login-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 32px 24px;
  gap: 24px;
}

.login-logo {
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  border-radius: 12px;
  object-fit: contain;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: #030712;
  text-align: center;
}

.login-subtitle {
  font-size: 14px;
  color: #6b7280;
  text-align: center;
  margin-top: -12px;
}

.login-form {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-input:focus {
  border-color: #7a7afe;
  box-shadow: 0 0 0 3px rgba(122, 122, 254, 0.12);
}

.login-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.login-btn.primary {
  background: #7a7afe;
  color: #fff;
}

.login-btn.primary:hover {
  background: #6366f1;
}

.login-btn.secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.login-btn.secondary:hover {
  background: #e5e7eb;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #9ca3af;
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.login-error {
  background: #fef2f2;
  color: #dc2626;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
  display: none;
}

.login-error.visible {
  display: block;
}

/* ── Logout button ─────────────────────────────────────────────────── */

.logout-btn {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.logout-btn:hover {
  background: #fef2f2;
  color: #dc2626;
}

/* ── Scrollbar styling ─────────────────────────────────────────────── */

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* ── Conversation title ────────────────────────────────────────────── */

.conversation-title {
  font-size: 13px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

/* ── Suggestion bubbles (Outlook) ─────────────────────────────────── */

.suggestion-area {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0 6px;
}

.suggestion-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  background: #ffffff;
  color: #374151;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.suggestion-bubble:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.suggestion-bubble:active {
  background: #e5e7eb;
}

.suggestion-bubble--draft {
  cursor: default;
  padding-right: 4px;
  gap: 6px;
}

.suggestion-bubble-label {
  cursor: pointer;
}

.suggestion-bubble-label:hover {
  color: #030712;
}

.suggestion-tone-select {
  font-family: inherit;
  font-size: 12px;
  padding: 2px 4px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  color: #374151;
  outline: none;
  cursor: pointer;
  max-width: 120px;
}

.suggestion-tone-select:focus {
  border-color: #7a7afe;
}

/* ── Outlook structured cards ──────────────────────────────────────── */

.outlook-card {
  border: 1px solid #e5e7eb;
  border-left: 4px solid #0078d4;
  border-radius: 8px;
  background: #f9fafb;
  padding: 16px;
  animation: fadeIn 0.15s ease-out;
}

.outlook-card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 10px;
  color: #374151;
}

.outlook-card-body {
  font-size: 14px;
  line-height: 1.6;
  color: #030712;
  white-space: pre-wrap;
}

.outlook-card-body code {
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13px;
}

.outlook-card-body strong {
  font-weight: 600;
}

.outlook-card-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.outlook-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: #0078d4;
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.outlook-card-btn:hover {
  background: #106ebe;
}

.outlook-card-btn:active {
  background: #005a9e;
}

.outlook-card--summary { border-left-color: #0078d4; }
.outlook-card--translation { border-left-color: #107c10; }
.outlook-card--draft_reply { border-left-color: #ca5010; }

/* ── Hidden utility ────────────────────────────────────────────────── */

.hidden {
  display: none !important;
}
