/* ===========================
   Symptom Checker – Minimal UI (Theme: #4f8cff + #e7e7ea)
   Matches your HTML + JS behavior exactly
   =========================== */

/* ---- Theme variables ---- */
:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #111318;
  --muted: #667085;
  --primary: #5C8ABB;
  /* --primary: #4f8cff; */
  /* your blue */
  --primary-contrast: #e7e7ea;
  /* your light tone */
  --line: #e7e7ea;
  --bot: #f3f6ff;
  --user: #eef9f3;
  --danger: #b91c1c;
  --shadow: 0 8px 24px rgba(16, 24, 40, .06);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  /* Voice Mode UI */
  --amp: 0.18;
}

/* Base */
html,
body {
  min-height: 100%;
  background: var(--bg);
}

.main-wrapper {
  display: flex;
  flex-direction: column;
}

#main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.user_dashboard {
  background: var(--bg);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(16px, 3vw, 36px) 0 48px;
}

h1,
h2,
h3 {
  color: var(--text);
}

.toggle-switch:hover input:checked+.slider .slider-avatar {
  transform: translateX(60px) scale(1.05);
}

.col-xl-9>div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(16px, 3vw, 28px);
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.disclaimer {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: .95rem;
  text-align: left;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Loading Container */
#loading-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.loading-content {
  text-align: center;
  padding: 20px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--line);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

.loading-text {
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
}

/* Progress bar above chat */
.ai-progress-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 16px;
}

.ai-progress-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.ai-progress-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}

.ai-progress-bar-track {
  position: relative;
  flex: 1;
  height: 16px;
  border-radius: 999px;
  background: var(--primary-contrast);
  overflow: hidden;
}

.ai-progress-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.3s ease;
}

.ai-progress-percentage {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  min-width: 40px;
  text-align: right;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* =========================================
   1) START STAGE — shown first
   ========================================= */
#stage-start {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Labels + inputs */
#stage-start label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  color: var(--text);
  font-size: .95rem;
  width: 100%;
  max-width: 188px;
}

/* Exclude gender label and gender options from max-width constraint */
#stage-start label#gender-label,
#stage-start label.form-label:not(.gender-option) {
  max-width: none;
  width: auto;
  text-align: center;
}

/* Ensure gender option labels don't inherit max-width but keep card width */
#stage-start .gender-option {
  max-width: 188px;
  width: 188px;
  flex-shrink: 0;
}

#stage-start select,
#stage-start input[type="number"] {
  appearance: none;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: .95rem;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

#stage-start select:focus,
#stage-start input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 140, 255, .18);
  background: var(--primary-contrast);
}

/* Gender Selection Styles */
.gender-selection {
  margin-top: 8px;
}

.gender-options {
  display: flex;
  gap: 12px;
  /* flex-wrap: wrap; */
}

.gender-option {
  position: relative;
  cursor: pointer;
  margin: 0 !important;
  flex-direction: row !important;
  gap: 0 !important;
}

.gender-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gender-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  border: 2px solid #E5E7EB;
  border-radius: var(--radius-md);
  background: transparent;
  transition: all 0.2s ease;
  width: 188px;
  min-width: 188px;
  max-width: 188px;
  min-height: 138px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.gender-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 1;
}

.gender-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  margin-bottom: 0px;
  position: relative;
  z-index: 2;
  transition: filter 0.2s ease;
}

.gender-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  position: relative;
  z-index: 2;
  transition: color 0.2s ease;
  margin-top: 10px;
}

/* Selected state */
.gender-option input[type="radio"]:checked+.gender-card {
  border-color: var(--primary);
  background: #FAF5FF;
}

.info-dot {
  position: absolute;
  left: 10px;
  top: 10px;
}

.icon-bg {
  border-radius: 33554400px;
  background: rgba(47, 139, 255, 0.10);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gender-option input[type="radio"]:checked+.gender-card::before {
  opacity: 0.1;
}

.gender-option input[type="radio"]:checked+.gender-card .gender-label {
  color: var(--primary);
  font-weight: 700;
}

/* Hover state */
.gender-option:hover .gender-card {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 140, 255, .15);
}

.gender-option:hover .gender-card::before {
  opacity: 0.05;
}

/* Focus state for accessibility */
/* .gender-option input[type="radio"]:focus+.gender-card {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
} */

/* Accessibility improvements */
.gender-selection small {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;


}

/* Enhanced focus states for better accessibility */
/* .gender-option input[type="radio"]:focus+.gender-card {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(79, 140, 255, .2);
} */

/* Active state for better touch feedback */
.gender-option:active .gender-card {
  transform: translateY(0) scale(0.98);
}

/* Start button */
#btnStart {
  align-self: end;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform .06s ease, filter .2s ease, opacity .2s ease;
}

#btnStart:hover {
  filter: brightness(1.05);
}

#btnStart:active {
  transform: translateY(1px) scale(.99);
}

/* PDF Download Button */
.pdf-download {
  margin: 16px 0;
  text-align: center;
}

.btn-download {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.btn-download:hover {
  background: #3d7bff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 140, 255, .3);
}

.btn-download:active {
  transform: translateY(0);
}

/* ========================================
   Summary Options - Clinical Design
   ======================================== */
.summary-options {
  margin: 12px 0;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.summary-card {
  background: #f8fafb;
  border: 1px solid #e8eef3;
  border-radius: 12px;
  padding: 14px 16px;
}

.summary-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e8eef3;
}

.summary-icon-check {
  color: #10b981;
  flex-shrink: 0;
}

.summary-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e3a5f;
}

.summary-subtitle {
  font-size: 0.8rem;
  color: #7c9ab6;
  font-weight: 400;
}

.summary-actions {
  display: flex;
  gap: 10px;
}

.summary-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.summary-btn svg {
  flex-shrink: 0;
  max-width: 30px;
  max-height: 30px;
}

.summary-btn-primary {
  border-radius: 10px;
  border: 1px solid #5C8ABB;
  background: #FFF;
}

