/* ============================================================================
   BASE — shared across both modes
   ============================================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #172B4D;
  background: #FFFFFF;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }
a { color: #0052CC; text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* ============================================================================
   MODE TOGGLE BAR — iOS-style slider design
   ============================================================================ */
.mode-toggle-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 40px;
  background: #FFFFFF;
  border-bottom: 1px solid #E4E6EA;
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 1000;
  font-size: 12px;
}

.mode-toggle-bar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
}

.mode-toggle-bar .brand-mark {
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #0052CC 0%, #6554C0 100%);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.mode-toggle-bar .brand-name {
  font-weight: 600;
  color: #172B4D;
  font-size: 13px;
  letter-spacing: -0.1px;
}

/* Slider toggle */
.mode-slider {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-slider .label {
  font-size: 12px;
  font-weight: 500;
  color: #6B778C;
  transition: color 0.2s ease;
  user-select: none;
}

.mode-slider .label.active {
  color: #172B4D;
  font-weight: 600;
}

.mode-slider-track {
  position: relative;
  width: 52px;
  height: 26px;
  background: #DFE1E6;
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.25s ease;
}

.mode-slider-track.on {
  background: linear-gradient(135deg, #0052CC 0%, #6554C0 100%);
}

.mode-slider-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(9, 30, 66, 0.2);
  transition: transform 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.mode-slider-track.on .mode-slider-thumb {
  transform: translateX(26px);
}

/* Push content below the mode bar */
.app-container { padding-top: 40px; }

/* ============================================================================
   AVATAR
   ============================================================================ */
.avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: -0.3px;
}

/* ============================================================================
   TOAST
   ============================================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #172B4D;
  color: white;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(9, 30, 66, 0.3);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
  z-index: 9999;
  max-width: 480px;
  pointer-events: none;
}
.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.toast-success { background: #006644; }
.toast-warning { background: #974F0C; }
.toast-error { background: #BF2600; }

/* ============================================================================
   MODAL
   ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 30, 66, 0.54);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: white;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(9, 30, 66, 0.22);
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 100px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
}

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

/* ============================================================================
   AI TRANSPARENCY DRAWER (shared pattern)
   ============================================================================ */

.ai-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #F4F1FA;
  color: #5E4DB2;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}
.ai-tag:hover {
  background: #EAE6FF;
  border-color: #C9C2EC;
}
.ai-tag.warning {
  background: #FFF4E0;
  color: #8F5A0E;
}
.ai-tag.warning:hover {
  background: #FFEACC;
  border-color: #E6CFA8;
}
.ai-tag .chevron {
  transition: transform 0.15s ease;
  font-size: 9px;
  opacity: 0.7;
}
.ai-tag.expanded .chevron {
  transform: rotate(180deg);
}

.ai-drawer {
  background: #F8F7FB;
  border: 1px solid #E4E0EE;
  border-radius: 6px;
  padding: 12px 14px;
  margin-top: 8px;
  font-size: 12px;
  color: #42526E;
  animation: drawerSlide 0.2s ease;
  display: none;
}
.ai-drawer.expanded { display: block; }

@keyframes drawerSlide {
  from { opacity: 0; transform: translateY(-4px); max-height: 0; }
  to { opacity: 1; transform: translateY(0); max-height: 500px; }
}

.ai-drawer-section {
  margin-bottom: 10px;
}
.ai-drawer-section:last-child { margin-bottom: 0; }

.ai-drawer-label {
  font-size: 10px;
  font-weight: 600;
  color: #6B778C;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.ai-drawer-content {
  font-size: 12px;
  color: #172B4D;
  line-height: 1.5;
}

.ai-drawer-signals {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-drawer-signal {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: #42526E;
}
.ai-drawer-signal::before {
  content: '•';
  color: #6554C0;
  font-weight: 700;
  margin-top: -1px;
}

.ai-drawer-confidence {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.ai-drawer-confidence-bar {
  flex: 1;
  height: 4px;
  background: #DFE1E6;
  border-radius: 2px;
  overflow: hidden;
}

.ai-drawer-confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, #36B37E 0%, #0052CC 100%);
  border-radius: 2px;
}

.ai-drawer-confidence-fill.low {
  background: linear-gradient(90deg, #DE350B 0%, #FFAB00 100%);
}

.ai-drawer-confidence-value {
  font-size: 11px;
  font-weight: 600;
  color: #172B4D;
  min-width: 32px;
  text-align: right;
}

.ai-drawer-feedback {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #E4E0EE;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #6B778C;
}

.ai-drawer-feedback button {
  font-size: 11px;
  padding: 3px 10px;
  background: white;
  border: 1px solid #DFE1E6;
  border-radius: 12px;
  color: #42526E;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.1s;
}
.ai-drawer-feedback button:hover {
  background: #F4F5F7;
  border-color: #C1C7D0;
}

/* ============================================================================
   COMMON
   ============================================================================ */
.clickable { cursor: pointer; transition: background 0.1s ease; }
.clickable:hover { background: #F4F5F7; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C1C7D0; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #A5ADBA; }

/* Smooth fade-in for content swaps */
.content-fade {
  animation: contentFade 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
}
@keyframes contentFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
