/* =========================================================
   USHA AI — SNK IT Institute
   Step 4.5 — Modern Learning Mentor UI
   Full CSS
   ========================================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  scroll-behavior: smooth;
}

body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  font-family:
    Inter,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
  background: #f7f8fa;
  color: #172033;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  text-decoration: none;
  color: inherit;
}

/* =========================================================
   MAIN APP
   ========================================================= */

.usha-app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f7f8fa;
}

/* =========================================================
   HEADER
   ========================================================= */

.usha-header {
  flex: 0 0 auto;
  width: 100%;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #e8ebf0;
  position: relative;
  z-index: 20;
}

.usha-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

/* =========================================================
   HEADER ICON — SMALLER
   ========================================================= */

.usha-brand img,
.usha-logo img,
.usha-header-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  max-width: 34px;
  max-height: 34px;
  object-fit: contain;
  display: block;
  border-radius: 10px;
}

.usha-brand-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.usha-brand-name {
  font-size: 17px;
  line-height: 1.2;
  font-weight: 800;
  color: #151a24;
  letter-spacing: -0.3px;
}

.usha-brand-subtitle {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.3;
  color: #7a8495;
  white-space: nowrap;
}

.usha-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.usha-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #647083;
  white-space: nowrap;
}

.usha-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #18b978;
  box-shadow: 0 0 0 3px rgba(24, 185, 120, 0.10);
}

.usha-support-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  background: #151a24;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

.usha-support-btn:hover {
  background: #252d3a;
  transform: translateY(-1px);
}

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

/* =========================================================
   MAIN
   ========================================================= */

.usha-main {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* =========================================================
   WELCOME
   ========================================================= */

.usha-welcome {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 20px 18px;
}

/* =========================================================
   WELCOME ICON — SMALLER
   ========================================================= */

.usha-welcome img,
.usha-welcome-icon {
  width: 64px;
  height: 64px;
  min-width: 64px;
  min-height: 64px;
  max-width: 64px;
  max-height: 64px;
  object-fit: contain;
  display: block;
  margin-bottom: 14px;
}

.usha-welcome-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  margin-bottom: 9px;
  border-radius: 999px;
  background: #eef8f4;
  color: #169b68;
  font-size: 11px;
  font-weight: 800;
}

.usha-welcome h1,
.usha-welcome-title {
  margin: 0;
  color: #151a24;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.8px;
}

.usha-welcome p,
.usha-welcome-text {
  max-width: 600px;
  margin: 9px auto 0;
  color: #737e90;
  font-size: 14px;
  line-height: 1.7;
}

/* =========================================================
   CONTINUE LEARNING
   ========================================================= */

.usha-continue {
  flex: 0 0 auto;
  width: 100%;
  padding: 0 24px 14px;
}

.usha-continue-card {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #ffffff;
  border: 1px solid #e5e9ef;
  border-radius: 15px;
  box-shadow: 0 5px 22px rgba(24, 33, 48, 0.05);
}

.usha-continue-info {
  min-width: 0;
}