.summary-btn-primary-text-container {
  display: flex;
  flex-direction: column;
}

span.summary-btn-primary-text {
  text-align: center;
  font-family: Urbanist;
  font-size: 22px;
  font-style: normal;
  font-weight: 700;
  line-height: 28px;
}

span.summary-btn-secondary-text {
  text-align: center;
  font-family: Urbanist;
  font-size: 16px;
  font-style: normal;
  font-weight: 600;
  line-height: 30px;
}

.summary-btn-primary:hover {
  background: #d4e9ff;
  border-color: #a8cff0;
}

.summary-btn-primary:active {
  background: #c5e0fc;
}

.summary-btn-secondary {
  border-radius: 10px;
  border: 1px solid #5C8ABB;
  background: #5C8ABB;
  color: #FFF;
}

.summary-btn-secondary:hover {
  background: #507ba9;
  border-color: #5C8ABB;
  color: #FFF;
}

.summary-btn-secondary:active {
  background: #eef4f8;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .summary-card {
    padding: 12px;
  }

  .summary-header {
    flex-wrap: wrap;
    gap: 4px;
  }

  .summary-subtitle {
    width: 100%;
    padding-left: 26px;
    margin-top: -2px;
  }

  .summary-actions {
    flex-direction: column;
    gap: 8px;
  }
}

/* --- Graceful inline validation (no JS needed) --- */
/* #stage-start:has(input[type="number"]:invalid),
#stage-start:has(input[type="number"]:out-of-range) {
  box-shadow: 0 0 0 3px rgba(185, 28, 28, .12) inset;
} */

#stage-start:has(input[type="number"]:invalid) #btnStart,
#stage-start:has(input[type="number"]:out-of-range) #btnStart {
  opacity: .6;
  pointer-events: none;
}

#stage-start::after {
  content: "";
  display: none;
}

#stage-start:has(input[type="number"]) .error,
#stage-start:has(input[type="number"]) .error {
  display: none;
  font-size: 14px;
  color: #b91c1c;
}

#stage-start:has(input[type="number"]:invalid) .error,
#stage-start:has(input[type="number"]:out-of-range) .error {
  /* content: "Please provide a valid age between 1 and 119.";
  display: block;
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: color-mix(in srgb, var(--danger) 90%, black);
  border-radius: 10px;
  font-size: .9rem; */
  display: block;
}


#stage-start:has(input[type="number"]:invalid) input,
#stage-start:has(input[type="number"]:out-of-range) input {
  border: 1px solid #b91c1c !important;
  box-shadow: none;
}

/* =========================================
   2) CHAT — appears only after Start
   Wrap chat and composer in #chat-wrapper and keep it hidden initially
   ========================================= */
#chat-wrapper.hidden {
  display: none;
}

#track-progress {
  position: relative;
  margin: 0 auto 32px;
  width: 100%;
  max-width: 1100px;
}

#chat-wrapper {
  /* max-width: 800px; */
  margin: 0 auto 32px;
  width: 100%;
  max-width: 1100px;
  padding: clamp(12px, 2vw, 20px) !important;
  background-color: rgba(255, 255, 255, 0.4);
  border: 1px solid #D7D7D7;
  border-radius: 20px;
  overflow: hidden;
  /* Mobile improvements */
  min-height: 0;
  box-sizing: border-box;
}

/* Chat Header */
#chat-header {
  position: sticky;
  top: 0;
  z-index: 8;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
  /* transition: all 0.3s ease; */
  animation: fadeIn .18s ease;

  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 100px;
  padding: 3px 6px;
  height: fit-content;
  min-height: 60px;
  background-color: #F3F3FF;
  margin-bottom: 10px;
}

#chat-wrapper.ai-active #chat {
  height: min(72vh, 500px);
  margin-top: 0;
}

.login-btn {
  background: #4D6F94 !important;
  color: #fff;
  padding: 0 28px;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.5s ease-in-out;
  border: 1px solid #4D6F94;
  overflow: hidden;
  position: relative;
  height: 50px;
  line-height: 50px;
  border-radius: 28px;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.login-btn:hover {
  background: transparent !important;
  color: #4D6F94;
}

.ai-name-container {
  border-radius: 70px;
  border: 1px solid #F4F4F4;
  background: #FFF;
  padding: 6px 7px;
  display: flex;
  align-items: center;
  gap: 23px;
  min-width: 155px;
}

.ai-name {
  font-size: 18px;
  font-weight: 600;
  color: #000;
}

#ai-icon {
  border-radius: 9999px;
  background: #FFF;
  box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.09);
  padding: 8px;
}

/* Active state - with background image and centered passport-size avatar */
#chat-header.ai-active {
  background: transparent;
  box-shadow: none;
  /* background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(79,140,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>'); */
  /* background-size: 20px 20px;
  min-height: 140px; */
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  width: 100%;
  height: 100%;
}

.toggle-section {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Replay Audio Button */
.replay-audio-btn {
  background: #FFF;
  border: 1px solid #F4F4F4;
  border-radius: 50%;
  width: 49px;
  height: 49px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.05);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.replay-audio-btn img {
  width: 24px;
  height: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
}

/* Hover effects */
.replay-audio-btn:hover {
  background: linear-gradient(135deg, #5C8ABB, #6A8EAD);
  /* box-shadow: 0 6px 20px 0 rgba(92, 138, 187, 0.3);
  transform: translateY(-2px); */
}

.replay-audio-btn:hover img {
  filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%) hue-rotate(93deg) brightness(103%) contrast(103%);
  /* transform: scale(1.1); */
}

/* Active state */
.replay-audio-btn:active {
  /* transform: translateY(0) scale(0.95); */
  box-shadow: 0 2px 8px 0 rgba(92, 138, 187, 0.4);
}

/* Focus states for accessibility */
.replay-audio-btn:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Disabled state */
.replay-audio-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.replay-audio-btn:disabled:hover {
  background: #FFF;
  box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.05);
  transform: none;
}

.replay-audio-btn:disabled:hover img {
  filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
  transform: none;
}

