/* =============================================
   SheepMind Chat & Auth Styles
   Matches existing dark theme (#000, #060606, #E9204F)
   ============================================= */

/* --- Auth Modal --- */

.sm_auth_overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  justify-content: center;
  align-items: center;
}
.sm_auth_overlay.active {
  display: flex;
}

.sm_auth_modal {
  background: #060606;
  border-radius: 12px;
  padding: 40px;
  width: 90%;
  max-width: 400px;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.sm_auth_close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  transition: color 0.3s;
}
.sm_auth_close:hover {
  color: #E9204F;
}

.sm_auth_logo {
  text-align: center;
  margin-bottom: 24px;
}
.sm_auth_logo img {
  max-width: 80px;
}

.sm_auth_tabs {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 28px;
}
.sm_auth_tab {
  font-family: "Saira", sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
}
.sm_auth_tab.active {
  color: #E9204F;
  border-bottom-color: #E9204F;
}
.sm_auth_tab:hover {
  color: #fff;
}

.sm_auth_form {
  display: none;
  flex-direction: column;
  gap: 16px;
}
.sm_auth_form.active {
  display: flex;
}

.sm_form_group {
  position: relative;
}

.sm_form_input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-family: "Poppins", sans-serif;
  font-size: 14px;
  padding: 10px 0 !important;
  text-align: center;
  transition: border-color 0.3s;
  box-sizing: border-box;
}
.sm_form_input:focus {
  outline: none;
  border-bottom-color: #E9204F;
}
.sm_form_input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.sm_code_group {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.sm_code_group .sm_code_input {
  flex: 1;
}

.sm_send_code_btn {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid #E9204F;
  color: #E9204F;
  font-family: "Saira", sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s;
}
.sm_send_code_btn:hover:not(:disabled) {
  background: #E9204F;
  color: #000;
}
.sm_send_code_btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sm_btn {
  width: 100%;
  background: #E9204F;
  color: #fff;
  border: none;
  font-family: "Saira", sans-serif;
  font-size: 15px;
  font-weight: 600;
  padding: 12px;
  border-radius: 3px;
  cursor: pointer;
  transition: opacity 0.3s;
  margin-top: 8px;
}
.sm_btn:hover {
  opacity: 0.85;
}

.sm_dev_login_btn {
  background: transparent;
  border: 1px solid #E9204F;
  color: #E9204F;
  margin-top: 0;
}
.sm_dev_login_btn:hover {
  background: #E9204F;
  color: #fff;
}

.sm_form_error {
  color: #E9204F;
  font-size: 13px;
  text-align: center;
  display: none;
}


/* --- Chat Overlay --- */

.sm_chat_overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 9999;
}
.sm_chat_overlay.active {
  display: block;
}

.sm_chat_container {
  display: flex;
  width: 100%;
  height: 100%;
}

/* Sidebar */
.sm_chat_sidebar {
  width: 280px;
  min-width: 280px;
  background: #060606;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sm_sidebar_header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sm_sidebar_header h3 {
  font-family: "Saira", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #E9204F;
  margin: 0 0 12px 0;
}

.sm_new_chat_btn {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-family: "Saira", sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.3s;
}
.sm_new_chat_btn:hover {
  border-color: #E9204F;
  color: #E9204F;
}

.sm_conv_list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.sm_conv_list::-webkit-scrollbar {
  width: 4px;
}
.sm_conv_list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}

.sm_conv_empty {
  text-align: center;
  color: #666;
  font-size: 13px;
  padding: 32px 16px;
  font-family: "Poppins", sans-serif;
}

