* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #0aa1a7;
  --primary-dark: #088792;
  --primary-light: #1fbdbf;
  --secondary-color: #ffffff;
  --accent-color: #0aa1a7;
  --text-color: #1f1f1f;
  --text-secondary: #666666;
  --light-text: #ffffff;
  --error-color: #f44336;
  --error-light: #ff6e40;
  --bg-light: #f5f7fa;
  --bg-lighter: #fafbfc;
  --border-color: #e5e7eb;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.15);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: "Poppins", sans-serif;
  min-height: 100vh;
  background: linear-gradient(135deg, #f0f7f8 0%, #f5f5f5 100%);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo img {
  height: 56px;
  width: 56px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--primary-color);
}

.logo-fallback {
  height: 56px;
  width: 56px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: var(--shadow-md);
}

.logo-text {
  font-weight: 700;
  font-size: 1.3rem;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.container {
  width: 100%;
  max-width: 540px;
  padding: 120px 20px 80px;
  animation: slideUpIn 0.6s ease-out;
}

@keyframes slideUpIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border-radius: 24px;
  padding: 48px 32px;
  color: var(--light-text);
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: pulse 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.card > * {
  position: relative;
  z-index: 1;
}

.card-title {
  font-size: 1.8rem;
  margin-bottom: 16px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.card-text {
  margin-bottom: 32px;
  line-height: 1.7;
  font-size: 0.95rem;
  opacity: 0.95;
}

#callButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 48px;
  font-size: 1rem;
  border: none;
  border-radius: 50px;
  background: var(--light-text);
  color: var(--primary-color);
  cursor: pointer;
  font-weight: 700;
  transition: var(--transition);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  letter-spacing: 0.3px;
}

#callButton:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  background: var(--bg-light);
}

#callButton:active {
  transform: translateY(-2px);
}

#ringBox {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1a1a2e 0%, var(--primary-dark) 100%);
  display: none;
  z-index: 9999;
}

.ring-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  position: relative;
}

.avatar-container {
  width: 140px;
  height: 140px;
  position: relative;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.8));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.avatar-container.ringing .avatar {
  animation: avatarPulse 1.5s ease-in-out infinite;
}

@keyframes avatarPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.4);
  }
}

.timer {
  font-size: 3.5rem;
  color: #ffffff;
  display: none;
  font-weight: 700;
  font-family: "Courier New", monospace;
  letter-spacing: 2px;
}

.call-status {
  font-size: 1.5rem;
  color: #ffffff;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.5px;
}

#endCallBtn {
  display: none;
  padding: 14px 48px;
  font-size: 1.1rem;
  background: linear-gradient(135deg, #f44336, #e53935);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(244, 67, 54, 0.4);
  transition: var(--transition);
  letter-spacing: 0.3px;
}

#endCallBtn:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(244, 67, 54, 0.5);
}

.wave {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  animation: waveAnim 2s infinite;
  pointer-events: none;
}

@keyframes waveAnim {
  0% {
    width: 0;
    height: 0;
    opacity: 0.8;
  }
  100% {
    width: 420px;
    height: 420px;
    opacity: 0;
  }
}

.loader {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  color: white;
  padding: 20px 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.loader-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.footer {
  position: fixed;
  bottom: 20px;
  width: 100%;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Tabs and Chat Styling */
.tabs-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: white;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.tab-buttons {
  display: flex;
  gap: 0;
  background: linear-gradient(to right, #f8f9fa, #ffffff);
  padding: 4px;
}

.tab-btn {
  flex: 1;
  padding: 14px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  transition: var(--transition);
  position: relative;
  margin: 0;
}

.tab-btn::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-color);
  transform: scaleX(0);
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--primary-color);
}

.tab-btn.active {
  color: var(--primary-color);
}

.tab-btn.active::after {
  transform: scaleX(1);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 600px;
  background: white;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(to bottom, #fafbfc, #ffffff);
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.35);
}

.message {
  display: flex;
  margin-bottom: 4px;
  animation: slideIn 0.3s ease;
}

.message.user-message {
  justify-content: flex-end;
  animation: slideInRight 0.3s ease;
}

.message.bot-message {
  justify-content: flex-start;
  animation: slideInLeft 0.3s ease;
}

.message-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 80%;
  min-width: 200px;
}

.message-content {
  padding: 12px 16px;
  border-radius: 16px;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
}

.user-message .message-content {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  border-bottom-right-radius: 4px;
}

.bot-message .message-content {
  background: linear-gradient(135deg, #f0f2f5, #e8eaed);
  color: var(--text-color);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-color);
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 0 4px;
  text-align: right;
}

.user-message .message-time {
  text-align: right;
}

.bot-message .message-time {
  text-align: left;
}

.message-audio {
  border-radius: 12px;
  overflow: visible;
  background: rgba(0, 0, 0, 0.05);
  padding: 10px 12px;
  max-width: 100%;
  min-width: 250px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.message-audio audio {
  width: 100%;
  min-width: 200px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  background: white;
  accent-color: var(--primary-color);
  -webkit-appearance: default;
  padding: 4px;
}

.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 14px;
  background: linear-gradient(to bottom, #fafbfc, #ffffff);
  border-top: 1px solid var(--border-color);
}

#chatTextInput {
  flex: 1;
  border: 1.5px solid var(--border-color);
  border-radius: 24px;
  padding: 11px 18px;
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
  background: white;
  color: var(--text-color);
  font-family: "Poppins", sans-serif;
}

#chatTextInput:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(10, 161, 167, 0.1);
}

#chatTextInput::placeholder {
  color: var(--text-secondary);
}

#sendTextBtn,
#recordVoiceBtn,
#stopRecordBtn {
  padding: 10px;
  border: none;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  border-radius: 50%;
  cursor: pointer;
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

#sendTextBtn:hover,
#recordVoiceBtn:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-md);
}

#sendTextBtn:active,
#recordVoiceBtn:active {
  transform: scale(0.96);
}

#recordVoiceBtn.recording {
  background: linear-gradient(135deg, var(--error-color), var(--error-light));
  animation: recordingPulse 1s ease-in-out infinite;
}

@keyframes recordingPulse {
  0%, 100% { box-shadow: var(--shadow-sm); }
  50% { box-shadow: 0 0 0 6px rgba(244, 67, 54, 0.3); }
}

.recording-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  color: #e65100;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 12px;
  margin: 0 14px 14px 14px;
  border: 1px solid #ffe0b2;
}

.recording-indicator span {
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0.6; }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes dotPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(0.8);
  }
}

.voice-loading,
.voice-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

.voice-loading .dot,
.voice-indicator .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: dotPulse 1.4s infinite;
}

.voice-loading .dot:nth-child(2),
.voice-indicator .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.voice-loading .dot:nth-child(3),
.voice-indicator .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@media (max-width: 600px) {
  .header {
    padding: 12px 20px;
  }

  .logo img,
  .logo-fallback {
    height: 48px;
    width: 48px;
    border-radius: 10px;
  }

  .logo-text {
    font-size: 1.1rem;
  }

  .card-title {
    font-size: 1.5rem;
  }

  .timer {
    font-size: 2.5rem;
  }

  .chat-container {
    height: 500px;
  }

  .message-content {
    max-width: 85%;
    padding: 10px 14px;
  }

  .avatar {
    font-size: 2.5rem;
  }

  .avatar-container {
    width: 120px;
    height: 120px;
  }

  .call-status {
    font-size: 1.25rem;
  }
}
