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

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #2d3748;
  background: #fafafa;
  line-height: 1.6;
}

/* Views */
.view {
  min-height: 100vh;
}

/* Auth View */
.auth-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 40px 24px;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header h1 {
  font-size: 32px;
  margin-bottom: 8px;
}

.auth-header p {
  color: #718096;
}

.auth-form {
  background: white;
  padding: 32px;
  border-radius: 12px;
  border: 1px solid #e8e4f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.auth-form h2 {
  margin-bottom: 24px;
  text-align: center;
}

.auth-form input {
  width: 100%;
  padding: 12px;
  border: 1px solid #e8e4f0;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.auth-form input:focus {
  outline: none;
  border-color: #8b7fc7;
}

.auth-form button {
  width: 100%;
  padding: 12px;
  background: #8b7fc7;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.auth-form button:hover {
  background: #7a6eb5;
}

.auth-links {
  margin-top: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-links a {
  color: #8b7fc7;
  text-decoration: none;
  font-size: 13px;
}

.auth-links a:hover {
  text-decoration: underline;
}

.help-text {
  color: #718096;
  font-size: 13px;
  margin-bottom: 16px;
}

.error {
  color: #e53e3e;
  font-size: 13px;
  margin-top: 16px;
  padding: 8px;
  background: #fff5f5;
  border-radius: 4px;
  display: none;
}

.error:not(:empty) {
  display: block;
}

.success {
  color: #38a169;
  font-size: 13px;
  margin-top: 16px;
  padding: 8px;
  background: #f0fff4;
  border-radius: 4px;
  display: none;
}

.success:not(:empty) {
  display: block;
}

/* App Header */
.app-header {
  background: white;
  border-bottom: 1px solid #e8e4f0;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left h1 {
  font-size: 20px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: #e8e4f0;
}

.avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  background: #e8e4f0;
}

.btn-secondary {
  padding: 8px 16px;
  background: #f7fafc;
  color: #2d3748;
  border: 1px solid #e8e4f0;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary {
  padding: 12px 24px;
  background: #8b7fc7;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #7a6eb5;
}

/* Tabs */
.tabs {
  background: white;
  border-bottom: 1px solid #e8e4f0;
  padding: 0 24px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.tab {
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #718096;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab:hover {
  color: #2d3748;
}

.tab.active {
  color: #8b7fc7;
  border-bottom-color: #8b7fc7;
}

/* Content */
.app-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.content-section h2 {
  margin-bottom: 24px;
}

/* Chat Layout */
.chat-layout {
  display: grid;
  gap: 24px;
}

.chat-main {
  background: white;
  border-radius: 12px;
  border: 1px solid #e8e4f0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 250px);
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid #e8e4f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h2 {
  margin: 0;
  font-size: 18px;
}

.room-selector select {
  padding: 8px 12px;
  border: 1px solid #e8e4f0;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 12px;
  animation: fadeIn 0.3s;
}

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

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #e8e4f0;
  flex-shrink: 0;
}

.message-content {
  flex: 1;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.message-name {
  font-weight: 600;
  color: #2d3748;
}

.message-time {
  font-size: 12px;
  color: #a0aec0;
}

.message-text {
  color: #4a5568;
  word-wrap: break-word;
}

.chat-input {
  padding: 16px 24px;
  border-top: 1px solid #e8e4f0;
  display: flex;
  gap: 8px;
}

.chat-input input {
  flex: 1;
  padding: 12px;
  border: 1px solid #e8e4f0;
  border-radius: 8px;
  font-size: 14px;
}

.chat-input input:focus {
  outline: none;
  border-color: #8b7fc7;
}

.chat-input button {
  padding: 12px 24px;
  background: #8b7fc7;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-input button:hover {
  background: #7a6eb5;
}

/* Members Grid */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.member-card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #e8e4f0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.member-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  background: #e8e4f0;
  position: relative;
}

.member-info {
  flex: 1;
}

.member-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.member-email {
  font-size: 13px;
  color: #718096;
  margin-bottom: 4px;
}

.member-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
}

.member-status.online {
  background: #c6f6d5;
  color: #22543d;
}