/* Start New Interview Button */
.start-new-interview-btn {
  background: #FFF;
  border: 1px solid #F4F4F4;
  border-radius: 24px;
  padding: 8px 16px;
  min-width: 60px;
  height: 49px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.05);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.start-new-interview-btn span {
  font-size: 14px;
  font-weight: 500;
  color: #5C8ABB;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

/* Hover effects */
.start-new-interview-btn:hover {
  background: linear-gradient(135deg, #5C8ABB, #6A8EAD);
}

.start-new-interview-btn:hover span {
  color: #FFFFFF;
}

/* Active state */
.start-new-interview-btn:active {
  box-shadow: 0 2px 8px 0 rgba(92, 138, 187, 0.4);
}

/* Focus states for accessibility */
.start-new-interview-btn:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Toggle Switch with Profile Picture Inside Slider */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 110px;
  height: 49px;
  cursor: pointer;
  /* Mobile touch improvements */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--White, #FFF);
  box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 60px;
  display: flex;
  align-items: center;
  padding: 4px;
}

.slider-avatar {
  width: 39px;
  height: 39px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #fff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: #5c8abb;
}

/* Active state */
input:checked+.slider {
  background: linear-gradient(135deg, #5C8ABB, #6A8EAD);
  box-shadow: inset 0 2px 4px rgba(79, 140, 255, 0.3);
}

input:checked+.slider .slider-avatar {
  transform: translateX(60px);
  box-shadow: 0 2px 8px rgba(248, 248, 248, 0.3), 0 1px 3px rgba(252, 252, 252, 0.2);
}

/* Hover effects */
.toggle-switch:hover .slider {
  box-shadow: inset 0 2px 6px rgba(79, 140, 255, 0.4);
}

.toggle-switch:hover input:checked+.slider {
  box-shadow: inset 0 2px 6px rgba(79, 140, 255, 0.4);
}

.toggle-switch:hover .slider-avatar {
  transform: scale(1.05);
}

/* Focus states for accessibility */
.toggle-switch input:focus+.slider {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Active state animation */
.toggle-switch:active {
  transform: scale(0.98);
}

/* AI Avatar - Two different states */
#avatar-container {
  /* position: absolute; */
  /* transition: all 0.3s ease; */
  /* Initial state - small avatar in left corner */
  /* left: 0;
  top: 50%;
  transform: translateY(-50%); */
  opacity: 1;
}

/* Inactive state - small avatar in left corner */
#avatar-container.avatar-hidden {
  left: 0;
  top: 50%;
  /* transform: translateY(-50%); */
  opacity: 0;
}

/* Active state - larger avatar in center */
#avatar-container.avatar-visible {
  /* left: 50%;
  top: 50%;
  transform: translate(-50%, -50%); */
  opacity: 1;
}

/* .ai-avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(79, 140, 255, 0.3);
  transition: all 0.3s ease;
  background: linear-gradient(135deg, var(--primary), #3b7de8);
  overflow: hidden;
} */
#btnCancel,
#btnUpdate {
  cursor: pointer;
  outline: none;
  border: none;
  transition: transform .06s ease, filter .2s ease;
  height: 35px;
  width: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: linear-gradient(90deg, #5C8ABB 0%, #6A8EAD 100%);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.10), 0 4px 6px -4px rgba(0, 0, 0, 0.10);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

#avatar-container {
  /* background-image: url(../interviews/images/chat-banner.png); */
  /* background-size: cover; */
  /* background-image: url(../interviews/images/chat-banner.png); */
  background-size: cover;
  max-width: 100%;
  max-height: 300px;
  overflow: hidden;
  width: 100%;
  background-position: center;
  background-repeat: no-repeat;
  border-top-right-radius: 12px;
  border-top-left-radius: 12px;
  position: absolute;
  top: 0px;
  left: 0;
  right: 0;
  max-width: 100%;
  z-index: 1;
  width: 100%;
  animation: fadeIn .18s ease;
  background: #dde8ff;
}

#ai-avatar-canvas {
  border-radius: 50%;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bg-animation {
  width: 100% !important;
  height: 396px !important;
  position: absolute;
  bottom: 0;
}

/* Initial state - avatar image should be small when audio is off */
/* #ai-avatar-image {
  width: 32px;
  height: 32px;
} */

/* Small avatar for inactive state */
#avatar-container.avatar-hidden .ai-avatar {
  width: 32px;
  height: 32px;
}

#avatar-container.avatar-hidden .ai-avatar #ai-avatar-canvas {
  width: 32px;
  height: 32px;
}

/* Larger avatar for active state */
#avatar-container .ai-avatar {
  width: clamp(160px, 60vw, 420px);
  height: clamp(160px, 60vw, 420px);
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#avatar-container .ai-avatar #ai-avatar-canvas {
  width: 100% !important;
  height: 100% !important;
}

#avatar-container.avatar-visible .ai-avatar {
  width: clamp(220px, 65vw, 460px);
  height: clamp(220px, 65vw, 460px);
}

#avatar-container.avatar-visible .ai-avatar #ai-avatar-canvas {
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 768px) {
  #avatar-container {
    position: relative;
    /* max-height: none;
    min-height: 220px; */
  }

  #avatar-container .ai-avatar {
    width: clamp(180px, 70vw, 360px);
    height: clamp(180px, 70vw, 360px);
  }
}

@media (max-width: 480px) {
  #avatar-container {
    min-height: 180px;
    padding: 24px 12px;
    border-top-right-radius: 0;
    border-top-left-radius: 0;
  }

  #avatar-container.avatar-hidden {
    display: none;
  }

  #avatar-container .ai-avatar {
    width: min(90vw, 280px);
    height: min(90vw, 280px);
  }
}

/* .ai-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(79, 140, 255, 0.4);
} */
.back-btn {
  min-width: 155px;
  background-color: #fff;
  cursor: pointer;
  transition: all .3s;
}

.back-btn:hover {
  background-color: #5C8ABB;
}

.back-btn:hover .back-text {
  color: #fff;
}

