/* ============================================
   HR Buddy - Modern Professional UI
   ============================================ */

/* ---------------- Reset & Base ---------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------------- Theme Variables ---------------- */
:root {
  --primary: #3a82f7;
  --primary-dark: #2563eb;
  --secondary: #00c2b8;
  --bg-main: #f8fafc;
  --bg-white: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --bubble-bot: #f0f9ff;
  --bubble-user: #f0fdfa;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ---------------- Main Layout ---------------- */
.app-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100vh;
  background: var(--bg-main);
  position: relative;
}

/* Ensure widget takes full height in Zoho iframe */
html,
body,
.app-wrap {
  height: 100% !important;
  max-height: 100% !important;
}

/* ---------------- Header ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 10;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.logo-icon {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  display: none;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.user-badge:not(:empty) {
  display: inline-flex;
}

/* ---------------- Chat Area ---------------- */
.chat-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg-main);
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
.chat-wrap::-webkit-scrollbar {
  width: 6px;
}

.chat-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.chat-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.chat-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ---------------- Messages ---------------- */
.msg {
  display: flex;
  margin-bottom: 16px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

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

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

.bubble {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: 18px;
  line-height: 1.6;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  position: relative;
}

.msg.bot .bubble {
  background: var(--bubble-bot);
  color: var(--text-primary);
  border: 1px solid #bae6fd;
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.msg.user .bubble {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: var(--shadow-md);
}

/* Typing Indicator */
.bubble.typing {
  background: var(--bg-white);
  border: 1px solid var(--border);
  padding: 18px 24px;
}

.typing-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

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

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: scale(0.7);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ---------------- Composer ---------------- */
.composer {
  padding: 16px 20px 20px;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 5;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: 24px;
  padding: 8px 8px 8px 16px;
  transition: all 0.2s ease;
}

.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(58, 130, 247, 0.1);
}

#chatInput {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  font-size: 14px;
  line-height: 1.5;
  max-height: 120px;
  min-height: 24px;
  padding: 6px 0;
  color: var(--text-primary);
  font-family: inherit;
}

#chatInput::placeholder {
  color: var(--text-muted);
}

.send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}

.send:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}

.send:active {
  transform: scale(0.95);
}

.send svg {
  transform: translateX(1px);
}

/* ---------------- Email Button ---------------- */
.email-btn {
  position: fixed;
  bottom: 100px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--bg-white);
  color: var(--primary);
  border: 2px solid var(--border);
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

.email-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

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

.email-btn svg {
  flex-shrink: 0;
}

/* ---------------- Responsive Design ---------------- */
@media (max-width: 768px) {
  .topbar {
    padding: 12px 16px;
  }

  .logo {
    font-size: 16px;
  }

  .chat-wrap {
    padding: 16px;
  }

  .bubble {
    max-width: 85%;
    font-size: 14px;
  }

  .composer {
    padding: 12px 16px 16px;
  }

  .email-btn {
    bottom: 90px;
    right: 16px;
    padding: 10px 14px;
    font-size: 12px;
  }

  .email-btn span {
    display: none;
  }
}