.sm_conv_item {
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.3s;
  border-left: 3px solid transparent;
}
.sm_conv_item:hover {
  background: rgba(255, 255, 255, 0.03);
}
.sm_conv_item.active {
  background: rgba(233, 32, 79, 0.08);
  border-left-color: #E9204F;
}
.sm_conv_title {
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  color: #ccc;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sm_sidebar_footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sm_user_email {
  display: block;
  font-family: "Poppins", sans-serif;
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sm_logout_btn {
  background: transparent;
  border: none;
  color: #666;
  font-family: "Saira", sans-serif;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  transition: color 0.3s;
}
.sm_logout_btn:hover {
  color: #E9204F;
}

/* Main Chat Area */
.sm_chat_main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sm_chat_header {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 16px;
}

.sm_chat_close_btn {
  background: transparent;
  border: none;
  color: #999;
  font-family: "Saira", sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.3s;
  padding: 0;
}
.sm_chat_close_btn:hover {
  color: #E9204F;
}

.sm_chat_title {
  font-family: "Saira", sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Messages Area */
.sm_messages_area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sm_messages_area::-webkit-scrollbar {
  width: 4px;
}
.sm_messages_area::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}

.sm_welcome_msg {
  text-align: center;
  padding: 60px 20px;
  color: #888;
}
.sm_welcome_msg h3 {
  font-family: "Saira", sans-serif;
  font-size: 22px;
  color: #fff;
  margin: 0 0 8px 0;
}
.sm_welcome_msg p {
  font-family: "Poppins", sans-serif;
  font-size: 14px;
  line-height: 1.8;
  color: #999;
}

.sm_loading_msg,
.sm_error_msg {
  text-align: center;
  padding: 40px;
  color: #666;
  font-family: "Poppins", sans-serif;
  font-size: 14px;
}

/* Message Bubbles */
.sm_msg {
  display: flex;
  max-width: 80%;
}
.sm_msg_user {
  align-self: flex-end;
}
.sm_msg_ai {
  align-self: flex-start;
}

.sm_msg_bubble {
  padding: 12px 18px;
  border-radius: 12px;
  font-family: "Poppins", sans-serif;
  font-size: 14px;
  line-height: 1.7;
  word-wrap: break-word;
}
.sm_msg_user .sm_msg_bubble {
  background: #E9204F;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.sm_msg_ai .sm_msg_bubble {
  background: #060606;
  color: #ddd;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}
.sm_msg_bubble strong {
  color: #fff;
  font-weight: 700;
}
.sm_msg_bubble em {
  color: #f1f1f1;
  font-style: italic;
}
.sm_msg_bubble code {
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: "Courier New", monospace;
  font-size: 13px;
}
.sm_md_paragraph {
  margin: 0;
}
.sm_md_paragraph + .sm_md_paragraph,
.sm_md_list_item + .sm_md_paragraph,
.sm_md_paragraph + .sm_md_list_item {
  margin-top: 6px;
}
.sm_md_gap {
  height: 10px;
}
.sm_md_heading {
  margin: 2px 0 8px;
  color: #fff;
  font-weight: 700;
}
.sm_md_list_item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 4px;
}
.sm_md_marker {
  min-width: 18px;
  color: #E9204F;
  font-weight: 700;
}

/* Typing animation */
.sm_typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 16px 20px !important;
}
.sm_typing span {
  width: 6px;
  height: 6px;
  background: #888;
  border-radius: 50%;
  animation: sm_typing_dot 1.4s infinite ease-in-out both;
}
.sm_typing span:nth-child(1) { animation-delay: -0.32s; }
.sm_typing span:nth-child(2) { animation-delay: -0.16s; }
.sm_typing span:nth-child(3) { animation-delay: 0s; }

@keyframes sm_typing_dot {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Input Area */
.sm_input_area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #060606;
}

.sm_input {
  flex: 1;
  background: #060606 !important;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #fff !important;
  -webkit-text-fill-color: #fff;
  caret-color: #E9204F;
  font-family: "Poppins", sans-serif;
  font-size: 14px;
  padding: 10px 14px !important;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 0.3s;
}
.sm_input:focus {
  outline: none;
  border-color: #E9204F;
}
.sm_input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.sm_voice_btn,
.sm_send_btn {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.3s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sm_voice_btn:hover,
.sm_send_btn:hover {
  color: #E9204F;
}
.sm_send_btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.sm_voice_btn.recording {
  color: #E9204F;
  animation: sm_pulse 1s infinite;
}
@keyframes sm_pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}


/* --- Start Chat Button (between About and Services) --- */

.start_chat_btn {
  width: 100%;
  float: left;
  clear: both;
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 30px 0;
}
.chat_start_btn {
  display: inline-block;
  background: #E9204F;
  color: #fff;
  font-family: "Saira", sans-serif;
  font-size: 16px;
  font-weight: 600;
  padding: 12px 44px;
  border-radius: 3px;
  text-decoration: none;
  transition: opacity 0.3s, transform 0.3s;
  letter-spacing: 1px;
}
.chat_start_btn:hover {
  opacity: 0.85;
  transform: translateY(-2px);
  color: #fff;
}


/* --- Responsive --- */

@media (max-width: 768px) {
  .sm_chat_sidebar {
    display: none;
  }
  .sm_chat_sidebar.mobile_show {
    display: flex;
    position: absolute;
    width: 100%;
    z-index: 10;
  }
  .sm_msg {
    max-width: 90%;
  }
  .sm_chat_header {
    padding: 12px 16px;
  }
  .sm_messages_area {
    padding: 16px;
  }
  .sm_input_area {
    padding: 12px 16px;
  }
  .sm_auth_modal {
    padding: 28px 20px;
  }
  .start_chat_btn {
    margin-top: 12px;
  }
  .chat_start_btn {
    font-size: 15px;
    padding: 12px 36px;
  }
}