.back-text {
  color: var(--primary);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
}

/* Chat area: pure white background */
#chat {
  /* max-width: 65%;
  margin: auto; */
  height: clamp(440px, 70vh, 780px);
  /* max-height: calc(100vh - 240px); */
  height: min(72vh, 500px);
  overflow: auto;
  /* padding: 12px 10px 16px; */
  /* border: 1px solid var(--line); */
  /* border-top: none; */
  /* border-radius: 0 0 var(--radius-md) var(--radius-md); */
  background: rgb(250 250 253);
  /* pure white – no gradient */
  scroll-behavior: smooth;
  /* Mobile scrolling improvements */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Scrollbar */
#chat::-webkit-scrollbar {
  width: 10px;
}

#chat::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(79, 140, 255, .5), rgba(79, 140, 255, .22));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Messages */
.msg {
  display: flex;
  margin: 10px 6px;
  gap: 10px;
  animation: fadeIn .18s ease;
}

.msg.user {
  justify-content: flex-end;
}

.msg.bot {
  justify-content: flex-start;
}

.bubble {
  max-width: min(75ch, 90%);
  padding: 8px 12px;
  border-radius: 16px;
  font-size: .98rem;
  line-height: 1.45;
  border: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(16, 24, 40, .05);
  color: var(--text);
  background: var(--primary-contrast);
  display: flex;
  gap: 4px;
  transition: all 0.3s ease;
}

.msg.user .bubble {
  text-align: right;
  border-radius: 10px 10px 0 10px;
  background: rgba(47, 139, 255, 0.14);
  color: #6A8EAD;
  border: none;
  position: relative;
  padding-right: 12px;
}

.msg.user .bubble:has(.btneditmsg) {
  padding-right: 50px;
}

.msg.bot .bubble {
  background: var(--primary);
  color: #fff;
  border-radius: 10px 10px 10px 0;
  text-align: left;
}

.msg.bot .bubble small em {
  color: #fff;
}

.bubble small em {
  color: var(--muted);
}

/* Choice chips */
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 6px 10px;
  margin: 4px 6px 10px;
}

.choice {
  border: 1px solid var(--line);
  background: var(--card);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: .95rem;
  min-width: 45px;
  height: 45px;
  transition: border-color .15s ease, transform .06s ease, background .15s ease, color .15s ease;
  /* Mobile touch improvements */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  min-height: 44px;
  /* Minimum touch target size */
  display: flex;
  align-items: center;
  justify-content: center;
}

.choice:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.choice:active {
  transform: translateY(1px);
}

/* Message Suggestion Chips */
#suggestion-chips-container {
  position: sticky;
  bottom: 0;
  margin-top: 12px;
  margin-bottom: 8px;
  padding: 0 10px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE and Edge */
}

#suggestion-chips-container::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari, Opera */
}

#suggestion-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  padding: 8px 0;
  overflow-x: auto;
  width: auto;
}

.suggestion-chip {
  background-color: #5C8ABB;
  color: #FFFFFF;
  border: none;
  border-radius: 20px;
  padding: 8px 10px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  outline: none;
}

.suggestion-chip:hover {
  background-color: #4a7ba8;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(92, 138, 187, 0.3);
}

.suggestion-chip:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(92, 138, 187, 0.2);
}

/* Composer (chat input + send) */
#composer {
  /* max-width: 65%;
  margin: auto; */
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
  padding: 10px;
  background: #ffffff;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 5px 30px 0 rgba(0, 0, 0, 0.10);
  /* white to match chat */
  /* Mobile touch improvements */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#composer input#userText {
  width: 100%;
  padding: 0px 3px;
  border: none;
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
  /* Mobile improvements */
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#composer input#userText::placeholder {
  color: var(--muted);
}

#composer input#userText:focus {
  border-color: none;
  box-shadow: none;
  background: #fff;
}

/* Glow effect when editing chat message */
#composer.editing-mode {
  box-shadow: 0 5px 30px 0 rgba(0, 0, 0, 0.10), 0 0 20px 5px rgb(0 255 245 / 35%);
  animation: editingGlow 2s ease-in-out infinite;
}

@keyframes editingGlow {

  0%,
  100% {
    box-shadow: 0 5px 30px 0 rgba(0, 0, 0, 0.10), 0 0 20px 5px rgb(0 255 245 / 35%);
  }

  50% {
    box-shadow: 0 5px 30px 0 rgba(0, 0, 0, 0.10), 0 0 30px 8px rgb(0 255 245 / 60%);
  }
}

