:root {
  --primary-color: #f97316;
  --primary-hover: #ea580c;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;

  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-chat: #ffffff;
  --bg-user-message: #f97316;
  --bg-bot-message: #f1f5f9;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-chat: #1e293b;
  --bg-user-message: #f97316;
  --bg-bot-message: #334155;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --border-color: #334155;
  --border-hover: #475569;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  /* Fix for iPad viewport issues */
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for better mobile support */
  overflow-x: hidden;
}

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for better mobile support */
  padding: 2rem;
}

/* Bot Selection Page Styles */
.bot-selection-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  max-width: 1200px;
  width: 100%;
}

.bot-selection-header {
  margin-bottom: 3rem;
  position: relative;
}

.bot-selection-header .header-controls {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bot-selection-header h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #f97316, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.bot-selection-header p {
  font-size: 1.25rem;
  color: var(--text-secondary);
}

.bot-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  width: 100%;
  max-width: 1000px;
}

.bot-card {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.bot-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.bot-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.bot-card:hover::before {
  transform: scaleX(1);
}

.bot-logo {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 80px;
}

.bot-logo img {
  max-height: 60px;
  width: auto;
  filter: drop-shadow(var(--shadow-sm));
}

.bot-text-logo {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-color);
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
}

.bot-card h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.bot-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.bot-status {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bot-status.available {
  background: var(--success-color);
  color: white;
}

.bot-status.coming-soon {
  background: var(--warning-color);
  color: white;
}

/* Main Page Styles */
.main-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  margin-bottom: 64px;
}

.main-header {
  margin-top: 2.5rem;
}

.logo-container {
  margin-bottom: 1.5rem;
}

.company-logo {
  max-height: 60px;
  width: auto;
  filter: drop-shadow(var(--shadow-sm));
}

.main-title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #f97316, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.main-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  width: 100%;
  max-width: 800px;
}

.feature-card {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.feature-card i {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Chatbox Styles */
.chatbox-container {
  display: flex;
  flex-direction: column;
  width: 600px;
  max-width: 100%;
  height: 80vh;
  height: 80dvh; /* Dynamic viewport height for better mobile support */
  max-height: 800px;
  position: relative;
}

/* Center both chatbox and job sidebar when job sidebar is active (non-fullscreen only) */
.chatbox-container:not(.fullscreen):has(.job-sidebar.active) {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: auto;
  max-width: 1200px;
  margin: 0 auto;
}

.chatbox {
  background: var(--bg-chat);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-left h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success-color);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 0.9rem;
}

.control-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}



.language-switch {
  padding: 0 0.2rem !important;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
  height: 36px;
  cursor: pointer;
  margin-right: 0;
}

.language-switch:focus,
.language-switch:hover {
  border-color: var(--primary-color);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 100%;
  animation: slideIn 0.3s ease;
  min-width: 0;
}

.message-content-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.bot-avatar {
  background: var(--primary-color);
  color: white;
}

.user-avatar {
  background: var(--secondary-color);
  color: white;
}

.message-content {
  background: var(--bg-bot-message);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  position: relative;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
  min-width: 0;
  margin-bottom: 0; /* Remove bottom margin */
}

.message.user .message-content {
  background: var(--bg-user-message);
  color: var(--text-inverse);
  border-color: var(--bg-user-message);
}

.message-content p {
  margin: 0;
  word-wrap: break-word;
}

.message-content ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.message-content li {
  margin: 0.25rem 0;
}

/* Link styles for AI messages */
.message-content a {
  color: #3b82f6;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.message-content a:hover {
  color: #2563eb;
}

[data-theme="dark"] .message-content a {
  color: #60a5fa;
}

[data-theme="dark"] .message-content a:hover {
  color: #93c5fd;
}

.welcome-message {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.welcome-message .bot-avatar {
  width: 32px;
  height: 32px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* Chatbot Selector Styles */
.chatbot-selector {
  margin-bottom: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1rem;
  position: relative;
  padding-right: 4rem; /* Make room for the logo on the right */
}

.chatbot-selector label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.selector-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.chatbot-select {
  flex: 0 0 140px; /* Fixed smaller width instead of flex: 1 */
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  cursor: pointer;
}

.chatbot-logo {
  position: absolute;
  top: 0;
  right: 0;
  width: calc(9rem - 1.5rem);
  height: calc(100% - 1.5rem);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  border-top-right-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  border-left: none;
  border-top: none;
  border-bottom: none;
  padding: 0.75rem 0;
  margin: 0.75rem;
  margin-right: 1rem;
}

.chatbot-logo a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.chatbot-logo a:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chatbot-logo img {
  width: 100%;
  object-fit: cover;
}

.chatbot-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  padding: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* New Question banner (BJC: clear session and start fresh; shown only after first bot response via JS) */
.new-question-banner {
  display: none;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: var(--primary-color);
  padding: 0.5rem 1.5rem;
  border-top: 1px solid var(--border-color);
  align-items: center;
  justify-content: center;
}
.new-question-banner-text {
  margin: 0;
  color: var(--text-inverse);
  font-size: 0.9rem;
  font-weight: 500;
}
.new-question-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-inverse);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.new-question-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}
.new-question-btn:active {
  transform: translateY(0);
}

