/* ===== 기본 리셋 & 공통 ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
}

body {
  background-color: #f0f4f0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

/* ===== 모바일 컨테이너 ===== */
.mobile-container {
  width: 390px;
  min-height: auto;        /* 로그인 페이지: 콘텐츠 높이에 맞춤 */
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* 채팅 페이지 전용: 화면 꽉 채움 */
.mobile-container.chat-page {
  height: 100vh;
}

/* ===== 헤더 ===== */
.app-header {
  padding: 20px 24px 12px;
  background: #ffffff;
  border-bottom: 1px solid #f0f0f0;
}

.app-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: #2c3e50;
  letter-spacing: -0.5px;
}

/* 푸터 */
.app-footer {
  flex-shrink: 0;          /* ← 고정 */
  padding: 14px 24px;
  background: #ffffff;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: auto;
  position: relative;
}

.app-footer span {
  font-size: 17px;
  font-weight: 700;
  color: #555;
  text-align: center;
}

.btn-logout-small {
  position: absolute;
  right: 16px;
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  color: #bbb;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-logout-small:hover {
  background: #f5f5f5;
  border-color: #999;
  color: #555;
}

/* ===== 메인 콘텐츠 영역 ===== */
.main-content {
  flex: 1;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ===== 로그인 화면 ===== */
.login-title {
  font-size: 26px;
  font-weight: 800;
  color: #2c3e50;
  text-align: center;
  margin-bottom: 40px;
  line-height: 1.4;
}

.login-title span {
  color: #5aab7e;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #444;
  margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid #e0e0e0;
  border-radius: 12px;
  font-size: 15px;
  color: #333;
  background: #f9f9f9;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #5aab7e;
  background: #fff;
}

.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 48px;
}

.toggle-pw {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #999;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
}

.remember-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #5aab7e;
  cursor: pointer;
}

.remember-row label {
  font-size: 14px;
  color: #555;
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  padding: 16px;
  background: #5aab7e;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  background: #4a9a6e;
}

.btn-primary:active {
  transform: scale(0.98);
}

.error-msg {
  background: #fff0f0;
  border: 1px solid #ffcccc;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #e05555;
  margin-bottom: 16px;
  text-align: center;
}

/* ===== 홈 화면 ===== */
.home-greeting {
  font-size: 22px;
  font-weight: 800;
  color: #2c3e50;
  margin-bottom: 32px;
  text-align: center;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: #444;
  margin-bottom: 14px;
}

/* 상담 스타일 라디오 */
.style-options {
  display: flex;
  gap: 24px;
  margin-bottom: 36px;
}

.style-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.style-option input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: #e05555;
  cursor: pointer;
}

.style-option span {
  font-size: 15px;
  color: #333;
  font-weight: 500;
}

/* 감정 슬라이더 */
.mood-section {
  margin-bottom: 40px;
}

.mood-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.mood-label {
  font-size: 15px;
  font-weight: 700;
  color: #444;
}

.mood-value-display {
  font-size: 15px;
  font-weight: 700;
  color: #333;
}

.mood-slider-wrapper {
  position: relative;
  margin-bottom: 8px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, #e05555 0%, #e05555 100%, #e0e0e0 100%);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e05555;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(224, 85, 85, 0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e05555;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(224, 85, 85, 0.4);
}

.mood-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

.btn-start {
  display: block;
  width: 180px;
  margin: 0 auto;
  padding: 16px;
  background: #ffffff;
  color: #333;
  border: 1.5px solid #ccc;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-start:hover {
  background: #f5f5f5;
  border-color: #999;
}

/* ===== 채팅 화면 ===== */
.chat-fixed-top {
  flex-shrink: 0;          /* ← sticky 제거, flex 고정으로 변경 */
  background: #fff;
  border-bottom: 1px solid #eee;
  padding: 14px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  z-index: 100;
}

.chat-mood-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.chat-mood-label {
  font-size: 14px;
  font-weight: 700;
  color: #444;
}

.chat-mood-value {
  font-size: 14px;
  font-weight: 700;
  color: #333;
}

.chat-mood-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

/* 채팅 메시지 영역 */
.chat-messages {
  flex: 1;                 /* ← 남은 공간 모두 차지 */
  overflow-y: auto;        /* ← 이 영역만 스크롤 */
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8f9fa;
}

.chat-date-divider {
  text-align: center;
  font-size: 12px;
  color: #aaa;
  margin: 8px 0;
}

/* 메시지 행 */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.msg-row.user {
  flex-direction: row-reverse;
}

.msg-bubble {
  max-width: 68%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
}

.msg-bubble.user {
  background: #c8e6c9;
  border-bottom-right-radius: 4px;
  color: #1b5e20;
}

.msg-bubble.ai {
  background: #ffffff;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.msg-time {
  font-size: 11px;
  color: #bbb;
  white-space: nowrap;
  margin-bottom: 2px;
}

.ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #5aab7e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

/* 채팅 입력창 */
.chat-input-area {
  flex-shrink: 0;          /* ← 고정 */
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid #e0e0e0;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  background: #f5f5f5;
  transition: border-color 0.2s;
  resize: none;
}

.chat-input:focus {
  border-color: #5aab7e;
  background: #fff;
}

.btn-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #5aab7e;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  transition: background 0.2s;
  flex-shrink: 0;
}

.btn-send:hover {
  background: #4a9a6e;
}

/* ===== 로그아웃 화면 ===== */
.logout-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  gap: 20px;
}

.logout-icon {
  font-size: 64px;
  margin-bottom: 8px;
}

.logout-title {
  font-size: 22px;
  font-weight: 800;
  color: #2c3e50;
  text-align: center;
}

.logout-desc {
  font-size: 15px;
  color: #777;
  text-align: center;
  line-height: 1.6;
}

.logout-username {
  font-weight: 700;
  color: #5aab7e;
}

.logout-btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-top: 16px;
}

.btn-danger {
  width: 100%;
  padding: 16px;
  background: #e05555;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
  transition: background 0.2s;
}

.btn-danger:hover {
  background: #c94444;
}

.btn-secondary {
  width: 100%;
  padding: 16px;
  background: #f5f5f5;
  color: #555;
  border: 1.5px solid #ddd;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #ebebeb;
}

/* ===== 반응형 (실제 모바일) ===== */
@media (max-width: 430px) {
  body {
    background: #ffffff;
    align-items: flex-start;
  }

    /* 모바일에서 채팅 페이지 */
  .mobile-container.chat-page {
    height: 100vh;
    min-height: unset;
  }
}
