:root {
  --primary-color: #4A90E2;
  --primary-hover: #357ABD;
  --bg-color: #F7F9FC;
  --surface-color: #FFFFFF;
  --text-main: #2C3E50;
  --text-muted: #7F8C8D;
  --border-color: #E1E8ED;
  --danger-color: #E74C3C;
  --danger-hover: #C0392B;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --border-radius: 12px;
  --transition: all 0.2s ease-in-out;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Header & Typography */
h1, h2, h3 {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 1.8rem;
  letter-spacing: -0.5px;
}

.header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Card / Surface */
.card {
  background-color: var(--surface-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-main);
  font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  transition: var(--transition);
  outline: none;
  background-color: #FAFAFA;
  font-family: inherit;
}

textarea {
  resize: vertical;
  min-height: 48px;
  max-height: 200px;
  line-height: 1.5;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
  background-color: #FFF;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  width: 100%;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background-color: var(--danger-hover);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  width: auto;
}

/* Room List (Admin) */
.room-list {
  list-style: none;
}

.room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  background-color: #FAFAFA;
  transition: var(--transition);
}

.room-item:hover {
  background-color: #FFF;
  box-shadow: var(--shadow-sm);
  border-color: #D1D9E0;
}

.room-info {
  display: flex;
  flex-direction: column;
}

.room-name {
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.room-url {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Chat Interface */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 85vh;
  max-width: 800px;
  margin: 2vh auto;
  background: var(--surface-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.chat-header {
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.chat-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.chat-messages {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: fadeIn 0.3s ease-out;
}

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

.message-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  display: flex;
  gap: 0.5rem;
}

.message-author {
  font-weight: 600;
  color: var(--text-main);
}

.message-content {
  background-color: #FFF;
  padding: 0.85rem 1.15rem;
  border-radius: 12px 12px 12px 0;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  font-size: 0.95rem;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message.self {
  align-self: flex-end;
}

.message.self .message-meta {
  justify-content: flex-end;
}

.message.self .message-content {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 12px 12px 0 12px;
}

.chat-input-area {
  padding: 1.25rem 1.5rem;
  background-color: #FFF;
  border-top: 1px solid var(--border-color);
}

.chat-form {
  display: flex;
  gap: 0.75rem;
}

.chat-form input[type="text"],
.chat-form textarea {
  flex: 1;
}

.chat-form button {
  width: auto;
  padding: 0 2rem;
}

.name-setup {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.name-setup input {
  max-width: 200px;
}

/* Utilities */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* Responsive */
@media (max-width: 600px) {
  .chat-container {
    height: 100vh;
    margin: 0;
    border-radius: 0;
  }
  
  .chat-form {
    flex-direction: column;
  }
  
  .chat-form button {
    width: 100%;
    padding: 0.75rem;
  }
  
  .name-setup {
    flex-direction: column;
    align-items: stretch;
  }
  
  .name-setup input {
    max-width: 100%;
  }
  
  .message {
    max-width: 90%;
  }
}