.usha-continue-label {
  margin-bottom: 3px;
  color: #159768;
  font-size: 10px;
  line-height: 1.3;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.usha-continue-title {
  color: #1b2330;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 800;
}

.usha-continue-meta {
  margin-top: 3px;
  color: #7d8796;
  font-size: 11px;
  line-height: 1.4;
}

.usha-continue-btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  background: #151a24;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

.usha-continue-btn:hover {
  background: #252d3a;
  transform: translateY(-1px);
}

/* =========================================================
   SUGGESTIONS
   ========================================================= */

.usha-suggestions {
  flex: 0 0 auto;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 0 24px 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.usha-suggestion {
  min-height: 50px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #e3e7ed;
  border-radius: 11px;
  background: #fff;
  color: #394354;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 700;
  text-align: center;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.usha-suggestion:hover {
  background: #fbfcfd;
  border-color: #cfd6df;
  box-shadow: 0 4px 15px rgba(20, 30, 45, 0.05);
  transform: translateY(-1px);
}

.usha-suggestion:active {
  transform: translateY(0);
}

/* =========================================================
   CHAT MESSAGES
   ========================================================= */

.usha-messages {
  flex: 1 1 0;
  min-height: 0;
  height: 0;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 8px 24px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
}

.usha-messages::-webkit-scrollbar {
  width: 6px;
}

.usha-messages::-webkit-scrollbar-track {
  background: transparent;
}

.usha-messages::-webkit-scrollbar-thumb {
  background: #d7dce3;
  border-radius: 10px;
}

.usha-messages::-webkit-scrollbar-thumb:hover {
  background: #c3cad4;
}

/* =========================================================
   MESSAGE ROW
   ========================================================= */

.usha-message {
  width: 100%;
  display: flex;
  margin: 0 0 14px;
  animation: ushaMessageIn 0.25s ease;
}

.usha-message.user {
  justify-content: flex-end;
}

.usha-message.assistant {
  justify-content: flex-start;
}

@keyframes ushaMessageIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

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

/* =========================================================
   MESSAGE BUBBLE
   ========================================================= */

.usha-bubble {
  max-width: min(680px, 84%);
  padding: 12px 14px;
  border-radius: 15px;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.usha-message.user .usha-bubble {
  background: #151a24;
  color: #fff;
  border-bottom-right-radius: 5px;
}

.usha-message.assistant .usha-bubble {
  background: #fff;
  color: #303a4a;
  border: 1px solid #e5e9ef;
  border-bottom-left-radius: 5px;
  box-shadow: 0 3px 13px rgba(24, 33, 48, 0.04);
}

/* =========================================================
   MESSAGE TIME
   ========================================================= */

.usha-message-time {
  margin-top: 5px;
  padding: 0 3px;
  color: #9aa3b0;
  font-size: 9px;
  line-height: 1.3;
}

.usha-message.user .usha-message-time {
  text-align: right;
}

/* =========================================================
   ACTION BUTTONS
   ========================================================= */

.usha-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.usha-action-btn {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  background: #f3f6f8;
  border: 1px solid #e1e6eb;
  color: #344052;
  font-size: 10px;
  font-weight: 800;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.usha-action-btn:hover {
  background: #edf1f4;
  border-color: #d3d9e0;
  transform: translateY(-1px);
}

/* =========================================================
   TYPING INDICATOR
   ========================================================= */

.usha-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 38px;
}

.usha-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8d97a5;
  animation: ushaTyping 1.1s infinite ease-in-out;
}

.usha-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.usha-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ushaTyping {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }

  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* =========================================================
   FOOTER / INPUT AREA
   ========================================================= */

.usha-footer {
  flex: 0 0 auto;
  width: 100%;
  padding: 10px 20px 14px;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid #e7eaf0;
  position: relative;
  z-index: 15;
}

.usha-input-wrap {
  width: min(820px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 7px;
  background: #f8f9fb;
  border: 1px solid #dfe4eb;
  border-radius: 14px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.usha-input-wrap:focus-within {
  background: #fff;
  border-color: #bfc7d2;
  box-shadow: 0 0 0 3px rgba(21, 26, 36, 0.04);
}

#ushaInput {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  max-height: 130px;
  padding: 9px 10px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: #202938;
  font-size: 13px;
  line-height: 1.5;
}

#ushaInput::placeholder {
  color: #9aa3af;
}

#ushaInput::-webkit-scrollbar {
  width: 4px;
}

#ushaInput::-webkit-scrollbar-thumb {
  background: #d2d7df;
  border-radius: 8px;
}

/* =========================================================
   SEND BUTTON
   ========================================================= */

#ushaSend {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #151a24;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

#ushaSend:hover {
  background: #252d3a;
  transform: translateY(-1px);
}

#ushaSend:active {
  transform: translateY(0);
}

#ushaSend:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* =========================================================
   CLEAR CHAT
   ========================================================= */

#ushaClear {
  width: min(820px, 100%);
  margin: 7px auto 0;
  display: flex;
  justify-content: flex-end;
  background: transparent;
  color: #8993a2;
  font-size: 10px;
  font-weight: 700;
}

#ushaClear:hover {
  color: #4d5868;
}

/* =========================================================
   FOOTER NOTE
   ========================================================= */

.usha-note {
  width: min(820px, 100%);
  margin: 5px auto 0;
  text-align: center;
  color: #a0a7b2;
  font-size: 9px;
  line-height: 1.4;
}

/* =========================================================
   TOAST
   ========================================================= */

.usha-toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border-radius: 9px;
  background: #151a24;
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 10px);
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease,
    transform 0.2s ease;
}