.chat-input-container {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.input-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

#messageInput {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.95rem;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease;
  height: 44px;
  box-sizing: border-box;
}

#messageInput:focus {
  border-color: var(--primary-color);
}

.send-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
}

.send-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.send-btn:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

.char-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.voice-btn {
  background: var(--secondary-color);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  margin-right: 0;
}

.voice-btn:hover:not(:disabled) {
  background: var(--text-secondary);
  transform: translateY(-1px);
}

.voice-btn:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}





/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-content {
  padding: 1.5rem;
}

.session-info-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.session-info-header h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
}

.setting-group {
  margin-bottom: 1.5rem;
}

.setting-group:last-child {
  margin-bottom: 0;
}

.setting-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.session-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.session-info code {
  flex: 1;
  background: var(--bg-secondary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  word-break: break-all;
}

.copy-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.proxy-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.proxy-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.proxy-status-indicator i {
  font-size: 0.75rem;
  transition: all 0.3s ease;
}

.proxy-status-indicator span {
  font-size: 0.875rem;
  font-weight: 500;
}

.proxy-check-btn {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
}

.proxy-check-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.proxy-check-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.session-time {
  background: var(--bg-secondary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 0.875rem;
}

.new-session-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
  width: 100%;
}

.new-session-btn:hover {
  background: var(--primary-hover);
}

.delete-session-btn {
  background: var(--warning-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
  width: 100%;
}

.delete-session-btn:hover {
  background: #d97706;
}

.delete-all-sessions-btn {
  background: var(--danger-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
  width: 100%;
}

.delete-all-sessions-btn:hover {
  background: #dc2626;
}

/* Voice Settings */
.voice-settings {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

.voice-setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.voice-setting-item label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  min-width: 120px;
}

.voice-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-color);
}

.voice-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-secondary);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.voice-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
}

.voice-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  border: none;
}

.voice-value {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 30px;
  text-align: right;
}

.api-key-input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.api-key-input:focus {
  border-color: var(--primary-color);
}

.voice-select {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  cursor: pointer;
}

.voice-select:focus {
  border-color: var(--primary-color);
}

/* Voice Conversation Popup */
.voice-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.voice-popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

.voice-popup {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.voice-popup-overlay.active .voice-popup {
  transform: scale(1);
}

.voice-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.voice-popup-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 600;
}

.close-voice-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.close-voice-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.voice-conversation-container {
  flex: 1;
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.voice-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
}

.voice-indicator {
  margin-bottom: 2rem;
}

.voice-status-text {
  margin: 1rem 0 0 0;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
}

/* Listening Indicator */
.listening-indicator {
  color: var(--primary-color);
}

.listening-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.listening-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary-color);
  animation: listening-pulse 1.4s ease-in-out infinite both;
}

.listening-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.listening-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.listening-dots span:nth-child(3) {
  animation-delay: 0s;
}

@keyframes listening-pulse {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Speaking Indicator */
.speaking-indicator {
  color: var(--success-color);
}

.speaking-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  height: 60px;
}

.speaking-wave span {
  width: 4px;
  background: var(--success-color);
  border-radius: 2px;
  animation: speaking-wave 1.2s ease-in-out infinite;
}

.speaking-wave span:nth-child(1) {
  height: 20px;
  animation-delay: -0.4s;
}

.speaking-wave span:nth-child(2) {
  height: 40px;
  animation-delay: -0.2s;
}

.speaking-wave span:nth-child(3) {
  height: 60px;
  animation-delay: 0s;
}

.speaking-wave span:nth-child(4) {
  height: 40px;
  animation-delay: 0.2s;
}

.speaking-wave span:nth-child(5) {
  height: 20px;
  animation-delay: 0.4s;
}

@keyframes speaking-wave {
  0%, 40%, 100% {
    transform: scaleY(0.4);
  }
  20% {
    transform: scaleY(1);
  }
}

/* Error Indicator */
.error-indicator {
  color: var(--danger-color);
}

