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

body {
  font-family: Tahoma, Arial, sans-serif;
  font-size: 12px;
  background: #e8f0f8;
  color: #333;
}

/* ========================================
   HEADER
======================================== */

.chat-header {
  height: 60px;
  background: linear-gradient(to bottom, #5b9bd5 0%, #2e75b6 100%);
  border-bottom: 2px solid #1f5a99;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-logo img {
  height: 38px;
  width: auto;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.username {
  color: white;
  font-size: 13px;
  font-weight: bold;
  margin-right: 10px;
}

.header-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
}

.header-btn:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.5);
}

/* ========================================
   MAIN CONTAINER
======================================== */

.main-container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 20px;
}

/* ========================================
   SEARCH BAR
======================================== */

.search-bar {
  background: white;
  padding: 15px 20px;
  border-radius: 8px 8px 0 0;
  border: 1px solid #d0d0d0;
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: 15px;
}

.search-label {
  font-size: 14px;
  font-weight: bold;
  color: #2e75b6;
  white-space: nowrap;
}

.search-box {
  flex: 1;
  position: relative;
  max-width: 300px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #888;
}

.search-box input {
  width: 100%;
  padding: 8px 10px 8px 35px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
}

.search-box input:focus {
  border-color: #5b9bd5;
  box-shadow: 0 0 0 2px rgba(91, 155, 213, 0.1);
}

.create-room-btn {
  background: #28a745;
  border: none;
  color: white;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.create-room-btn:hover {
  background: #218838;
}

/* ========================================
   ROOM LIST
======================================== */

.room-list {
  background: white;
  padding: 20px;
  border-radius: 0 0 8px 8px;
  border: 1px solid #d0d0d0;
  min-height: 500px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 14px;
}

.room-card {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.room-card:hover {
  background: #f0f7ff;
  border-color: #5b9bd5;
  box-shadow: 0 2px 8px rgba(91, 155, 213, 0.2);
}

.room-logo {
  width: 48px;
  height: 35px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  background: #e0e0e0;
}

.room-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.room-info {
  flex: 1;
  min-width: 0;
}

.room-name {
  font-size: 13px;
  font-weight: bold;
  color: #2e75b6;
  margin-bottom: 4px;
}

.room-moderators {
  font-size: 11px;
  color: #666;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.moderator-icon {
  width: 12px;
  height: 12px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="%23666" d="M8 0L10.5 5.5L16 6.3L12 10.2L13 16L8 13.3L3 16L4 10.2L0 6.3L5.5 5.5L8 0z"/></svg>') no-repeat center;
  background-size: contain;
}

.room-description {
  font-size: 11px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.room-users {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #333;
}

.user-icon {
  width: 14px;
  height: 14px;
}

.room-features {
  display: flex;
  gap: 5px;
}

.feature-icon {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.feature-icon.active {
  opacity: 1;
}

/* ========================================
   MODAL
======================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 8px;
  padding: 30px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.modal-content h2 {
  margin-bottom: 10px;
  color: #2e75b6;
  font-size: 18px;
}

.modal-info {
  margin-bottom: 20px;
  color: #666;
  font-size: 12px;
}

.modal-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
  background: none;
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #2e75b6;
}

.tab-btn.active {
  color: #2e75b6;
  font-weight: bold;
  border-bottom-color: #2e75b6;
}

.form-panel {
  animation: fadeIn 0.3s ease;
}

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

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  color: #333;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
}

.form-group input:focus {
  border-color: #5b9bd5;
  box-shadow: 0 0 0 2px rgba(91, 155, 213, 0.1);
}

.form-group input[type="checkbox"] {
  margin-right: 5px;
}

.form-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-primary,
.btn-secondary {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #2e75b6;
  color: white;
}

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

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

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

.error-message {
  margin-top: 10px;
  padding: 8px;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  color: #721c24;
  font-size: 11px;
  display: none;
}

.error-message.show {
  display: block;
}

/* ========================================
   RESPONSIVE
======================================== */

@media (max-width: 768px) {
  .search-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: none;
  }

  .room-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .room-stats {
    align-self: flex-end;
  }
}