/* Send button */
#btnedit {
  cursor: pointer;
  outline: none;
  border: none;
  transition: transform .06s ease, filter .2s ease;
  height: 35px;
  width: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: linear-gradient(90deg, #5C8ABB 0%, #6A8EAD 100%);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.10), 0 4px 6px -4px rgba(0, 0, 0, 0.10);
  /* Mobile touch improvements */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.btn-common {
  cursor: pointer;
  outline: none;
  border: none;
  transition: transform .06s ease, filter .2s ease;
  height: 35px;
  width: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: linear-gradient(90deg, #5C8ABB 0%, #6A8EAD 100%);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.10), 0 4px 6px -4px rgba(0, 0, 0, 0.10);
  /* Mobile touch improvements */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.btn-common:hover {
  filter: brightness(1.05);
}

.btn-common:active {
  transform: scale(.98);
}

/* Upload Trigger Button */
.upload-trigger-btn {
  cursor: pointer;
  outline: none;
  border: none;
  transition: transform .06s ease, filter .2s ease;
  height: 35px;
  width: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: linear-gradient(90deg, #f8fafc 0%, #e2e8f0 100%);
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  /* Mobile touch improvements */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.upload-trigger-btn:hover {
  background: linear-gradient(90deg, #f0f4ff 0%, #e6f0ff 100%);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(79, 140, 255, 0.15);
}

.upload-trigger-btn:active {
  transform: scale(.98);
}

.upload-trigger-btn img {
  width: 18px;
  height: 18px;
  transition: all 0.2s ease;
  filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
}

.upload-trigger-btn:hover img {
  filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
  transform: scale(1.1);
}

/* #btnSend::after {
  content: "➤";
  font-size: 1.15rem;
  line-height: 1;
  margin-left: 2px;
} */

/* PDF download */
.pdf-download {
  display: flex;
  justify-content: center;
  margin: 10px 0 0;
}

/* Breadcrumb polish */
.page-title-wrap {
  background: linear-gradient(180deg, rgba(79, 140, 255, .07), transparent);
}

.page-title-wrap .nav li {
  color: var(--muted);
}

.page-title-wrap .nav a {
  color: var(--primary);
  text-decoration: none;
}

/* A11y focus */
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(79, 140, 255, .45);
  outline-offset: 2px;
}

/* Error look if you tag a bubble with .error / .api-error */
.msg.bot .bubble:is(.error, .api-error) {
  border-color: color-mix(in srgb, var(--danger) 50%, var(--line));
  background: color-mix(in srgb, var(--danger) 10%, #fff);
  color: color-mix(in srgb, var(--danger) 85%, #000);
  font-weight: 600;
}

/* Animations & responsive */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(2px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: min(75ch, 90%);
  padding: 12px 14px;
  border-radius: 16px;
  font-size: .98rem;
  line-height: 1.45;
}

.loader {
  animation: rotate 1s infinite;
  height: 25px;
  /* scaled from 50px */
  width: 25px;
}

.loader:before,
.loader:after {
  border-radius: 50%;
  content: "";
  display: block;
  height: 10px;
  /* scaled from 20px */
  width: 10px;
}

.loader:before {
  animation: ball1 1s infinite;
  background-color: #fff;
  box-shadow: 15px 0 0 #4f8cff;
  /* scaled from 30px */
  margin-bottom: 5px;
  /* scaled from 10px */
}

.loader:after {
  animation: ball2 1s infinite;
  background-color: #4f8cff;
  box-shadow: 15px 0 0 #fff;
  /* scaled from 30px */
}

.ai-active #chat {
  padding-top: 230px;
}

@keyframes rotate {
  0% {
    transform: rotate(0deg) scale(0.8)
  }

  50% {
    transform: rotate(360deg) scale(1.2)
  }

  100% {
    transform: rotate(720deg) scale(0.8)
  }
}

@keyframes ball1 {
  0% {
    box-shadow: 15px 0 0 #4f8cff;
  }

  50% {
    box-shadow: 0 0 0 #4f8cff;
    margin-bottom: 0;
    transform: translate(7.5px, 7.5px);
    /* scaled from 15px */
  }

  100% {
    box-shadow: 15px 0 0 #4f8cff;
    margin-bottom: 5px;
  }
}

@keyframes ball2 {
  0% {
    box-shadow: 15px 0 0 #fff;
  }

  50% {
    box-shadow: 0 0 0 #fff;
    margin-top: -10px;
    /* scaled from -20px */
    transform: translate(7.5px, 7.5px);
  }

  100% {
    box-shadow: 15px 0 0 #fff;
    margin-top: 0;
  }
}

/* =========================================
   ALL MEDIA QUERIES - MOVED TO END OF FILE
   ========================================= */

/* High contrast mode support */
@media (prefers-contrast: high) {
  .gender-card {
    border-width: 3px;
  }

  .gender-option input[type="radio"]:checked+.gender-card {
    border-width: 3px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

  .gender-card,
  .gender-card::before,
  .gender-icon,
  .gender-label {
    transition: none;
  }

  .gender-option:hover .gender-card {
    transform: none;
  }
}

/* Reduced motion support - general */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Landscape mobile base adjustments */
@media (max-width: 768px) and (orientation: landscape) {
  .user_dashboard {
    align-items: flex-start;
    padding-top: 10px;
  }
}

/* Responsive adjustments - Gender Selection */
@media (max-width: 768px) {
  .gender-options {
    justify-content: center;
    gap: 8px;
  }

  .gender-card {
    min-width: 80px;
    padding: 12px 16px;
  }

  .gender-icon {
    width: 28px;
    height: 28px;
  }

  .gender-label {
    font-size: 0.85rem;
  }

  .gender-selection small {
    font-size: 0.75rem;
    text-align: center;
  }

  .ai-active #chat {
    padding-top: 0px;
  }
}

@media (max-width: 480px) {
  .gender-options {
    align-items: center;
    gap: 12px;
  }

  .gender-card {
    min-width: 120px;
    padding: 16px 20px;
  }
}

/* General responsive breakpoints */
@media (max-width: 1400px) {
  #chat-wrapper.ai-active #chat {
    height: min(74vh, 560px);
    margin-top: 0;
  }
}

@media (max-width: 1279px) {
  #chat-wrapper.ai-active #chat {
    height: min(76vh, 580px);
    margin-top: 0;
  }
}

@media (max-width: 991.98px) {
  #stage-start {
    grid-template-columns: 1fr;
  }

  #chat {
    height: min(65vh, 560px);
  }

  #chat-wrapper.ai-active #chat {
    height: min(60vh, 500px);
    margin-top: 0;
  }

  .user_dashboard {
    padding: clamp(16px, 3vw, 36px) 0 16px !important;
  }
}

/* Mobile Responsiveness - Enhanced */
@media (max-width: 768px) {
  #chat-wrapper {
    padding: 10px !important;
    margin: 0 5px;
    border-radius: 15px;
  }

  #chat-header {
    padding: 8px 12px;
    min-height: 50px;
    border-radius: 25px;
    margin-bottom: 8px;
  }

  .header-content {
    gap: 8px;
  }

  .ai-name-container {
    min-width: 120px;
    padding: 4px 6px;
    gap: 12px;
  }

  .ai-name {
    font-size: 16px;
  }

  #ai-icon {
    padding: 6px;
  }

  /* Replay button mobile adjustments */
  .replay-audio-btn {
    width: 42px;
    height: 42px;
  }

  .replay-audio-btn img {
    width: 20px;
    height: 20px;
  }

  /* Start new interview button mobile adjustments */
  .start-new-interview-btn {
    min-width: 50px;
    height: 34px;
    padding: 6px 12px;
  }

  .start-new-interview-btn span {
    font-size: 12px;
  }

  .toggle-section {
    gap: 8px;
  }

  .toggle-switch {
    width: 80px;
    height: 40px;
  }

  .slider-avatar {
    width: 32px;
    height: 32px;
  }

  input:checked+.slider .slider-avatar {
    transform: translateX(38px);
  }

  #chat {
    height: min(50vh, 400px);
    padding: 8px;
  }

  #chat-wrapper.ai-active #chat {
    height: min(50vh, 320px);
    /* margin-top: calc(50vh - 280px); */
  }

  .msg {
    margin: 8px 4px;
    gap: 8px;
  }

  .bubble {
    max-width: 85%;
    padding: 10px 12px;
    font-size: 0.95rem;
  }

  #composer {
    padding: 8px;
    gap: 8px;
    margin-top: 8px;
  }

  .upload-trigger-btn {
    height: 40px;
    width: 40px;
  }

  .upload-trigger-btn img {
    width: 20px;
    height: 20px;
  }

  #composer input#userText {
    font-size: 0.95rem;
    padding: 8px 12px;
  }

  .btn-common {
    height: 40px;
    width: 40px;
  }
}