.error-indicator i {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Waiting Indicator */
.waiting-indicator {
  color: var(--warning-color);
}

.waiting-spinner {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.waiting-spinner i {
  color: var(--warning-color);
}

/* Voice Transcript and Response */
.voice-transcript,
.voice-response,
.voice-error-message {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1rem;
  max-width: 100%;
  word-wrap: break-word;
  line-height: 1.6;
  color: var(--text-primary);
  font-size: 1rem;
  text-align: left;
  max-height: 200px;
  overflow-y: auto;
}

.voice-transcript {
  border-left: 4px solid var(--primary-color);
}

.voice-transcript:empty {
  display: none;
}

.voice-response {
  border-left: 4px solid var(--success-color);
}

.voice-error-message {
  border-left: 4px solid var(--danger-color);
  color: var(--danger-color);
}

/* Voice Popup Footer */
.voice-popup-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.voice-mic-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: var(--shadow-lg);
}

.voice-mic-btn:hover {
  background: var(--text-secondary);
  transform: scale(1.05);
}

.voice-mic-btn.listening {
  background: var(--danger-color);
  animation: mic-pulse 1s infinite;
}

.voice-mic-btn.speaking {
  background: var(--success-color);
  animation: mic-pulse 1s infinite;
}

.voice-mic-btn.waiting {
  background: var(--warning-color);
  cursor: not-allowed;
  opacity: 0.7;
}

.voice-mic-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

@keyframes mic-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.voice-instructions {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  margin: 0;
}

.voice-indicator-small {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  opacity: 0.7;
}

.message-content {
  position: relative;
  padding-right: 2rem;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  background: var(--bg-primary);
  padding: 2rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

.loading-spinner i {
  font-size: 2rem;
  color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .container {
    padding: 1rem;
  }

  .bot-selection-page {
    padding: 1rem;
  }

  .bot-selection-header h1 {
    font-size: 2.5rem;
  }

  .bot-cards {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .chatbox-container {
    width: 100%;
    max-width: 600px;
    height: 70vh;
    min-height: 500px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0.5rem;
  }

  .bot-selection-page {
    padding: 0.5rem;
  }

  .bot-selection-header h1 {
    font-size: 2rem;
  }

  .bot-selection-header p {
    font-size: 1.1rem;
  }

  .bot-card {
    padding: 1.5rem;
  }

  .bot-logo {
    height: 60px;
    margin-bottom: 1rem;
  }

  .bot-logo img {
    max-height: 40px;
  }

  .bot-text-logo {
    font-size: 1.2rem;
    padding: 0.75rem;
  }

  .bot-card h3 {
    font-size: 1.25rem;
  }

  .chatbox-container {
    width: 100%;
    max-width: 100%;
    height: 80vh;
    min-height: 500px;
  }

  .chat-header {
    padding: 1rem;
  }

  .chat-messages {
    padding: 0.75rem;
  }

  .message {
    max-width: 95%;
  }

  .chat-input-container {
    padding: 1rem;
  }

  .modal {
    width: 95%;
    margin: 1rem;
  }

  .modal-header,
  .modal-content {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0.25rem;
  }

  .bot-selection-page {
    padding: 0.25rem;
  }

  .bot-selection-header h1 {
    font-size: 1.75rem;
  }

  .bot-selection-header p {
    font-size: 1rem;
  }

  .bot-card {
    padding: 1rem;
  }

  .bot-logo {
    height: 50px;
    margin-bottom: 0.75rem;
  }

  .bot-logo img {
    max-height: 35px;
  }

  .bot-text-logo {
    font-size: 1rem;
    padding: 0.5rem;
  }

  .bot-card h3 {
    font-size: 1.1rem;
  }

  .bot-card p {
    font-size: 0.9rem;
  }

  .chatbox-container {
    width: 100%;
    max-width: 100%;
    height: 90vh;
    min-height: 100svh;
    min-height: calc(100svh - env(safe-area-inset-bottom, 0px) - 16px);
    min-height: 100dvh; /* Dynamic viewport height for better iPad support */
    min-height: calc(100dvh - env(safe-area-inset-bottom, 0px) - 16px);
    max-height: none;
  }

  .header-left h3 {
    font-size: 1rem;
  }

  .control-btn {
    padding: 0.375rem;
  }

  .message-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .welcome-message .bot-avatar {
    width: 28px;
    height: 28px;
    aspect-ratio: 1 / 1;
    font-size: 0.75rem;
  }

  .message-content {
    padding: 0.625rem 0.875rem;
  }

  #messageInput {
    height: 40px;
    font-size: 16px;
    padding: 0.625rem 0.875rem;
  }

  .send-btn {
    min-width: 40px;
    height: 40px;
    padding: 0.625rem;
  }

  #mobileChatBubble {
    display: flex;
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 1500;
    width: 56px;
    height: 56px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: grab;
    transition: box-shadow 0.2s;
    user-select: none;
    touch-action: none;
    border: none;
    margin: 0;
    padding: 0;
    pointer-events: auto;
    overflow: visible;
    left: auto;
    right: 1.25rem;
    top: auto;
    background-clip: padding-box;
    text-decoration: none;
  }
  #mobileChatBubble:active {
    cursor: grabbing;
    box-shadow: 0 2px 8px rgba(0,0,0,0.28);
  }
  #mobileChatBubble i {
    color: white;
    font-size: 2rem;
    line-height: normal;
    display: inline-block;
    width: auto;
    height: auto;
    text-align: center;
    margin: 0;
    padding: 0;
  }


  #orientationOverlay {
    display: none;
    position: fixed;
    z-index: 5000;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.96);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.4s;
  }
  #orientationOverlay.active {
    display: flex;
    opacity: 1;
  }
  .orientation-content {
    text-align: center;
    color: #fff;
    padding: 2rem 1.5rem;
    border-radius: 1.5rem;
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    animation: popIn 0.5s cubic-bezier(.68,-0.55,.27,1.55);
  }
  .orientation-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    animation: rotatePhone 1.5s infinite alternate cubic-bezier(.68,-0.55,.27,1.55);
  }
  @keyframes popIn {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
  }
  @keyframes rotatePhone {
    0% { transform: rotate(-20deg); }
    100% { transform: rotate(20deg); }
  }

  .chatbox-container.fullscreen {
    min-height: 100svh;
    min-height: calc(100svh - env(safe-area-inset-bottom, 0px) - 16px);
    min-height: 100dvh; /* Dynamic viewport height for better iPad support */
    min-height: calc(100dvh - env(safe-area-inset-bottom, 0px) - 16px);
    height: auto;
    max-height: none;
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Animation for typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-bot-message);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.typing-dots {
  display: flex;
  gap: 0.25rem;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}
