:root {
  --primary: #4361ee;
  --primary-dark: #3a0ca3;
  --primary-light: #4cc9f0;
  --secondary: #f72585;
  --light: #f8f9fa;
  --dark: #212529;
  --gray: #6c757d;
  --light-gray: #e9ecef;
  --white: #ffffff;
  --success: #4bb543;
  --ai-bubble: #f0f4ff;
  --user-bubble: #4361ee;
  --ai-text: #2d3436;
  --user-text: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #f5f7fa;
  color: var(--dark);
  line-height: 1.6;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

/* AI Chat Container */
.app-container {
  width: 100%;
  max-width: 900px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 15px 50px rgba(67, 97, 238, 0.15);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform: translateY(0);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.app-container:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 60px rgba(67, 97, 238, 0.2);
}

/* Header with animated gradient */
.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  z-index: 1;
  text-align: center;
}

.app-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to bottom right,
    rgba(255,255,255,0.2) 0%,
    rgba(255,255,255,0) 60%
  );
  transform: rotate(30deg);
  animation: shine 8s infinite linear;
}

@keyframes shine {
  0% { transform: rotate(30deg) translate(-30%, -30%); }
  100% { transform: rotate(30deg) translate(30%, 30%); }
}

.app-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  position: relative;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.app-header p {
  font-size: 0.95rem;
  opacity: 0.9;
  position: relative;
  max-width: 80%;
  margin: 0.5rem auto 0;
}

/* Chat area */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background-color: var(--white);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(67, 97, 238, 0.03) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(247, 37, 133, 0.03) 0%, transparent 20%);
  scrollbar-width: thin;
  scrollbar-color: var(--primary-light) transparent;
}

.chat-box::-webkit-scrollbar {
  width: 6px;
}

.chat-box::-webkit-scrollbar-track {
  background: transparent;
}

.chat-box::-webkit-scrollbar-thumb {
  background-color: var(--primary-light);
  border-radius: 3px;
}

/* Message bubbles */
.message {
  margin-bottom: 1.25rem;
  max-width: 85%;
  position: relative;
  animation: fadeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-message {
  align-items: flex-start;
  margin-right: auto;
}

.user-message {
  align-items: flex-end;
  margin-left: auto;
}

.message-bubble {
  padding: 0.85rem 1.25rem;
  border-radius: 1.25rem;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
  line-height: 1.5;
  font-size: 0.95rem;
  position: relative;
  overflow: hidden;
}

.ai-message .message-bubble {
  background-color: var(--ai-bubble);
  color: var(--ai-text);
  border-bottom-left-radius: 0.25rem;
  border-top-right-radius: 1.25rem;
}

.user-message .message-bubble {
  background: linear-gradient(135deg, var(--user-bubble) 0%, var(--primary-dark) 100%);
  color: var(--user-text);
  border-bottom-right-radius: 0.25rem;
  border-top-left-radius: 1.25rem;
  box-shadow: 0 3px 15px rgba(67, 97, 238, 0.2);
}

.message-time {
  font-size: 0.7rem;
  color: var(--gray);
  margin-top: 0.25rem;
  opacity: 0.8;
}

/* Input area */
.input-area {
  display: flex;
  padding: 1rem;
  background-color: var(--white);
  border-top: 1px solid rgba(0,0,0,0.05);
  position: relative;
}

#user-input {
  flex: 1;
  padding: 0.85rem 1.25rem 0.85rem 3rem;
  border-radius: 2rem;
  border: 1px solid rgba(0,0,0,0.08);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
  background-color: rgba(245, 246, 250, 0.8);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

#user-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
  background-color: var(--white);
}

.input-area::before {
  content: "✏️";
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  opacity: 0.6;
  z-index: 2;
}

#send-btn {
  width: 3rem;
  height: 3rem;
  margin-left: 0.75rem;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

#send-btn:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

#send-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Test cards */
.test-card {
  background-color: var(--white);
  border-radius: 0.85rem;
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0,0,0,0.03);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.test-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.test-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: linear-gradient(to bottom, var(--primary), var(--secondary));
}

.test-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

.test-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--gray);
}

.test-description {
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  color: var(--dark);
  line-height: 1.5;
}

.start-test-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 3px 10px rgba(67, 97, 238, 0.2);
  position: relative;
  overflow: hidden;
}

.start-test-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3);
}

.start-test-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.3) 50%,
    rgba(255,255,255,0) 100%
  );
  transform: translateX(-100%);
}

.start-test-btn:hover::after {
  animation: shineOver 1.5s infinite;
}

@keyframes shineOver {
  100% { transform: translateX(100%); }
}

/* Test list */
.test-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.test-list-item {
  background-color: var(--light);
  border-radius: 0.75rem;
  padding: 1rem;
  transition: all 0.3s ease;
  border: 1px solid rgba(0,0,0,0.05);
  position: relative;
  overflow: hidden;
}

.test-list-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.test-list-item h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
  color: var(--primary-dark);
  position: relative;
}

.test-list-item p {
  font-size: 0.85rem;
  color: var(--gray);
  margin-bottom: 0.5rem;
}

.test-list-item a {
  display: inline-flex;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.test-list-item a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.test-list-item a::after {
  content: "→";
  margin-left: 5px;
  transition: transform 0.2s ease;
}

.test-list-item a:hover::after {
  transform: translateX(3px);
}

/* Typing indicator */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background-color: var(--ai-bubble);
  border-radius: 1.25rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.typing-dot {
  width: 8px;
  height: 8px;
  background-color: var(--primary);
  border-radius: 50%;
  margin-right: 5px;
  animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  background-color: var(--primary);
  animation-delay: 0s;
}

.typing-dot:nth-child(2) {
  background-color: var(--secondary);
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  background-color: var(--primary-light);
  animation-delay: 0.4s;
}

@keyframes typingAnimation {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-container {
    height: 95vh;
    border-radius: 15px;
  }
  
  .app-header h1 {
    font-size: 1.5rem;
  }
  
  .message {
    max-width: 90%;
  }
  
  .test-list {
    grid-template-columns: 1fr;
  }
  
  .chat-box {
    padding: 1.25rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  
  .app-header {
    padding: 1.25rem 1rem;
  }
  
  .app-header p {
    font-size: 0.85rem;
  }
  
  .chat-box {
    padding: 1rem;
  }
  
  .input-area {
    padding: 0.85rem;
  }
  
  #user-input {
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    font-size: 0.9rem;
  }
  
  .input-area::before {
    left: 1.25rem;
    font-size: 1rem;
  }
  
  #send-btn {
    width: 2.75rem;
    height: 2.75rem;
  }
}

/* Dark mode toggle (optional) */
.dark-mode-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
  z-index: 100;
  transition: all 0.3s ease;
}

.dark-mode-toggle:hover {
  transform: scale(1.1);
}

/* Add this if you want to implement dark mode */
body.dark-mode {
  background-color: #121212;
  color: #e0e0e0;
}

body.dark-mode .app-container {
  background: rgba(30, 30, 30, 0.95);
  border-color: rgba(255,255,255,0.1);
}

body.dark-mode .app-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

body.dark-mode .chat-box {
  background-color: #1e1e1e;
}

body.dark-mode .ai-message .message-bubble {
  background-color: #2d2d2d;
  color: #e0e0e0;
}

body.dark-mode .test-card,
body.dark-mode .test-list-item {
  background-color: #2d2d2d;
  border-color: rgba(255,255,255,0.1);
  color: #e0e0e0;
}

body.dark-mode #user-input {
  background-color: #2d2d2d;
  color: #e0e0e0;
  border-color: rgba(255,255,255,0.1);
}