.usha-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* =========================================================
   FOCUS ACCESSIBILITY
   ========================================================= */

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid #7f8998;
  outline-offset: 2px;
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 800px) {
  .usha-header {
    padding: 11px 18px;
  }

  .usha-suggestions {
    grid-template-columns: repeat(2, 1fr);
  }

  .usha-messages {
    padding-left: 18px;
    padding-right: 18px;
  }

  .usha-footer {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {
  body {
    background: #fff;
  }

  .usha-app {
    background: #fff;
  }

  .usha-header {
    min-height: 62px;
    padding: 9px 13px;
    gap: 10px;
  }

  /* MOBILE HEADER ICON */
  .usha-brand img,
  .usha-logo img,
  .usha-header-icon {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    max-width: 30px;
    max-height: 30px;
    border-radius: 8px;
  }

  .usha-brand {
    gap: 8px;
  }

  .usha-brand-name {
    font-size: 15px;
  }

  .usha-brand-subtitle {
    display: none;
  }

  .usha-online {
    font-size: 10px;
  }

  .usha-online-dot {
    width: 6px;
    height: 6px;
  }

  .usha-support-btn {
    min-height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 10px;
  }

  .usha-welcome {
    padding: 22px 16px 13px;
  }

  /* MOBILE WELCOME ICON */
  .usha-welcome img,
  .usha-welcome-icon {
    width: 54px;
    height: 54px;
    min-width: 54px;
    min-height: 54px;
    max-width: 54px;
    max-height: 54px;
    margin-bottom: 11px;
  }

  .usha-welcome-badge {
    padding: 5px 8px;
    margin-bottom: 7px;
    font-size: 9px;
  }

  .usha-welcome h1,
  .usha-welcome-title {
    font-size: 24px;
    letter-spacing: -0.5px;
  }

  .usha-welcome p,
  .usha-welcome-text {
    max-width: 330px;
    margin-top: 7px;
    font-size: 12px;
    line-height: 1.55;
  }

  .usha-continue {
    padding: 0 13px 11px;
  }

  .usha-continue-card {
    padding: 11px 12px;
    border-radius: 12px;
    gap: 10px;
  }

  .usha-continue-title {
    font-size: 12px;
  }

  .usha-continue-meta {
    font-size: 9px;
  }

  .usha-continue-btn {
    min-height: 32px;
    padding: 0 10px;
    font-size: 9px;
  }

  .usha-suggestions {
    width: 100%;
    padding: 0 13px 10px;
    gap: 7px;
  }

  .usha-suggestion {
    min-height: 43px;
    padding: 8px 7px;
    border-radius: 9px;
    font-size: 10px;
  }

  .usha-messages {
    padding: 6px 13px 16px;
  }

  .usha-message {
    margin-bottom: 11px;
  }

  .usha-bubble {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 13px;
    font-size: 12px;
    line-height: 1.6;
  }

  .usha-message-time {
    font-size: 8px;
  }

  .usha-actions {
    gap: 5px;
    margin-top: 8px;
  }

  .usha-action-btn {
    min-height: 29px;
    padding: 0 8px;
    font-size: 9px;
  }

  .usha-footer {
    padding: 8px 10px 10px;
  }

  .usha-input-wrap {
    padding: 5px;
    border-radius: 12px;
  }

  #ushaInput {
    min-height: 38px;
    max-height: 110px;
    padding: 8px;
    font-size: 12px;
  }

  #ushaSend {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    font-size: 15px;
  }

  #ushaClear {
    margin-top: 5px;
    font-size: 9px;
  }

  .usha-note {
    margin-top: 4px;
    font-size: 8px;
  }

  .usha-toast {
    bottom: 75px;
    font-size: 10px;
  }
}

/* =========================================================
   VERY SMALL MOBILE
   ========================================================= */

@media (max-width: 380px) {
  .usha-header {
    padding-left: 10px;
    padding-right: 10px;
  }

  .usha-online {
    display: none;
  }

  .usha-support-btn {
    padding: 0 9px;
  }

  .usha-welcome {
    padding-top: 18px;
  }

  .usha-welcome img,
  .usha-welcome-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    max-width: 48px;
    max-height: 48px;
  }

  .usha-welcome h1,
  .usha-welcome-title {
    font-size: 21px;
  }

  .usha-suggestion {
    font-size: 9px;
  }

  .usha-bubble {
    max-width: 92%;
    font-size: 11px;
  }
}

/* =========================================================
   LANDSCAPE MOBILE
   ========================================================= */

@media (max-height: 520px) and (max-width: 800px) {
  .usha-header {
    min-height: 54px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .usha-welcome {
    padding-top: 10px;
    padding-bottom: 8px;
  }

  .usha-welcome img,
  .usha-welcome-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    max-width: 42px;
    max-height: 42px;
    margin-bottom: 7px;
  }

  .usha-welcome h1,
  .usha-welcome-title {
    font-size: 20px;
  }

  .usha-welcome p,
  .usha-welcome-text {
    display: none;
  }

  .usha-suggestions {
    padding-bottom: 7px;
  }

  .usha-suggestion {
    min-height: 36px;
  }

  .usha-footer {
    padding-top: 5px;
    padding-bottom: 6px;
  }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .usha-messages {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