.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.fullscreen-active {
  overflow: hidden;
}

.chatbox-container.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for better iPad support */
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh; /* Dynamic viewport height for better iPad support */
  z-index: 2000;
  background: rgba(15, 23, 42, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0;
  box-shadow: none;
  /* Add safe area insets for iPad */
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.chatbox-container.fullscreen .chatbot-selector {
  display: none; /* Hide the selector in fullscreen */
}

.chatbox-container.fullscreen .chatbox {
  width: 100%;
  height: 100%;
  max-width: 800px; /* Reasonable max width for fullscreen */
  max-height: 100%;
  border-radius: var(--radius-xl); /* Keep some border radius */
  box-shadow: var(--shadow-xl);
}

.fullscreen-btn.active i::before {
  content: "\f066"; /* fa-compress icon */
}

/* Coming Soon Overlay */
.coming-soon-overlay {
  position: absolute;
  top: 60px; /* Height of the chat header */
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
}

.coming-soon-content {
  text-align: center;
  color: white;
  padding: 2rem;
  max-width: 400px;
}

.coming-soon-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
  animation: pulse 2s infinite;
}

.coming-soon-content h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.coming-soon-content p {
  font-size: 1rem;
  margin-bottom: 2rem;
  opacity: 0.9;
  line-height: 1.5;
}

.coming-soon-progress {
  margin-top: 1.5rem;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  border-radius: 3px;
  animation: progress 3s ease-in-out infinite;
  width: 60%;
}

.progress-text {
  font-size: 0.875rem;
  opacity: 0.8;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes progress {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Dark theme adjustments for coming soon overlay */
[data-theme="dark"] .coming-soon-overlay {
  background: rgba(0, 0, 0, 0.9);
}

[data-theme="dark"] .coming-soon-icon {
  color: var(--accent-color);
}

/* Dark mode logo background for ANOFM */
[data-theme="dark"] .chatbot-logo img[src*="anofm"] {
  background: white;
  padding: 4px;
  border-radius: var(--radius-sm);
}

#mobileChatBubble.hide {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
#mobileChatBubble {
  transition: opacity 0.4s;
}

@media (min-width: 481px) {
  .chatbox-container.fullscreen {
    padding: 2rem;
  }
}

/* iPad specific fixes */
@media (min-width: 768px) and (max-width: 1024px) {
  body {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for iPad */
  }
  
  .container {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for iPad */
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  }
  
  .chatbox-container {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for iPad */
    max-height: none;
  }
  
  .chatbox-container.fullscreen {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for iPad */
    max-height: 100vh;
    max-height: 100dvh; /* Dynamic viewport height for iPad */
  }
}

@media (min-width: 769px) {
  html, body {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for better mobile support */
    overflow: hidden;
  }
  .container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for better mobile support */
    padding: 2rem;
  }
}

