:root {
  --user-color: #2563eb;
  --ai-color: #f3f4f6;
  --text-dark: #1e293b;
  --background: #f8fafc;
  --border: #e2e8f0;
  --hover-bg: #eff6ff;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', sans-serif;
  background: var(--background);
  color: var(--text-dark);
}

.container {
  width: 100%;
  max-width: 1080px;
  height: 85vh;
  margin: 40px auto;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  background: white;
  padding: 0 20px 20px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.chat-header {
  font-size: 1.6rem;
  text-align: center;
  font-weight: 600;
  padding: 24px 0 12px;
  border-bottom: 1px solid var(--border);
  color: #0f172a;
  background: #ffffffcc;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-message {
  padding: 14px 18px;
  border-radius: 14px;
  max-width: 80%;
  font-size: 1rem;
  line-height: 1.6;
  box-shadow: 0 3px 8px rgba(0,0,0,0.04);
  word-break: break-word;
}

.user-message {
  align-self: flex-end;
  background-color: var(--user-color);
  color: white;
  border-bottom-right-radius: 0;
  font-weight: 500;
}

.ai-message {
  align-self: flex-start;
  background-color: var(--ai-color);
  color: var(--text-dark);
  border: 1px solid var(--border);
  border-bottom-left-radius: 0;
}

.chat-input-area {
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding: 18px 0 0;
  background-color: white;
  position: sticky;
  bottom: 0;
  z-index: 2;
}

input[type="text"],
input[type="email"] {
  flex: 1;
  padding: 14px 16px;
  font-size: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  outline: none;
  background-color: #f9fafb;
  transition: border 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus {
  border-color: var(--user-color);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

button {
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background-color: var(--user-color);
  color: white;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

button:hover {
  background-color: #1d4ed8;
}

.upload-label {
  padding: 0 10px;
  font-size: 22px;
  color: #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.upload-label:hover {
  background-color: var(--hover-bg);
}

#file-preview {
  font-size: 0.85rem;
  color: #475569;
  text-align: center;
  margin-top: 6px;
}

#email-delivery-section {
  margin-top: 24px;
  display: none;
  text-align: center;
}

@media screen and (max-width: 1024px) {
  .container {
    height: 90vh;
    margin: 20px;
    padding: 0 16px 16px;
    border-radius: 14px;
  }
}

@media screen and (max-width: 600px) {
  .container {
    height: 92vh;
    margin: 10px;
    border-radius: 12px;
    padding: 0 12px 12px;
  }

  .chat-message {
    font-size: 0.95rem;
    padding: 12px 14px;
  }

  .chat-header {
    font-size: 1.3rem;
    padding: 16px 0;
  }

  .chat-input-area {
    flex-direction: column;
    gap: 10px;
  }

  button,
  input[type="text"],
  input[type="email"] {
    width: 100%;
  }
}