@media (max-width: 575.98px) {
  .col-xl-9>div {
    padding: 12px;
  }

  #chat-wrapper {
    padding: 8px !important;
    margin: 0 2px;
    border-radius: 12px;
  }

  #chat-header {
    padding: 6px 10px;
    min-height: 45px;
    border-radius: 20px;
    margin-bottom: 6px;
  }

  .ai-name-container {
    min-width: 100px;
    padding: 3px 5px;
    gap: 8px;
  }

  .ai-name {
    font-size: 14px;
  }

  #ai-icon {
    padding: 4px;
  }

  .toggle-switch {
    width: 70px;
    height: 36px;
  }

  .slider-avatar {
    width: 28px;
    height: 28px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  input:checked+.slider .slider-avatar {
    transform: translateX(34px);
  }

  .toggle-switch:hover input:checked+.slider .slider-avatar {
    transform: translateX(34px) scale(1.05);
  }

  #chat {
    height: min(45vh, 350px);
    padding: 6px;
  }

  #chat-wrapper.ai-active #chat {
    height: min(40vh, 280px);
    margin-top: calc(40vh - 290px);
  }

  .msg {
    margin: 6px 3px;
    gap: 6px;
  }

  .bubble {
    max-width: 90%;
    padding: 8px 10px;
    font-size: 0.9rem;
    line-height: 1.4;
  }

  .choices {
    gap: 6px;
    padding: 4px 4px 8px;
    margin: 2px 3px 8px;
  }

  .choice {
    padding: 6px 10px;
    font-size: 0.9rem;
  }

  #composer {
    padding: 6px;
    gap: 6px;
    margin-top: 6px;
    border-radius: 8px;
  }

  #composer input#userText {
    font-size: 0.9rem;
    padding: 6px 10px;
  }

  .btn-common,
  #btnCancel,
  #btnUpdate,
  #btnedit {
    height: 36px;
    width: 36px;
  }

  .back-btn {
    min-width: 120px;
    padding: 4px 8px;
  }

  .back-text {
    font-size: 14px;
  }

  /* Replay button very small mobile adjustments */
  .replay-audio-btn {
    width: 38px;
    height: 38px;
  }

  .replay-audio-btn img {
    width: 18px;
    height: 18px;
  }

  .start-new-interview-btn {
    min-width: 45px;
    height: 30px;
    padding: 5px 10px;
  }

  .start-new-interview-btn span {
    font-size: 11px;
  }

  .toggle-section {
    gap: 6px;
  }
}

@media (max-width: 480px) {
  #chat-wrapper {
    padding: 6px !important;
    margin: 0 1px;
    border-radius: 10px;
  }

  #chat-header {
    padding: 4px 8px;
    min-height: 40px;
    border-radius: 15px;
    margin-bottom: 4px;
  }

  .ai-name-container {
    min-width: 90px;
    padding: 2px 4px;
    gap: 6px;
  }

  .ai-name {
    font-size: 13px;
  }

  #ai-icon {
    padding: 3px;
  }

  .toggle-switch {
    width: 60px;
    height: 32px;
  }

  .slider-avatar {
    width: 24px;
    height: 24px;
  }

  input:checked+.slider .slider-avatar {
    transform: translateX(28px);
  }

  #chat {
    height: min(40vh, 300px);
    padding: 4px;
  }

  #chat-wrapper.ai-active #chat {
    height: min(35vh, 250px);
    margin-top: 0;
  }

  .msg {
    margin: 4px 2px;
    gap: 4px;
  }

  .bubble {
    max-width: 92%;
    padding: 6px 8px;
    font-size: 0.85rem;
    line-height: 1.35;
  }

  .choices {
    gap: 4px;
    padding: 3px 3px 6px;
    margin: 1px 2px 6px;
  }

  .choice {
    padding: 4px 8px;
    font-size: 0.85rem;
  }

  #composer {
    padding: 4px;
    gap: 4px;
    margin-top: 4px;
    border-radius: 6px;
  }

  #composer input#userText {
    font-size: 0.85rem;
    padding: 4px 8px;
  }

  .btn-common,
  #btnCancel,
  #btnUpdate,
  #btnedit {
    height: 32px;
    width: 32px;
  }

  .back-btn {
    min-width: 100px;
    padding: 3px 6px;
  }

  .back-text {
    font-size: 13px;
  }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
  .user_dashboard {
    min-height: calc(100vh - 200px);
  }

  #chat-wrapper {
    padding: 8px !important;
    margin: 0 2px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  #chat-header {
    min-height: 40px;
    padding: 6px 10px;
    border-radius: 20px;
    margin-bottom: 6px;
  }

  .ai-name-container {
    min-width: 90px;
    padding: 3px 5px;
    gap: 8px;
  }

  .ai-name {
    font-size: 14px;
  }

  #ai-icon {
    padding: 4px;
  }

  .toggle-switch {
    width: 70px;
    height: 36px;
  }

  .slider-avatar {
    width: 28px;
    height: 28px;
  }

  input:checked+.slider .slider-avatar {
    transform: translateX(34px);
  }

  #chat-wrapper.ai-active #chat {
    height: min(56vh, 355px);
    margin-top: calc(100% - 258px);
  }

  #chat {
    height: min(30vh, 280px);
    padding: 6px;
    flex: 1;
    min-height: min(30vh, 280px);
  }

  #chat-wrapper.ai-active #chat {
    height: min(25vh, 200px);
    margin-top: calc(25vh - 160px);
  }

  .msg {
    margin: 6px 3px;
    gap: 6px;
  }

  .bubble {
    max-width: 88%;
    padding: 8px 10px;
    font-size: 0.9rem;
    line-height: 1.4;
  }

  .choices {
    gap: 6px;
    padding: 4px 4px 8px;
    margin: 2px 3px 8px;
  }

  .choice {
    padding: 6px 10px;
    font-size: 0.9rem;
    min-height: 40px;
  }

  #composer {
    padding: 6px;
    gap: 6px;
    margin-top: 6px;
    border-radius: 8px;
  }

  #composer input#userText {
    font-size: 0.9rem;
    padding: 6px 10px;
  }

  .btn-common {
    height: 36px;
    width: 36px;
  }

  .back-btn {
    min-width: 100px;
    padding: 3px 6px;
  }

  .back-text {
    font-size: 13px;
  }
}