/* Responsive Design for Voice Popup */
@media (max-width: 768px) {
  .voice-popup {
    width: 95%;
    max-height: 90vh;
  }
  
  .voice-conversation-container {
    padding: 1.5rem;
    min-height: 250px;
  }
  
  .voice-mic-btn {
    width: 70px;
    height: 70px;
    font-size: 1.5rem;
  }
  
  .voice-transcript,
  .voice-response,
  .voice-error-message {
    font-size: 0.9rem;
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .voice-popup-header {
    padding: 1rem;
  }
  
  .voice-popup-header h3 {
    font-size: 1.1rem;
  }
  
  .voice-conversation-container {
    padding: 1rem;
    min-height: 200px;
  }
  
  .voice-mic-btn {
    width: 60px;
    height: 60px;
    font-size: 1.3rem;
  }
}

.job-sidebar {
  position: absolute;
  top: 0;
  right: 100%;
  height: 100%;
  background: var(--bg-chat);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding: 0;
  transition: opacity 0.3s cubic-bezier(.4,0,.2,1), visibility 0.3s cubic-bezier(.4,0,.2,1);
  opacity: 0;
  visibility: hidden;
  pointer-events: auto;
}

/* When job sidebar is active and container is centered, position sidebar to the left (non-fullscreen only) */
.chatbox-container:not(.fullscreen):has(.job-sidebar.active) .job-sidebar.active {
  position: static;
  width: 600px;
  height: 80vh;
  height: 80dvh;
  max-height: 800px;
  opacity: 1;
  visibility: visible;
  order: 0;
}

/* Ensure chatbox is positioned correctly when job sidebar is active (non-fullscreen only) */
.chatbox-container:not(.fullscreen):has(.job-sidebar.active) .chatbox {
  order: 1;
  width: 600px;
  height: 80vh;
  height: 80dvh;
  max-height: 800px;
}
.job-sidebar.active {
  opacity: 1;
  visibility: visible;
}
.job-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
}
.job-sidebar-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.close-job-sidebar {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 0.9rem;
}
.close-job-sidebar:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.job-listings {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  min-width: 0;
}
.job-listings::-webkit-scrollbar {
  width: 6px;
}
.job-listings::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  
}
.job-listings::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-lg);
}

/* Job Filters */
.job-filters {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.filters-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-primary);
}

.toggle-filters-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
}

.toggle-filters-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.filters-summary {
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 0.5rem;
}

.filters-summary-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-style: italic;
}

.filters-content {
  transition: all 0.3s ease;
}

.filter-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.filter-row:last-of-type {
  margin-bottom: 0.5rem;
}

.filter-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}

.filter-group input,
.filter-group select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.filter-group input::placeholder {
  color: var(--text-muted);
}

.filter-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
}

.filter-btn,
.reset-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-btn {
  background: var(--primary-color);
  color: white;
}

.filter-btn:hover {
  background: var(--primary-hover);
}

.reset-btn {
  background: var(--danger-color);
  color: white;
}

.reset-btn:hover {
  background: #dc2626;
}

