/**
 * OfferQuest - Applications Tracking Styles
 * Card-based UI with interactive progress line, modals, and pro-gating
 */

/* ============================================================
   FILTER BAR
   ============================================================ */

.applications-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.applications-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 0;
}

.dark .applications-header h2 {
  color: #f1f5f9;
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-secondary, #f1f5f9);
  padding: 0.25rem;
  border-radius: 0.5rem;
}

.dark .filter-tabs {
  background: #1e293b;
}

.filter-tab {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-secondary, #64748b);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-tab:hover {
  color: var(--text-primary, #1e293b);
}

.dark .filter-tab:hover {
  color: #f1f5f9;
}

.filter-tab.active {
  background: white;
  color: var(--accent, #2563eb);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .filter-tab.active {
  background: #334155;
  color: #60a5fa;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.5rem;
  min-width: 200px;
}

.dark .search-box {
  background: #1e293b;
  border-color: #334155;
}

.search-box .material-symbols-outlined {
  color: var(--text-muted, #94a3b8);
  font-size: 1.25rem;
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  color: var(--text-primary, #1e293b);
  outline: none;
}

.dark .search-box input {
  color: #f1f5f9;
}

.search-box input::placeholder {
  color: var(--text-muted, #94a3b8);
}

/* ============================================================
   APPLICATION CARDS
   ============================================================ */

.applications-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.app-card {
  background: white;
  border: 2px solid var(--border, #e2e8f0);
  border-radius: 0.75rem;
  padding: 0.625rem 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
  /* Compact single-row grid layout */
  display: grid;
  grid-template-columns: minmax(120px, 200px) auto 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 0.75rem;
  row-gap: 0;
}

.dark .app-card {
  background: #1e293b;
  border-color: #334155;
}

.app-card:hover {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.dark .app-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.app-card.is-closed {
  opacity: 0.7;
}

.app-card.is-declined {
  opacity: 0.75;
  border-color: #fecaca;
}

.dark .app-card.is-declined {
  border-color: #7f1d1d;
}

.app-card.outcome-accepted {
  border-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), transparent);
}

.dark .app-card.outcome-accepted {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), transparent);
}

/* Card layout — grid children positioned directly */
.app-card-info {
  grid-column: 1;
  grid-row: 1 / -1;
  min-width: 0;
  align-self: center;
}

.app-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 0 0 0.125rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dark .app-card-title {
  color: #f1f5f9;
}

.app-card-company {
  font-size: 0.8125rem;
  color: var(--text-secondary, #64748b);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dark .app-card-company {
  color: #94a3b8;
}

/* Job URL link */
.job-url-link {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  color: var(--accent, #2563eb);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.job-url-link:hover {
  opacity: 1;
}

.job-url-link .material-symbols-outlined {
  font-size: 0.875rem;
}

/* Score Badge — compact inline pill */
.app-card-score {
  grid-column: 2;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  text-decoration: none;
  white-space: nowrap;
  align-self: center;
}

.app-card-score .score-label-text {
  font-size: 0.6875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1;
}

.app-card-score .score-value {
  font-size: 0.875rem;
  font-weight: 800;
  color: white;
  line-height: 1;
}

.app-card-score .score-bar-bg {
  display: none;
}

.app-card-score .score-bar-fill {
  display: none;
}

.score-excellent {
  background: linear-gradient(135deg, #10b981, #059669);
}

.score-good {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.score-moderate {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.score-weak {
  background: linear-gradient(135deg, #94a3b8, #64748b);
}

/* Pro-locked score — blur-teaser pill */
.score-locked {
  background: var(--bg-secondary, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}

.dark .score-locked {
  background: #0f172a;
  border-color: #334155;
}

.score-locked:hover {
  border-color: var(--accent, #2563eb);
}

.score-locked .score-teaser-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  line-height: 1;
}

.score-locked .score-value {
  color: var(--text-muted, #94a3b8);
  font-size: 0.875rem;
  filter: blur(4px);
  user-select: none;
}

.score-locked .score-pro-badge {
  font-size: 0.5625rem;
  font-weight: 800;
  color: var(--accent, #2563eb);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(37, 99, 235, 0.1);
  padding: 0.0625rem 0.25rem;
  border-radius: 0.1875rem;
}

.dark .score-locked .score-pro-badge {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.15);
}

/* Card Actions */
.app-card-actions {
  grid-column: 4;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  justify-self: end;
}

.btn-progress {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--accent, #2563eb);
  color: white;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-progress:hover {
  background: #1d4ed8;
}

.btn-progress .material-symbols-outlined {
  font-size: 1rem;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: var(--bg-secondary, #f1f5f9);
  color: var(--text-primary, #1e293b);
}

.dark .btn-icon:hover {
  background: #334155;
  color: #f1f5f9;
}

.btn-delete:hover {
  background: #fef2f2;
  color: #ef4444;
}

.dark .btn-delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.accepted-badge {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border-radius: 0.375rem;
  white-space: nowrap;
}

.accepted-badge .material-symbols-outlined {
  font-size: 0.875rem;
}

.accepted-badge.large {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  margin-top: 0.5rem;
}

.declined-badge {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border-radius: 0.375rem;
  white-space: nowrap;
}

.declined-badge .material-symbols-outlined {
  font-size: 0.875rem;
}

.declined-badge.large {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  margin-top: 0.5rem;
}

/* ============================================================
   PROGRESS LINE — Interactive Stage Tracker
   Labels above, dots on line, dates below. Clickable.
   ============================================================ */

.progress-line {
  display: flex;
  align-items: center;
  position: relative;
  padding: 1.75rem 0 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.progress-line::-webkit-scrollbar {
  display: none;
}

/* Continuous background line through all dots */
.progress-line::before {
  content: '';
  position: absolute;
  top: calc(1.75rem + 0.6875rem + 0.5rem + 12px); /* padding + label + margin + half-dot */
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border, #e2e8f0);
  z-index: 0;
}

.dark .progress-line::before {
  background: #334155;
}

/* Compact progress line when inside a card row */
.app-card > .progress-line {
  grid-column: 3;
  grid-row: 1 / -1;
  padding: 1rem 0 0.25rem;
  align-self: center;
  overflow: hidden;
}

.app-card > .progress-line::before {
  top: calc(1rem + 0.5625rem + 0.25rem + 8px); /* padding + label + margin + half-dot(16px) */
  height: 1.5px;
}

/* Larger version for detail modal */
.progress-line--detail {
  padding: 2.25rem 0 1rem;
}

.progress-line--detail::before {
  top: calc(2.25rem + 1.5rem + 0.5rem + 14px); /* padding + fixed-label(2em@0.75rem) + margin + half-dot */
}

/* Stage node container */
.stage-node {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-width: 75px;
  cursor: pointer;
  z-index: 1;
  transition: opacity 0.15s ease;
}

/* Compact stage nodes in card context */
.app-card .stage-node {
  min-width: 0;
}

.stage-node:hover {
  opacity: 0.85;
}

.stage-node:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Stage label — positioned ABOVE the dot */
.stage-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  text-align: center;
  white-space: nowrap;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition: color 0.15s ease;
}

/* Compact labels in card context */
.app-card .stage-label {
  font-size: 0.5625rem;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.progress-line--detail .stage-label {
  font-size: 0.75rem;
  white-space: normal;
  word-break: break-word;
  hyphens: auto;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 2em;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  text-align: center;
}

.progress-line--detail .stage-node {
  min-width: 70px;
  padding: 0 2px;
}

/* Connector line segment between dots */
.stage-connector {
  position: absolute;
  top: calc(0.6875rem + 0.5rem + 12px); /* label height + margin + half dot */
  right: 50%;
  width: 100%;
  height: 2px;
  z-index: 0;
}

/* Compact connectors in card context */
.app-card .stage-connector {
  top: calc(0.5625rem + 0.25rem + 8px); /* compact label + margin + half-dot(16px) */
  height: 1.5px;
}

.progress-line--detail .stage-connector {
  top: calc(1.5rem + 0.5rem + 14px); /* fixed-label(2em@0.75rem) + margin + half-dot(28px) */
}

.stage-connector--completed {
  background: var(--accent, #2563eb);
}

.stage-connector--current {
  background: linear-gradient(to right, var(--accent, #2563eb), var(--border, #e2e8f0));
}

.stage-connector--skipped {
  background: none;
  border-top: 2px dashed #cbd5e1;
}

.dark .stage-connector--skipped {
  border-color: #475569;
}

.stage-connector--pending {
  background: transparent;
}

.stage-connector--declined {
  background: #ef4444;
}

.stage-connector--muted {
  background: transparent;
}

/* Stage dot */
.stage-dot {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 2px solid var(--border, #e2e8f0);
  border-radius: 50%;
  z-index: 2;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

/* Compact dots in card context */
.app-card .stage-dot {
  width: 16px;
  height: 16px;
}

.app-card .stage-dot .material-symbols-outlined {
  font-size: 10px;
}

.dark .stage-dot {
  background: #1e293b;
  border-color: #334155;
}

.progress-line--detail .stage-dot {
  width: 28px;
  height: 28px;
}

.stage-dot .material-symbols-outlined {
  font-size: 14px;
}

.progress-line--detail .stage-dot .material-symbols-outlined {
  font-size: 16px;
}

/* Completed state */
.stage-node--completed .stage-dot {
  background: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
  color: white;
}

.stage-node--completed .stage-label {
  color: var(--text-primary, #1e293b);
  font-weight: 700;
}

.dark .stage-node--completed .stage-label {
  color: #f1f5f9;
}

/* Current state */
.stage-node--current .stage-dot {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.app-card .stage-node--current .stage-dot {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.stage-node--current .stage-label {
  color: var(--accent, #2563eb);
  font-weight: 700;
}

/* Skipped state */
.stage-node--skipped .stage-dot {
  width: 16px;
  height: 16px;
  border: 2px dashed #cbd5e1;
  background: transparent;
}

.app-card .stage-node--skipped .stage-dot {
  width: 12px;
  height: 12px;
}

.dark .stage-node--skipped .stage-dot {
  border-color: #475569;
}

.progress-line--detail .stage-node--skipped .stage-dot {
  width: 18px;
  height: 18px;
}

.stage-node--skipped .stage-label {
  color: #cbd5e1;
  font-weight: 500;
}

.dark .stage-node--skipped .stage-label {
  color: #475569;
}

/* Declined state */
.stage-node--declined .stage-dot {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
}

.stage-node--declined .stage-label {
  color: #ef4444;
  font-weight: 700;
}

/* Muted state (after decline) */
.stage-node--muted {
  cursor: default;
  opacity: 0.35;
}

.stage-node--muted:hover {
  opacity: 0.35;
}

.stage-node--muted .stage-dot {
  border-style: dashed;
}

/* Pending state */
.stage-node--pending .stage-label {
  color: var(--text-muted, #94a3b8);
}

/* Date display below dot */
.stage-date-area {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  margin-top: 0.375rem;
  height: 1.25rem;
}

/* Compact date area in card context */
.app-card .stage-date-area {
  margin-top: 0.125rem;
  height: 0.875rem;
}

.stage-date-text {
  font-size: 0.625rem;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
}

.app-card .stage-date-text {
  font-size: 0.5625rem;
}

.progress-line--detail .stage-date-text {
  font-size: 0.6875rem;
}

.stage-date-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
  border-radius: 2px;
}

.stage-node:hover .stage-date-btn {
  opacity: 1;
}

.stage-date-btn:hover {
  color: var(--accent, #2563eb);
}

.stage-date-btn .material-symbols-outlined {
  font-size: 12px;
}

.progress-line--detail .stage-date-btn {
  width: 18px;
  height: 18px;
}

.progress-line--detail .stage-date-btn .material-symbols-outlined {
  font-size: 14px;
}

/* Date picker popover */
.stage-date-picker {
  background: white;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 0.5rem;
  animation: datepicker-in 0.15s ease;
}

.dark .stage-date-picker {
  background: #1e293b;
  border-color: #334155;
}

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

.date-picker-input {
  padding: 0.5rem;
  font-size: 0.875rem;
  background: var(--bg-secondary, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.375rem;
  color: var(--text-primary, #1e293b);
  outline: none;
}

.dark .date-picker-input {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

.date-picker-input:focus {
  border-color: var(--accent, #2563eb);
}

/* App date — positioned in grid col 4, row 2 */
.app-card > .app-date {
  grid-column: 4;
  grid-row: 2;
  justify-self: end;
}

.app-date {
  font-size: 0.6875rem;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
}

/* ============================================================
   MODALS
   ============================================================ */

.app-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  z-index: 1;
}

.dark .modal-content {
  background: #1e293b;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.dark .modal-header {
  border-color: #334155;
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 0;
}

.dark .modal-header h3 {
  color: #f1f5f9;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: var(--bg-secondary, #f1f5f9);
  color: var(--text-primary, #1e293b);
}

.dark .modal-close:hover {
  background: #334155;
  color: #f1f5f9;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-context {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary, #64748b);
  margin-bottom: 1.5rem;
}

.modal-subtext {
  font-size: 0.875rem;
  color: var(--text-secondary, #64748b);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
  margin-bottom: 0.5rem;
}

.dark .form-group label {
  color: #f1f5f9;
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.875rem;
  background: var(--bg-secondary, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.5rem;
  color: var(--text-primary, #1e293b);
  transition: all 0.15s ease;
}

.dark .form-input {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border, #e2e8f0);
}

.dark .modal-footer {
  border-color: #334155;
}

.btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--accent, #2563eb);
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: var(--bg-secondary, #f1f5f9);
  color: var(--text-primary, #1e293b);
}

.dark .btn-secondary {
  background: #334155;
  color: #f1f5f9;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.dark .btn-secondary:hover {
  background: #475569;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857);
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-danger-subtle {
  background: #fef2f2;
  color: #ef4444;
  border: 1px solid #fecaca;
}

.dark .btn-danger-subtle {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border-color: #7f1d1d;
}

.btn-danger-subtle:hover {
  background: #fee2e2;
}

.dark .btn-danger-subtle:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-text {
  background: transparent;
  color: var(--accent, #2563eb);
  padding: 0.5rem;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
}

.btn-text:hover {
  background: rgba(37, 99, 235, 0.1);
}

/* ============================================================
   DETAIL MODAL
   ============================================================ */

.detail-modal {
  max-width: 720px;
}

.detail-modal .modal-header {
  justify-content: space-between;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  background: transparent;
  border: none;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-back:hover {
  color: var(--text-primary, #1e293b);
}

.dark .btn-back:hover {
  color: #f1f5f9;
}

.detail-header {
  margin-bottom: 1.5rem;
}

.detail-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 0 0 0.25rem 0;
}

.dark .detail-title {
  color: #f1f5f9;
}

.detail-company {
  font-size: 1rem;
  color: var(--text-secondary, #64748b);
  margin: 0 0 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Score Panel in Detail */
.detail-score-panel {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
}

.score-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  flex-shrink: 0;
}

.score-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  line-height: 1;
}

.score-label {
  font-size: 0.625rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-summary {
  flex: 1;
  font-size: 0.875rem;
  color: white;
  margin: 0;
  line-height: 1.5;
}

/* Pro-locked score panel */
.score-locked-panel {
  background: var(--bg-secondary, #f1f5f9);
  border: 1px dashed var(--border, #e2e8f0);
}

.dark .score-locked-panel {
  background: #0f172a;
  border-color: #334155;
}

.score-circle.locked {
  background: var(--border, #e2e8f0);
}

.dark .score-circle.locked {
  background: #334155;
}

.score-circle.locked .material-symbols-outlined {
  font-size: 1.5rem;
  color: var(--text-muted, #94a3b8);
}

.score-locked-content {
  flex: 1;
}

.score-locked-text {
  font-size: 0.875rem;
  color: var(--text-muted, #94a3b8);
  margin: 0 0 0.5rem 0;
}

.upgrade-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent, #2563eb);
  text-decoration: none;
}

.upgrade-link:hover {
  text-decoration: underline;
}

/* Detail Sections */
.detail-section {
  margin-bottom: 1.5rem;
}

.detail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.detail-section-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.dark .detail-section-title {
  color: #f1f5f9;
}

/* Collapsible toggle */
.collapsible-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
  margin-bottom: 0.75rem;
}

.collapsible-toggle:hover {
  color: var(--accent, #2563eb);
}

.toggle-icon {
  font-size: 1.25rem;
  transition: transform 0.2s ease;
}

/* Collapsible content */
.collapsible-content {
  max-height: 2000px; /* Large enough for content */
  opacity: 1;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.25s ease;
  overflow: hidden;
}

.collapsible-content.collapsed {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
}

/* Formatted text (preserves whitespace) */
.formatted-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.875rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.6;
}

.detail-description {
  font-size: 0.875rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.6;
}

/* Q&A Pairs */
.qa-pair {
  padding: 1rem;
  background: var(--bg-secondary, #f1f5f9);
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
}

.dark .qa-pair {
  background: #0f172a;
}

.qa-question {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
  margin-bottom: 0.5rem;
}

.dark .qa-question {
  color: #f1f5f9;
}

.qa-answer {
  font-size: 0.875rem;
  color: var(--text-secondary, #64748b);
}

/* Stage notes in detail modal */
.stage-note-item {
  padding: 1rem;
  background: var(--bg-secondary, #f1f5f9);
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--accent, #2563eb);
}

.dark .stage-note-item {
  background: #0f172a;
}

.stage-note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.stage-note-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
}

.dark .stage-note-label {
  color: #f1f5f9;
}

.stage-note-date {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
}

.stage-note-content {
  font-size: 0.875rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.5;
}

/* Empty state when no notes exist */
.notes-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  color: var(--text-muted, #94a3b8);
  font-size: 0.875rem;
}

.notes-empty-state .material-symbols-outlined {
  font-size: 2rem;
  opacity: 0.5;
}

.notes-empty-state p {
  margin: 0;
}

/* Detail progress toolbar — actions inline with timeline header */
.detail-progress-toolbar {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Smaller button variant for toolbar */
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-sm .material-symbols-outlined {
  font-size: 1rem;
}

/* ============================================================
   EDIT STAGES MODAL
   ============================================================ */

.edit-stages-modal .modal-body {
  padding-bottom: 0;
}

.modal-hint {
  font-size: 0.875rem;
  color: var(--text-secondary, #64748b);
  margin-bottom: 1rem;
}

.stages-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stage-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-secondary, #f1f5f9);
  border-radius: 0.5rem;
}

.dark .stage-item {
  background: #0f172a;
}

.stage-handle {
  color: var(--text-muted, #94a3b8);
  cursor: grab;
  font-size: 1.25rem;
}

.stage-input {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.875rem;
  background: white;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.375rem;
  color: var(--text-primary, #1e293b);
}

.dark .stage-input {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

.stage-input:read-only {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.btn-remove-stage {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-remove-stage:hover {
  background: #fef2f2;
  color: #ef4444;
}

.dark .btn-remove-stage:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.stage-locked {
  width: 28px;
}

.btn-add-stage {
  justify-content: flex-start;
  padding: 0.75rem;
  color: var(--accent, #2563eb);
}

/* ============================================================
   DELETE CONFIRMATION MODAL
   ============================================================ */

.delete-modal .modal-body {
  text-align: center;
}

.delete-context {
  margin: 1rem 0;
  font-size: 1rem;
}

.delete-warning {
  font-size: 0.875rem;
  color: #ef4444;
  margin-top: 1rem;
}

/* ============================================================
   ACCEPT OFFER MODAL
   ============================================================ */

.accept-offer-modal .modal-body {
  text-align: center;
  padding: 2rem 1.5rem;
}

.offer-celebration-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-radius: 50%;
  margin: 0 auto 1rem;
}

.offer-celebration-icon .material-symbols-outlined {
  font-size: 48px;
  color: white;
}

/* ============================================================
   CONGRATULATIONS OVERLAY
   ============================================================ */

.congratulations-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.congratulations-overlay.visible {
  opacity: 1;
}

.congratulations-content {
  text-align: center;
  color: white;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.congratulations-overlay.visible .congratulations-content {
  transform: scale(1);
}

.congrats-icon {
  font-size: 80px;
  color: #fbbf24;
  margin-bottom: 1rem;
  animation: bounce 0.5s ease infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.congratulations-content h2 {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 0 0 0.5rem 0;
}

.congratulations-content p {
  font-size: 1.25rem;
  opacity: 0.9;
  margin: 0;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.applications-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.applications-empty.hidden {
  display: none;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary, #f1f5f9);
  border-radius: 50%;
  margin-bottom: 1.5rem;
}

.dark .empty-state-icon {
  background: #1e293b;
}

.empty-state-icon .material-symbols-outlined {
  font-size: 40px;
  color: var(--text-muted, #94a3b8);
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 0 0 0.5rem 0;
}

.dark .empty-state-title {
  color: #f1f5f9;
}

.empty-state-description {
  font-size: 0.875rem;
  color: var(--text-secondary, #64748b);
  max-width: 300px;
  margin: 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Mid-width: hide stage labels in card, keep dots only */
@media (max-width: 1199px) {
  .app-card {
    grid-template-columns: minmax(100px, 180px) auto 1fr auto;
    column-gap: 0.5rem;
  }

  .app-card .stage-label {
    font-size: 0.5rem;
  }
}

/* Tablet and below: stack card layout vertically */
@media (max-width: 768px) {
  .applications-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-tabs {
    justify-content: center;
  }
  
  .search-box {
    min-width: auto;
  }
  
  /* Stack card into rows */
  .app-card {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    row-gap: 0.375rem;
    padding: 0.75rem;
  }
  
  .app-card-info {
    grid-column: 1;
    grid-row: 1;
  }
  
  .app-card-score {
    grid-column: 2;
    grid-row: 1;
  }
  
  .app-card > .progress-line {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 0.75rem 0 0.25rem;
  }

  .app-card > .progress-line::before {
    top: calc(0.75rem + 0.5rem + 0.25rem + 8px);
  }
  
  .app-card-actions {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-self: stretch;
    justify-content: flex-end;
  }
  
  .app-card > .app-date {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
    align-self: center;
  }
  
  .app-card .stage-label {
    font-size: 0.5rem;
  }
  
  .app-card .stage-node {
    min-width: 0;
  }
  
  /* Detail modal: bottom sheet on mobile */
  .modal-content {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
  }
  
  .detail-modal {
    max-width: none;
    margin: 0;
    border-radius: 1rem 1rem 0 0;
    max-height: 95vh;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
  }

  /* Toolbar wraps on mobile */
  .detail-toolbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .detail-progress-toolbar {
    gap: 0.375rem;
  }
}
