:root {
  --primary-color: #bb86fc;
  --secondary-color: #03dac6;
  --bg-color: #121212;
  --surface-color: #1e1e1e;
  --text-color: #e0e0e0;
  --text-secondary: #a0a0a0;
  --accent-gradient: linear-gradient(135deg, #bb86fc, #03dac6);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.chat-container {
  width: 90%;
  max-width: 600px;
  height: 85vh;
  background-color: var(--surface-color);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-header {
  padding: 20px 24px;
  background-color: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h1 {
  font-size: 1.25rem;
  letter-spacing: 0.5px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.user-count {
  font-size: 0.8rem;
  color: var(--secondary-color);
}

#chat-messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

#chat-messages::-webkit-scrollbar {
  width: 6px;
}

#chat-messages::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,0.1);
  border-radius: 10px;
}

.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.4;
  position: relative;
  transition: transform 0.2s ease;
}

.message:hover {
  transform: translateY(-2px);
}

.edit-btn {
    opacity: 0;
    position: absolute;
    right: 12px;
    bottom: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    font-size: 0.7rem;
    color: var(--text-color);
    padding: 2px 6px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.message:hover .edit-btn {
    opacity: 1;
}

.message.sent .edit-btn {
    background: rgba(0, 0, 0, 0.1);
    color: #121212;
}

.edited-tag {
    font-size: 0.65rem;
    opacity: 0.5;
    margin-left: 5px;
}

.message.received {
  align-self: flex-start;
  background: rgba(255,255,255,0.05);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255,255,255,0.03);
}

.message.sent {
  align-self: flex-end;
  background: var(--accent-gradient);
  color: #121212;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.message.system {
  align-self: center;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-style: italic;
  padding: 4px;
  opacity: 0.7;
}

.metadata {
  font-size: 0.7rem;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  opacity: 0.7;
}

.message.sent .metadata {
  color: #121212;
}

.chat-input-area {
  padding: 24px;
  background-color: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 12px;
}

input[type="text"], input[type="password"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 12px 18px;
  color: var(--text-color);
  font-size: 1rem;
  transition: all 0.3s ease;
  margin-bottom: 10px;
}

input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.08);
}

#upload-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 0 16px;
    font-size: 1.2rem;
}

#upload-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-image {
    max-width: 100%;
    margin-top: 10px;
    border-radius: 12px;
    display: block;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}


button {
  background: var(--accent-gradient);
  border: none;
  border-radius: 14px;
  padding: 0 24px;
  color: #121212;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

button:hover {
  transform: scale(1.02);
  opacity: 0.9;
}

button:active {
  transform: scale(0.98);
}

/* Modal Styling */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: var(--surface-color);
  padding: 32px;
  border-radius: 24px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-content h2 {
  margin-bottom: 24px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message {
  animation: fadeIn 0.3s ease forwards;
}