.job-card {
  background: var(--bg-bot-message);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  word-break: break-word;
  margin: 0;
  position: relative;
}
.job-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}
.job-card-company {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}
.job-card-location {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.job-card-description {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}
.job-card-posted {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.job-card-salary,
.job-card-contract,
.job-card-work-type,
.job-card-description,
.job-card-contact {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.job-card-salary i,
.job-card-contract i,
.job-card-work-type i,
.job-card-contact i {
  color: var(--primary-color);
  width: 14px;
  text-align: center;
}

.job-card-contact a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.job-card-contact a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.job-card-description {
  font-style: italic;
  color: var(--text-muted);
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Combo Box Styles */
.combo-box-container {
  position: relative;
  width: 100%;
}

.combo-box-container input {
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
  padding-right: 4rem; /* Make room for clear button and dropdown arrow */
}

.combo-box-container::after {
  content: '\f0d7'; /* FontAwesome down arrow */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.combo-clear-btn {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: bold;
  padding: 0;
  width: 1.2rem;
  height: 1.2rem;
  display: none;
  z-index: 1001;
  transition: color 0.2s ease;
}

.combo-clear-btn:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
  border-radius: 50%;
}

.combo-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
}

.combo-option {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s;
}

.combo-option:hover,
.combo-option.highlighted {
  background-color: var(--bg-secondary);
}

.combo-option:last-child {
  border-bottom: none;
}

.combo-option.no-results {
  color: var(--text-muted);
  font-style: italic;
  cursor: default;
}

.combo-option.no-results:hover {
  background-color: transparent;
}

/* Ensure filter groups don't overflow */
.filter-group {
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

.filter-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-row:last-of-type {
  margin-bottom: 0.5rem;
}

/* Responsive adjustments for job sidebar */
@media (max-width: 900px) {
  .filter-row {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .filter-group {
    flex: none;
    width: 100%;
  }
  
  /* On mobile, job sidebar should overlay over chatbox instead of stacking */
  .chatbox-container:not(.fullscreen):has(.job-sidebar.active) {
    flex-direction: row; /* Keep horizontal layout */
    gap: 0; /* Remove gap since sidebar will overlay */
    width: 100%;
    max-width: 600px;
    position: relative; /* Ensure proper positioning context */
  }
  
  /* Job sidebar overlays on mobile */
  .job-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    padding: 0 !important;
    transform: translateX(0) !important;
    z-index: 1000 !important;
    background: var(--bg-chat) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-xl) !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  /* Fixed header on mobile */
  .job-sidebar .job-sidebar-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 1rem 1.5rem !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }
  
  /* Optimize filters section for mobile */
  .job-sidebar .job-filters {
    flex-shrink: 0 !important;
    border-bottom: 1px solid var(--border-color) !important;
    background: var(--bg-secondary) !important;
    padding: 0.75rem 1rem !important; /* Reduced padding */
    margin: 0 !important;
    overflow-y: visible !important;
    max-height: 40vh !important; /* Limit height to prevent overflow */
  }
  
  /* Make job listings the main scrollable area */
  .job-sidebar .job-listings {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 1rem 1.5rem !important;
    margin: 0 !important;
    background: var(--bg-chat) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    min-height: 0 !important; /* Allow flex shrinking */
  }
  
  /* Ensure filters content is scrollable if it overflows */
  .job-sidebar .job-filters .filters-content {
    max-height: 30vh !important;
    overflow-y: auto !important;
  }
  
  /* Custom scrollbar for filters on mobile */
  .job-sidebar .job-filters .filters-content::-webkit-scrollbar {
    width: 4px !important;
  }
  
  .job-sidebar .job-filters .filters-content::-webkit-scrollbar-track {
    background: var(--bg-tertiary) !important;
    border-radius: var(--radius-sm) !important;
  }
  
  .job-sidebar .job-filters .filters-content::-webkit-scrollbar-thumb {
    background: var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
  }
  
  /* Custom scrollbar for mobile job sidebar */
  .job-sidebar .job-listings::-webkit-scrollbar {
    width: 6px !important;
  }
  
  .job-sidebar .job-listings::-webkit-scrollbar-track {
    background: var(--bg-secondary) !important;
    border-radius: var(--radius-lg) !important;
  }
  
  .job-sidebar .job-listings::-webkit-scrollbar-thumb {
    background: var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
  }
  
  /* Chatbox remains in normal position when job sidebar is active on mobile */
  .chatbox-container:not(.fullscreen):has(.job-sidebar.active) .chatbox {
    width: 100%;
    height: 80vh;
    height: 80dvh;
    max-height: 800px;
    z-index: 1; /* Lower z-index so job sidebar can overlay */
  }
}

/* 50/50 split for fullscreen chat + job sidebar (job sidebar left, chatbox right) */
.chatbox-container.fullscreen.with-job-sidebar {
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
}
.chatbox-container.fullscreen.with-job-sidebar #jobSidebar.job-sidebar.active {
  order: 0;
  width: 50vw !important;
  max-width: none;
  height: 100vh !important;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  background: var(--bg-chat);
  border: 1px solid var(--border-color);
  display: flex !important;
  position: static !important;
  opacity: 1;
  visibility: visible;
  left: auto !important;
  top: auto !important;
  padding: 0;
  flex-direction: column;
}
.chatbox-container.fullscreen.with-job-sidebar #jobSidebar.job-sidebar.active .job-sidebar-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
}
.chatbox-container.fullscreen.with-job-sidebar #jobSidebar.job-sidebar.active .job-sidebar-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.chatbox-container.fullscreen.with-job-sidebar #jobSidebar.job-sidebar.active .job-listings {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
  background: transparent;
}
.chatbox-container.fullscreen.with-job-sidebar .chatbox {
  order: 1;
  width: 50vw !important;
  max-width: none;
  height: 100vh;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

/* Smooth transition for fullscreen split */
.chatbox-container.fullscreen.with-job-sidebar .chatbox,
.chatbox-container.fullscreen.with-job-sidebar #jobSidebar.job-sidebar.active,
#jobSidebar.job-sidebar,
.chatbox {
  transition: width 0.4s cubic-bezier(.4,0,.2,1),
              height 0.4s cubic-bezier(.4,0,.2,1),
              border-radius 0.4s cubic-bezier(.4,0,.2,1),
              box-shadow 0.4s cubic-bezier(.4,0,.2,1),
              left 0.4s cubic-bezier(.4,0,.2,1),
              top 0.4s cubic-bezier(.4,0,.2,1),
              right 0.4s cubic-bezier(.4,0,.2,1),
              max-width 0.4s cubic-bezier(.4,0,.2,1);
}
.chatbox-container:not(.fullscreen) #jobSidebar.job-sidebar.active {
  transition: none !important;
}

.chatbox-container.fullscreen.with-job-sidebar {
  align-items: stretch;
  padding: 2rem !important;
  box-sizing: border-box;
  gap: 1rem;
}
.chatbox-container.fullscreen.with-job-sidebar #jobSidebar.job-sidebar.active,
.chatbox-container.fullscreen.with-job-sidebar .chatbox {
  height: calc(100vh - 4rem) !important;
  height: calc(100dvh - 4rem) !important; /* Dynamic viewport height for iPad */
  max-height: calc(100vh - 4rem);
  max-height: calc(100dvh - 4rem); /* Dynamic viewport height for iPad */
  min-height: 0;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.chatbox-container.fullscreen.with-job-sidebar #jobSidebar.job-sidebar.active {
  height: 100%;
  max-height: 100%;
}