/* Additional landscape fixes for very small screens */
@media (max-width: 640px) and (orientation: landscape) {
  .user_dashboard {
    min-height: calc(100vh - 150px);
  }

  .gender-card {
    min-width: fit-content;
    padding: 20px 30px;
    width: 100%;
    height: auto;
  }


  .container .container {
    margin: 0 !important;
    padding: 0 !important;
  }

  #chat-wrapper {
    padding: 6px !important;
    margin: 0 1px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
  }

  #chat-header {
    min-height: 35px;
    padding: 4px 8px;
    border-radius: 15px;
    margin-bottom: 4px;
  }

  .ai-name-container {
    min-width: 80px;
    padding: 2px 4px;
    gap: 6px;
  }

  .ai-name {
    font-size: 12px;
  }

  #chat {
    height: min(40vh, 200px);
    padding: 4px;
    max-height: calc(100vh - 150px);
    flex: 1;
    min-height: 0;
  }

  #chat-wrapper.ai-active #chat {
    height: min(30vh, 150px);
    margin-top: 0;
  }

  .bubble {
    max-width: 90%;
    padding: 6px 8px;
    font-size: 0.85rem;
    line-height: 1.35;
  }

  .choice {
    padding: 4px 8px;
    font-size: 0.85rem;
    min-height: 36px;
  }

  #composer {
    padding: 4px;
    gap: 4px;
    margin-top: 4px;
    border-radius: 6px;
  }

  #composer input#userText {
    font-size: 0.85rem;
    padding: 4px 8px;
  }

  .btn-common {
    height: 32px;
    width: 32px;
  }
}

/* =========================================
   PROGRESS BAR STYLES FOR CONDITIONS PREVIEW
   ========================================= */

.conditions-preview {
  margin-top: 8px;
}

.conditions-preview-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
  opacity: 0.9;
}

.condition-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 5px;
  padding: 2px 0;
}

.condition-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.condition-progress-container {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.condition-progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  min-width: 60px;
}

.condition-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, rgb(252, 253, 252), rgb(253, 255, 254));
  border-radius: 4px;
  transition: width 0.6s ease-out;
  position: relative;
}

.condition-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.condition-percentage {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  min-width: 35px;
  text-align: right;
  opacity: 0.9;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .condition-item {
    gap: 8px;
    margin-bottom: 8px;
    padding: 6px 0;
  }

  .condition-name {
    font-size: 0.85rem;
  }

  .condition-progress-container {
    min-width: 100px;
    gap: 6px;
  }

  .condition-progress-bar {
    min-width: 50px;
    height: 6px;
  }

  .condition-percentage {
    font-size: 0.75rem;
    min-width: 30px;
  }
}

@media (max-width: 480px) {
  .condition-item {
    gap: 6px;
    margin-bottom: 6px;
    padding: 4px 0;
  }

  #main-wrapper .user_dashboard {
    padding: 30px 0;
  }

  #random-phrase {
    font-size: 16px;
    line-height: 1.3;
  }

  .condition-name {
    font-size: 0.8rem;
  }

  .condition-progress-container {
    min-width: 90px;
    gap: 4px;
  }

  .condition-progress-bar {
    min-width: 45px;
    height: 5px;
  }

  .condition-percentage {
    font-size: 0.7rem;
    min-width: 28px;
  }
}

/* =========================================
   UPLOAD MEDIA CONTAINER STYLES
   ========================================= */

#upload-media-container {
  position: relative;
  width: 100%;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  margin: 0 0 12px 0;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  order: 1;
  /* Ensure it appears above composer */
}

/* Upload Container Visibility Control */
.upload-container-hidden {
  display: none;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-container-visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-container-hiding {
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#upload-media-container:hover {
  border-color: var(--primary);
  background: linear-gradient(135deg, #f0f4ff 0%, #e6f0ff 100%);
  box-shadow: 0 8px 30px rgba(79, 140, 255, 0.1);
  transform: translateY(-2px);
}

/* Skip Button - Top Right Corner */
.skip-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.skip-btn:hover {
  background: rgba(255, 255, 255, 1);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 140, 255, 0.15);
}

.skip-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Upload Content */
.upload-content {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.upload-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.upload-description {
  font-size: 1rem;
  color: var(--muted);
  margin: 0 0 30px 0;
  line-height: 1.5;
}

/* Upload Options Container */
.upload-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 500px;
  margin: 0 auto;
}

/* Individual Upload Option */
.upload-option {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 24px 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  min-height: 140px;
  justify-content: center;
}

.upload-option::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--primary), #6A8EAD);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.upload-option:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(79, 140, 255, 0.15);
}

