/* -------------------------------------------------------------------
 * Components — Clean, Human-Crafted Professional Productivity UI
 * ------------------------------------------------------------------- */

/* Cards & Panels */
.panel {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.panel:hover {
  box-shadow: var(--shadow-sm);
}

.panel-header {
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.panel-title {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.panel-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.45;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  font-size: 0.86rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1.2;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary-accent);
  color: #FFFFFF;
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-accent-hover);
  box-shadow: var(--shadow-xs);
}

.btn-secondary {
  background-color: var(--surface-primary);
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-secondary:hover:not(:disabled) {
  background-color: var(--surface-muted);
  border-color: var(--border-strong);
}

.btn-terracotta {
  background-color: var(--secondary-accent);
  color: #FFFFFF;
}
.btn-terracotta:hover:not(:disabled) {
  background-color: var(--secondary-accent-hover);
  box-shadow: var(--shadow-xs);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover:not(:disabled) {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn-lg {
  padding: 11px 20px;
  font-size: 0.95rem;
  font-weight: 600;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-icon-only {
  padding: 6px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-icon-only:hover {
  background: var(--surface-muted);
  color: var(--text-main);
}

/* Form Controls */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.88rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  outline: none;
  box-shadow: 0 0 0 3px rgba(85, 124, 101, 0.15);
}

.form-textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.5;
}

.form-hint {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

/* File Dropzone */
.dropzone {
  border: 2px dashed var(--border-strong);
  background: var(--surface-primary);
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dropzone:hover, .dropzone.drag-active {
  border-color: var(--primary-accent);
  background: var(--primary-accent-subtle);
}

.dropzone-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 10px;
  background: var(--surface-muted);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-accent);
}

.dropzone-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
}

.dropzone-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.file-selected-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.file-selected-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.file-icon-box {
  width: 36px;
  height: 36px;
  background: var(--primary-accent-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-accent);
  flex-shrink: 0;
}

.file-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.file-meta {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  line-height: 1.2;
}

.badge-high { background: var(--error-bg); color: var(--error); border: 1px solid rgba(184, 79, 79, 0.2); }
.badge-medium { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(183, 121, 53, 0.2); }
.badge-low { background: var(--success-bg); color: var(--success); border: 1px solid rgba(63, 118, 85, 0.2); }
.badge-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(74, 110, 130, 0.2); }
.badge-forest { background: var(--primary-accent-subtle); color: var(--primary-accent); border: 1px solid rgba(85, 124, 101, 0.2); }
.badge-terracotta { background: var(--secondary-accent-subtle); color: var(--secondary-accent); border: 1px solid rgba(200, 121, 90, 0.2); }

/* Markdown & Prose Content */
.prose {
  color: var(--text-main);
  font-size: 0.92rem;
  line-height: 1.68;
}

.prose p {
  margin-bottom: 14px;
}
.prose p:last-child {
  margin-bottom: 0;
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  margin-top: 20px;
  margin-bottom: 10px;
  color: var(--text-main);
}

.prose ul, .prose ol {
  margin-bottom: 14px;
  padding-left: 22px;
}

.prose li {
  margin-bottom: 6px;
  color: var(--text-main);
}

.prose strong {
  color: var(--text-main);
  font-weight: 600;
}

.prose code {
  padding: 2px 5px;
  background: var(--surface-muted);
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--secondary-accent);
}

.prose pre {
  background: #1C2621;
  color: #E6EDE8;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: 14px;
}

.prose pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.prose blockquote {
  border-left: 3px solid var(--primary-accent);
  padding-left: 14px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  font-style: italic;
}

/* Callout Box */
.callout {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--surface-primary);
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.callout-forest {
  background: var(--primary-accent-subtle);
  border-color: rgba(85, 124, 101, 0.25);
  color: var(--text-main);
}

.callout-terracotta {
  background: var(--secondary-accent-subtle);
  border-color: rgba(200, 121, 90, 0.25);
  color: var(--text-main);
}