.chatbox-container.fullscreen.with-job-sidebar #jobSidebar.job-sidebar.active .job-listings::-webkit-scrollbar {
  width: 6px;
}
.chatbox-container.fullscreen.with-job-sidebar #jobSidebar.job-sidebar.active .job-listings::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
.chatbox-container.fullscreen.with-job-sidebar #jobSidebar.job-sidebar.active .job-listings::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.chatbox-container.fullscreen.with-job-sidebar #jobSidebar .job-sidebar-header {
  margin-bottom: 0 !important;
}

/* Like/Dislike Feedback Styles */
.message-feedback {
  display: flex;
  gap: 0.5rem;
  margin-top: -0.5rem; /* Completely removed */
  padding: 0.25rem 0; /* Reduced from 0.5rem */
  justify-content: flex-end;
  align-items: center;
  margin-left: 2.5rem; /* Align with message content, accounting for avatar */
  width: calc(100% - 2.5rem); /* Take full width minus avatar space */
}

/* For user messages, don't show feedback */
.message.user .message-feedback {
  display: none;
}

.feedback-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.feedback-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--border-hover);
}

.like-btn:hover {
  color: var(--success-color);
  border-color: var(--success-color);
}

.dislike-btn:hover {
  color: var(--danger-color);
  border-color: var(--danger-color);
}

.feedback-btn:active {
  transform: scale(0.95);
}

/* Dislike Popup Styles */
.dislike-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dislike-popup-overlay.show {
  opacity: 1;
}

.dislike-popup {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

/* Conversation feedback popup (New Conversation flow) */
.conversation-feedback-popup {
  max-width: 560px;
  max-height: 90vh;
}

.conversation-feedback-list {
  margin-bottom: 1.25rem;
}

.conversation-feedback-list-title {
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
}

.conversation-feedback-messages {
  max-height: 380px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.conversation-feedback-message {
  font-size: 0.8125rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  word-break: break-word;
}

.conversation-feedback-message:last-child {
  border-bottom: none;
}

.conversation-feedback-message--user .conversation-feedback-role {
  color: var(--primary-color);
  font-weight: 500;
}

.conversation-feedback-message--bot .conversation-feedback-role {
  color: var(--text-secondary);
  font-weight: 500;
}

.conversation-feedback-content {
  color: var(--text-primary);
}

.conversation-feedback-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.conversation-feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid;
  transition: all 0.2s ease;
}

.conversation-feedback-positive {
  background: var(--success-color);
  border-color: var(--success-color);
  color: white;
}

.conversation-feedback-positive:hover:not(:disabled) {
  filter: brightness(1.08);
}

.conversation-feedback-negative {
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.conversation-feedback-negative:hover {
  background: var(--bg-secondary);
  border-color: var(--danger-color);
  color: var(--danger-color);
}

.conversation-feedback-negative-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.conversation-feedback-negative-form label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.875rem;
}

.conversation-feedback-negative-form textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  resize: vertical;
  min-height: 180px;
  margin-bottom: 0.75rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  box-sizing: border-box;
}

.conversation-feedback-form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.dislike-popup-overlay.show .dislike-popup {
  transform: scale(1);
}

.dislike-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.dislike-popup-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.125rem;
}

.close-dislike-popup {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.close-dislike-popup:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.dislike-popup-content {
  padding: 1.5rem;
}

.disliked-message {
  margin-bottom: 1.5rem;
}

.disliked-message h4 {
  margin: 0 0 0.75rem 0;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
}

.message-preview {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-height: 120px;
  overflow-y: auto;
  word-break: break-word;
}

.feedback-form {
  margin-bottom: 1.5rem;
}

.feedback-form label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.875rem;
}

.feedback-form textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  resize: vertical;
  min-height: 80px;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

.feedback-form textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.char-count-dislike {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.dislike-popup-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.cancel-btn, .submit-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid;
}