.upload-option:hover::before {
  opacity: 0.05;
}

.upload-option:active {
  transform: translateY(-2px) scale(0.98);
}

/* Upload Icon */
.upload-icon {
  position: relative;
  z-index: 2;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #f0f4ff, #e6f0ff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(79, 140, 255, 0.1);
}

.upload-option:hover .upload-icon {
  background: linear-gradient(135deg, var(--primary), #6A8EAD);
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(79, 140, 255, 0.25);
}

.upload-icon img {
  width: 24px;
  height: 24px;
  transition: all 0.3s ease;
  filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
}

.upload-option:hover .upload-icon img {
  filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%) hue-rotate(93deg) brightness(103%) contrast(103%);
  transform: scale(1.1);
}

/* Upload Labels */
.upload-label {
  position: relative;
  z-index: 2;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  transition: color 0.3s ease;
}

.upload-subtitle {
  position: relative;
  z-index: 2;
  font-size: 0.85rem;
  color: var(--muted);
  transition: color 0.3s ease;
}

.upload-option:hover .upload-label,
.upload-option:hover .upload-subtitle {
  color: var(--primary);
}

/* Focus States for Accessibility */
.upload-option:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.skip-btn:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  #upload-media-container {
    padding: 30px 15px;
    margin: 0 0 10px 0;
  }

  .skip-btn {
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  .upload-title {
    font-size: 1.3rem;
  }

  .upload-description {
    font-size: 0.95rem;
    margin-bottom: 25px;
  }

  .upload-options {
    grid-template-columns: 1fr;
    gap: 15px;
    max-width: 100%;
  }

  .upload-option {
    padding: 20px 16px;
    min-height: 120px;
  }

  .upload-icon {
    width: 40px;
    height: 40px;
  }

  .upload-icon img {
    width: 20px;
    height: 20px;
  }

  .upload-label {
    font-size: 1rem;
  }

  .upload-subtitle {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  #upload-media-container {
    padding: 25px 12px;
    margin: 0 0 8px 0;
    border-radius: var(--radius-md);
  }

  .skip-btn {
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    font-size: 0.8rem;
    border-radius: 15px;
  }

  .upload-title {
    font-size: 1.2rem;
  }

  .upload-description {
    font-size: 0.9rem;
    margin-bottom: 20px;
  }

  .upload-option {
    padding: 18px 14px;
    min-height: 110px;
    gap: 10px;
  }

  .upload-icon {
    width: 36px;
    height: 36px;
  }

  .upload-icon img {
    width: 18px;
    height: 18px;
  }

  .upload-label {
    font-size: 0.95rem;
  }

  .upload-subtitle {
    font-size: 0.75rem;
  }
}

/* Animation for container appearance */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#upload-media-container {
  animation: slideInUp 0.5s ease-out;
}

/* Drag and drop states */
#upload-media-container.drag-over {
  border-color: var(--primary);
  background: linear-gradient(135deg, #f0f4ff 0%, #e6f0ff 100%);
  transform: scale(1.02);
}

#upload-media-container.drag-over .upload-title {
  color: var(--primary);
}

/* Loading state for uploads */
.upload-option.uploading {
  pointer-events: none;
  opacity: 0.7;
}

.upload-option.uploading .upload-icon {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

/* Upload Status and Feedback Styles */
.upload-status {
  margin-top: 20px;
  padding: 15px;
  background: rgba(79, 140, 255, 0.1);
  border: 1px solid rgba(79, 140, 255, 0.2);
  border-radius: var(--radius-md);
  text-align: center;
}

.upload-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(79, 140, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #6A8EAD);
  border-radius: 3px;
  animation: progressAnimation 2s ease-in-out infinite;
}

@keyframes progressAnimation {
  0% {
    left: -100%;
  }

  100% {
    left: 100%;
  }
}

.progress-text {
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 600;
}

.upload-feedback {
  margin-top: 15px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.upload-feedback.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #059669;
}

.upload-feedback.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #dc2626;
}

.upload-feedback.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #d97706;
}

.feedback-message {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.feedback-message::before {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.upload-feedback.success .feedback-message::before {
  background: #059669;
  content: '✓';
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.upload-feedback.error .feedback-message::before {
  background: #dc2626;
  content: '✕';
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.upload-feedback.warning .feedback-message::before {
  background: #d97706;
  content: '⚠';
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

/* Mobile responsive styles for upload trigger button */
@media (max-width: 575.98px) {
  .upload-trigger-btn {
    height: 36px;
    width: 36px;
  }

  .upload-trigger-btn img {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 480px) {
  .upload-trigger-btn {
    height: 32px;
    width: 32px;
  }

  .upload-trigger-btn img {
    width: 16px;
    height: 16px;
  }
}

#gender-description {
  background: #0d6efd17;
  color: var(--primary);
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 20px;
}

#random-phrase {
  font-size: 18px;
  font-weight: 600;
}

#random-phrases-container {

  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  gap: 11px;
}

.card-title {
  color: var(--primary);
}

p.card-text {
  font-size: 16px;
  font-weight: 600;
  color: #a2a2a2;
}

#stage-start .inner-container {
  width: 100%;
}

.btneditmsg {
  height: 30px;
  width: 30px;
  background-color: #fff;
  border-radius: 4px;
  display: flex;
  align-items: center;
  border: none;
  border-radius: 8px;
  position: absolute;
  right: 6px;
  top: -10px;
  transition: all 0.3s ease;
}

button.btneditmsg:hover {
  background: #4d6f94;
  color: #fff;
  box-shadow: 0 0 13px 0 rgb(148 148 255);
}

button.btneditmsg:active {
  transform: scale(0.95);
}

button.btneditmsg:focus {
  outline: none;
}

button.btneditmsg:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}