.callout-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.callout-body {
  font-size: 0.86rem;
  line-height: 1.5;
}

/* Chat Interface (For RAG Document Chat) */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  height: 620px;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--bg-app);
}

.chat-bubble {
  max-width: 82%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-bubble.user {
  align-self: flex-end;
}

.chat-bubble.assistant {
  align-self: flex-start;
}

.bubble-content {
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.55;
  word-break: break-word;
}

.chat-bubble.user .bubble-content {
  background: var(--user-bubble-bg);
  color: var(--user-bubble-text) !important;
  border-bottom-right-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Force all child elements in user bubble to remain high-contrast pure white */
.chat-bubble.user .bubble-content,
.chat-bubble.user .bubble-content *,
.chat-bubble.user .bubble-content p,
.chat-bubble.user .bubble-content span,
.chat-bubble.user .bubble-content strong,
.chat-bubble.user .bubble-content em,
.chat-bubble.user .bubble-content li {
  color: #FFFFFF !important;
}

.chat-bubble.user .bubble-content a {
  color: #D2EBD9 !important;
  text-decoration: underline;
}

.chat-bubble.user .bubble-content code {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #FFFFFF !important;
}

.chat-bubble.assistant .bubble-content {
  background: var(--assistant-bubble-bg);
  color: var(--assistant-bubble-text);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
}

.chat-bubble.assistant .bubble-content p,
.chat-bubble.assistant .bubble-content span,
.chat-bubble.assistant .bubble-content strong,
.chat-bubble.assistant .bubble-content li {
  color: var(--text-main);
}

.citations-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.citation-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  color: var(--primary-accent);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.citation-chip:hover {
  background: var(--primary-accent-subtle);
  border-color: var(--primary-accent);
}

.chat-input-bar {
  padding: 14px 18px;
  background: var(--surface-primary);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-input-field {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-app);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input-field:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.chat-input-field::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

/* ATS Score Visualizer */
.ats-score-card {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px;
  background: var(--surface-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.score-circle {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-full);
  background: var(--primary-accent-subtle);
  border: 4px solid var(--primary-accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.score-number {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--primary-accent);
  line-height: 1;
}

.score-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 3px;
}

.score-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  flex: 1;
}

.metric-stat {
  display: flex;
  flex-direction: column;
}

.metric-stat-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.metric-stat-label {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

/* Keyword Evidence Table */
.data-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-primary);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
}

.data-table th {
  padding: 10px 14px;
  background: var(--surface-muted);
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: top;
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* Interview Preparation Components */
.interview-card {
  background: var(--surface-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition-fast);
}

.interview-card-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  cursor: pointer;
  background: var(--surface-card);
  gap: 14px;
}

.interview-card-header:hover {
  background: var(--surface-muted);
}

.question-text {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
}

.question-meta-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.interview-card-body {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  background: var(--surface-primary);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Interview Trap Box */
.interview-trap-banner {
  background: var(--trap-bg, #FFF7ED);
  border: 1px solid var(--trap-border, #FED7AA);
  border-left: 4px solid var(--secondary-accent);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trap-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--secondary-accent);
  font-weight: 700;
  font-size: 0.88rem;
}

.trap-content {
  font-size: 0.84rem;
  color: var(--trap-text, #7C2D12);
  line-height: 1.5;
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(32, 58, 50, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-dialog {
  background: var(--surface-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-color);
  background: var(--surface-muted);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--surface-sidebar);
  color: #FFFFFF;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.86rem;
  min-width: 280px;
  max-width: 400px;
  border-left: 4px solid var(--primary-accent);
}

.toast.toast-error { border-left-color: var(--error); }
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-warning { border-left-color: var(--warning); }

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(90deg, #F0EDE4 25%, #E5E1D5 50%, #F0EDE4 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 100%;
}
.skeleton-title {
  height: 20px;
  width: 60%;
  margin-bottom: 12px;
}