.member-status.offline {
  background: #fed7d7;
  color: #742a2a;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* Profile Card */
.profile-card {
  background: white;
  padding: 32px;
  border-radius: 12px;
  border: 1px solid #e8e4f0;
  max-width: 600px;
}

.profile-avatar-section {
  text-align: center;
  margin-bottom: 32px;
}

.profile-avatar-section .avatar-large {
  margin-bottom: 16px;
}

.info-row {
  display: flex;
  padding: 16px 0;
  border-bottom: 1px solid #e8e4f0;
}

.info-row:last-child {
  border-bottom: none;
}

.info-row label {
  font-weight: 600;
  width: 150px;
  color: #718096;
}

.info-row span {
  flex: 1;
  color: #2d3748;
}

/* Premium Card */
.premium-card {
  background: white;
  padding: 32px;
  border-radius: 12px;
  border: 1px solid #e8e4f0;
  max-width: 500px;
}

.premium-card h3 {
  margin-bottom: 16px;
  color: #8b7fc7;
}

.premium-card p {
  color: #718096;
  margin-bottom: 16px;
}

.premium-card ul {
  list-style: none;
  margin-bottom: 24px;
}

.premium-card li {
  padding: 8px 0;
  color: #4a5568;
}

.price {
  font-size: 32px;
  font-weight: 700;
  color: #8b7fc7;
  margin-bottom: 24px;
}

#premiumStatus {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
}

#premiumStatus.success {
  background: #c6f6d5;
  color: #22543d;
}

/* Weather Card */
.weather-card {
  background: white;
  padding: 32px;
  border-radius: 12px;
  border: 1px solid #e8e4f0;
  max-width: 500px;
}

.weather-card form {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.weather-card input {
  flex: 1;
  padding: 12px;
  border: 1px solid #e8e4f0;
  border-radius: 8px;
  font-size: 14px;
}

.weather-card button {
  padding: 12px 24px;
  background: #8b7fc7;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

#weatherResult {
  padding: 24px;
  background: #f7fafc;
  border-radius: 8px;
}

.weather-info {
  display: grid;
  gap: 16px;
}

.weather-main {
  text-align: center;
  padding-bottom: 16px;
  border-bottom: 1px solid #e8e4f0;
}

.weather-temp {
  font-size: 48px;
  font-weight: 700;
  color: #8b7fc7;
}

.weather-desc {
  font-size: 18px;
  color: #718096;
  text-transform: capitalize;
}

.weather-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.weather-detail {
  padding: 12px;
  background: white;
  border-radius: 8px;
}

.weather-detail-label {
  font-size: 12px;
  color: #718096;
  margin-bottom: 4px;
}

.weather-detail-value {
  font-size: 16px;
  font-weight: 600;
  color: #2d3748;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.stat-card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #e8e4f0;
}

.stat-label {
  font-size: 13px;
  color: #718096;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: #8b7fc7;
}

.stat-date {
  font-size: 12px;
  color: #a0aec0;
  margin-top: 4px;
}

/* AI Chat */
.ai-chat {
  background: white;
  border-radius: 12px;
  border: 1px solid #e8e4f0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 250px);
}

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-message {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeIn 0.3s;
}

.ai-message.user {
  align-items: flex-end;
}

.ai-message-label {
  font-size: 12px;
  color: #718096;
  font-weight: 600;
}

.ai-message-content {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 80%;
}

.ai-message.user .ai-message-content {
  background: #8b7fc7;
  color: white;
}

.ai-message.assistant .ai-message-content {
  background: #f7fafc;
  color: #2d3748;
}

.ai-input {
  padding: 16px 24px;
  border-top: 1px solid #e8e4f0;
  display: flex;
  gap: 8px;
}

.ai-input input {
  flex: 1;
  padding: 12px;
  border: 1px solid #e8e4f0;
  border-radius: 8px;
  font-size: 14px;
}

.ai-input button {
  padding: 12px 24px;
  background: #8b7fc7;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    gap: 16px;
  }

  .tabs {
    overflow-x: auto;
  }

  .members-grid {
    grid-template-columns: 1fr;
  }

  .weather-details {
    grid-template-columns: 1fr;
  }
}