.cancel-btn {
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.cancel-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.submit-btn {
  background: var(--danger-color);
  border-color: var(--danger-color);
  color: white;
}

.submit-btn:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Feedback Message */
.feedback-message {
  background: var(--success-color);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin: 0.5rem 0;
  text-align: center;
  font-size: 0.875rem;
  animation: slideIn 0.3s ease;
}

/* Dark theme adjustments for dislike popup */
[data-theme="dark"] .dislike-popup {
  background: var(--bg-secondary);
}

[data-theme="dark"] .message-preview {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

[data-theme="dark"] .feedback-form textarea {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .feedback-form textarea:focus {
  border-color: var(--primary-color);
}

[data-theme="dark"] .cancel-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

[data-theme="dark"] .cancel-btn:hover {
  background: var(--bg-secondary);
}

/* =============================================================================
   Book Search (BJC chatbot)
   -----------------------------------------------------------------------------
   Reuses the .job-sidebar shell; .book-search-mode is added by JS to switch
   palette/spacing. Status colors are themed via CSS variables for dark mode.
   ============================================================================= */

:root {
  --book-status-available-bg: rgba(16, 185, 129, 0.12);
  --book-status-available-fg: #047857;
  --book-status-available-border: rgba(16, 185, 129, 0.35);

  --book-status-pending-bg: rgba(245, 158, 11, 0.14);
  --book-status-pending-fg: #b45309;
  --book-status-pending-border: rgba(245, 158, 11, 0.35);

  --book-status-unavailable-bg: rgba(239, 68, 68, 0.12);
  --book-status-unavailable-fg: #b91c1c;
  --book-status-unavailable-border: rgba(239, 68, 68, 0.35);

  --book-status-unknown-bg: rgba(100, 116, 139, 0.16);
  --book-status-unknown-fg: #475569;
  --book-status-unknown-border: rgba(100, 116, 139, 0.35);
}

[data-theme="dark"] {
  --book-status-available-fg: #6ee7b7;
  --book-status-pending-fg: #fbbf24;
  --book-status-unavailable-fg: #fca5a5;
  --book-status-unknown-fg: #cbd5e1;
}

/* When the shared sidebar is in book mode, hide the job filter chrome */
.job-sidebar.book-search-mode .job-filters {
  display: none !important;
}

.book-search-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.book-search-query {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.book-search-query i {
  color: var(--primary-color);
}

.book-search-query-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.book-search-query-value {
  font-style: italic;
  color: var(--text-primary);
  word-break: break-word;
}

.book-search-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.book-search-status i {
  color: var(--primary-color);
}

.book-search-status.is-error {
  color: var(--danger-color);
}

.book-search-status.is-error i {
  color: var(--danger-color);
}

.book-listings {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.no-books-message {
  padding: 1rem 0.25rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  text-align: center;
}

/* ---- Book card -------------------------------------------------------- */

.book-card {
  background: var(--bg-bot-message);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
  word-break: break-word;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.book-card:hover {
  box-shadow: var(--shadow-md);
}

.book-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.book-card-headings {
  flex: 1 1 auto;
  min-width: 0;
}

.book-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin: 0 0 0.2rem 0;
  word-break: break-word;
}

.book-card-author {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Status chip */
.book-card-status {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
  text-transform: uppercase;
}

.book-card-status i {
  font-size: 0.55rem;
}

.book-card-status-available {
  background: var(--book-status-available-bg);
  color: var(--book-status-available-fg);
  border-color: var(--book-status-available-border);
}

.book-card-status-pending {
  background: var(--book-status-pending-bg);
  color: var(--book-status-pending-fg);
  border-color: var(--book-status-pending-border);
}

.book-card-status-unavailable {
  background: var(--book-status-unavailable-bg);
  color: var(--book-status-unavailable-fg);
  border-color: var(--book-status-unavailable-border);
}

.book-card-status-unknown {
  background: var(--book-status-unknown-bg);
  color: var(--book-status-unknown-fg);
  border-color: var(--book-status-unknown-border);
}

/* Fields list */
.book-card-fields {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.3rem 0.75rem;
}

.book-card-field {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.book-card-field-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  color: var(--primary-color);
  margin-top: 0.15rem;
}

.book-card-field-label {
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.book-card-field-value {
  color: var(--text-primary);
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.book-card-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* Holdings */
.book-card-holdings {
  border-top: 1px dashed var(--border-color);
  padding-top: 0.6rem;
  margin-top: 0.15rem;
}

.book-card-holdings-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
}

.book-card-holdings-header i {
  color: var(--primary-color);
}

.book-card-holdings-count {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  padding: 0 0.4rem;
  height: 1.25rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 999px;
  font-size: 0.7rem;
  border: 1px solid var(--border-color);
}

.book-card-holdings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.book-card-holding {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.5rem 0.6rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
}

.book-card-holding-status {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.book-card-holding-status i {
  font-size: 0.5rem;
}

.book-card-holding-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.book-card-holding-location,
.book-card-holding-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  color: var(--text-primary);
}

.book-card-holding-field-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  color: var(--primary-color);
}

.book-card-holding-field-label {
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.book-card-holding-field-value {
  color: var(--text-primary);
}

.book-card-location-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.book-card-location-link:hover,
.book-card-location-link:focus {
  color: var(--primary-hover);
  border-bottom-color: var(--primary-hover);
}

.book-card-location-link i {
  font-size: 0.7rem;
  opacity: 0.7;
}

.book-card-location-text {
  color: var(--text-primary);
}

/* Footer with portal link */
.book-card-footer {
  border-top: 1px dashed var(--border-color);
  padding-top: 0.5rem;
  display: flex;
  justify-content: flex-end;
}

.book-card-portal-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.book-card-portal-link:hover,
.book-card-portal-link:focus {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--text-inverse);
}

.book-card-portal-link i {
  font-size: 0.7rem;
}

/* Mobile tweaks for book cards */
@media (max-width: 640px) {
  .book-card-header {
    flex-direction: column;
    align-items: stretch;
  }
  .book-card-status {
    align-self: flex-start;
  }
  .book-card-fields {
    grid-template-columns: 1fr;
  }
}
