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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #f5f5f5;
  color: #333;
}

/* ===== AUTH PAGE ===== */
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.card h1 {
  font-size: 2em;
  margin-bottom: 10px;
  color: #2563eb;
  text-align: center;
}

.card .tagline {
  text-align: center;
  color: #999;
  margin-bottom: 30px;
}

.card input {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.card input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.card button {
  width: 100%;
  padding: 12px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}

.card button:hover {
  background: #1d4ed8;
}

.toggle {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
}

.toggle a {
  color: #2563eb;
  cursor: pointer;
  text-decoration: underline;
}

.error {
  color: #dc2626;
  background: #fee2e2;
  padding: 12px;
  border-radius: 4px;
  margin-top: 20px;
  font-size: 14px;
}

.success {
  color: #16a34a;
  background: #dcfce7;
  padding: 12px;
  border-radius: 4px;
  margin-top: 20px;
  font-size: 14px;
}

/* ===== APP LAYOUT ===== */
.app-layout {
  display: flex;
  height: 100vh;
  background: white;
}

.sidebar {
  width: 250px;
  background: #1f2937;
  color: white;
  padding: 20px;
  overflow-y: auto;
  border-right: 1px solid #ddd;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 20px;
}

.sidebar-header h2 {
  font-size: 1.3em;
  color: #60a5fa;
  margin: 0;
}

.sidebar-header p {
  margin: 0;
}

.profile-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 1.2em;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 6px;
  transition: all 0.2s;
}

.profile-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 15px 0;
}

.sidebar-section {
  margin-bottom: 25px;
}

.sidebar-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.sidebar-section h3 {
  font-size: 0.85em;
  text-transform: uppercase;
  color: #9ca3af;
  margin: 0;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.btn-icon {
  background: rgba(96, 165, 250, 0.2);
  border: 1px solid rgba(96, 165, 250, 0.4);
  color: #60a5fa;
  font-size: 1.1em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
  width: auto;
  margin-top: 0;
  font-weight: bold;
}

.btn-icon:hover {
  background: rgba(96, 165, 250, 0.3);
  border-color: rgba(96, 165, 250, 0.6);
}

.groups-list {
  list-style: none;
  margin-bottom: 15px;
}

.group-item {
  padding: 10px;
  margin-bottom: 8px;
  background: #374151;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.group-item:hover,
.group-item.active {
  background: #4b5563;
}

.group-item.unread {
  font-weight: bold;
  background: #2563eb;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-logout,
.btn-danger,
.btn-small {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-primary {
  background: #2563eb;
  color: white;
  margin-top: 15px;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: #e5e7eb;
  color: #333;
  margin-top: 10px;
}

.btn-secondary:hover {
  background: #d1d5db;
}

.btn-logout {
  background: #dc2626;
  color: white;
  margin-top: 30px;
}

.btn-logout:hover {
  background: #b91c1c;
}

.btn-danger {
  background: #dc2626;
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-small {
  width: auto;
  padding: 8px 12px;
  font-size: 12px;
  margin-right: 5px;
  background: #e5e7eb;
  color: #333;
}

.btn-small:hover {
  background: #d1d5db;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-header {
  padding: 12px 30px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
  color: #666;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.welcome-card {
  padding: 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
}

.welcome-card h2 {
  font-size: 1.8em;
  margin-bottom: 15px;
  color: #1f2937;
}

.welcome-card p {
  color: #6b7280;
  font-size: 1.1em;
}

/* ===== GROUP VIEW ===== */
.group-header {
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f9fafb;
}

.group-header h2 {
  margin: 0;
}

.group-actions {
  display: flex;
  gap: 10px;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  animation: slideIn 0.3s ease;
}

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

.message.own {
  justify-content: flex-end;
}

.message-content {
  max-width: 60%;
  padding: 10px 15px;
  border-radius: 8px;
  word-wrap: break-word;
}

.message:not(.own) .message-content {
  background: #e5e7eb;
  color: #1f2937;
}

.message.own .message-content {
  background: #2563eb;
  color: white;
}

.message-author {
  font-weight: 600;
  font-size: 0.85em;
  margin-bottom: 2px;
  color: #6b7280;
}

.message.own .message-author {
  color: #93c5fd;
  text-align: right;
}

.message-time {
  font-size: 0.75em;
  color: #9ca3af;
  margin-top: 2px;
}

.message.own .message-time {
  color: #dbeafe;
  text-align: right;
}

.message-input-area {
  padding: 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 10px;
  background: white;
}

.message-input-area input {
  flex: 1;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.message-input-area input:focus {
  outline: none;
  border-color: #2563eb;
}

.message-input-area button {
  padding: 12px 25px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}

.message-input-area button:hover {
  background: #1d4ed8;
}

/* ===== PANELS ===== */
.panel {
  padding: 30px;
  max-width: 700px;
  margin: 30px auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  animation: fadeIn 0.3s ease;
}

.panel h2 {
  margin: 0 0 8px 0;
  font-size: 1.5em;
  color: #1f2937;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.form-group input {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.form-group input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.form-group button {
  padding: 12px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}

.form-group button:hover {
  background: #1d4ed8;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  padding: 15px;
  background: #f3f4f6;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-item-info {
  flex: 1;
}

.list-item-name {
  font-weight: 600;
  color: #1f2937;
}

.list-item-email {
  font-size: 0.85em;
  color: #6b7280;
  margin-top: 2px;
}

.list-item button {
  padding: 6px 12px;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.list-item button:hover {
  background: #b91c1c;
}

/* Notification banner */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #2563eb;
  color: white;
  padding: 15px 20px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  animation: slideInRight 0.3s ease;
  max-width: 300px;
  z-index: 1000;
}

@keyframes slideInRight {
  from {
    transform: translateX(350px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #ddd;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .sidebar-section {
    margin-bottom: 0;
  }

  .groups-list {
    display: none;
  }

  .btn-primary,
  .btn-secondary,
  .btn-logout {
    width: auto;
  }

  .message-content {
    max-width: 80%;
  }

  .group-actions {
    flex-wrap: wrap;
  }

  .panel {
    margin: 20px;
    padding: 20px;
  }
}
