* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

:root {
  --primary: #4a86e8;
  --primary-dark: #3a76d8;
  --secondary: #6c757d;
  --light: #f8f9fa;
  --dark: #212529;
  --border: #dee2e6;
  --shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  --success: #28a745;
  --danger: #dc3545;
}

body {
  background-color: #f5f5f5;
  color: var(--dark);
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  background-color: var(--primary);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
}

#user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#profile-pic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #fff;
  background-size: cover;
  background-position: center;
}

#main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#sidebar {
  width: 250px;
  background-color: white;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

#tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
  color: var(--secondary);
  transition: background-color 0.2s, color 0.2s;
}

.tab-btn:hover {
  background-color: #f8f9fa;
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

#online-users {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

#online-users h3 {
  margin-bottom: 1rem;
  color: var(--secondary);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#users-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.user-item:hover {
  background-color: #f8f9fa;
}

.user-item-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
}

.user-item-name {
  font-weight: 500;
}

#content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.view {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 1rem;
}

.view.active {
  display: block;
}

/* Feed View Styles */
#post-form {
  background-color: white;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

#post-text {
  width: 100%;
  min-height: 80px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  resize: none;
}

#post-media-preview {
  margin-bottom: 1rem;
  max-height: 300px;
  overflow: hidden;
  border-radius: 5px;
}

#post-media-preview img, 
#post-media-preview video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 5px;
}

#post-actions {
  display: flex;
  justify-content: space-between;
}

#attach-media {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  color: var(--secondary);
}

#attach-media:hover {
  background-color: #f8f9fa;
}

#submit-post {
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 5px;
  padding: 0.5rem 1.5rem;
  cursor: pointer;
  font-weight: 500;
}

#submit-post:hover {
  background-color: var(--primary-dark);
}

#posts-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-item {
  background-color: white;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.post-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
}

.post-user {
  font-weight: 600;
}

.post-timestamp {
  color: var(--secondary);
  font-size: 0.85rem;
  margin-left: auto;
}

.post-content {
  margin-bottom: 1rem;
}

.post-text {
  margin-bottom: 1rem;
  white-space: pre-wrap;
}

.post-media {
  max-height: 400px;
  overflow: hidden;
  border-radius: 5px;
}

.post-media img, 
.post-media video {
  max-width: 100%;
  max-height: 400px;
  border-radius: 5px;
}

.post-actions {
  display: flex;
  gap: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.post-action {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
}

.post-action:hover {
  background-color: #f8f9fa;
}

/* Messages View Styles */
#messages-view {
  display: flex;
  height: 100%;
}

#conversations-list {
  width: 300px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.conversation-item:hover {
  background-color: #f8f9fa;
}

.conversation-item.active {
  background-color: #f0f7ff;
}

.conversation-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
}

.conversation-info {
  flex: 1;
}

.conversation-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.conversation-preview {
  color: var(--secondary);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

#chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

#chat-header {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  margin-bottom: 1rem;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message-item {
  max-width: 75%;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  position: relative;
  word-break: break-word;
}

.message-item.sent {
  align-self: flex-end;
  background-color: var(--primary);
  color: white;
  border-bottom-right-radius: 5px;
}

.message-item.received {
  align-self: flex-start;
  background-color: #f1f1f1;
  border-bottom-left-radius: 5px;
}

.message-time {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.8);
  position: absolute;
  bottom: 0.25rem;
  right: 0.75rem;
}

.message-item.received .message-time {
  color: var(--secondary);
}

#chat-input-container {
  display: flex;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

#chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.75rem 1rem;
  resize: none;
  max-height: 100px;
  overflow-y: auto;
}

#send-message {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#send-message:disabled {
  background-color: var(--secondary);
  cursor: not-allowed;
}

/* Profile View Styles */
#profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

#profile-pic-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background-color: #eee;
  background-size: cover;
  background-position: center;
}

#user-posts-container {
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

#user-posts-container h3 {
  margin-bottom: 1.5rem;
}

#user-posts {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Auth View Styles */
#auth-view {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.auth-container {
  background-color: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 500px;
  overflow: hidden;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.auth-tab-btn {
  flex: 1;
  padding: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
  color: var(--secondary);
  transition: background-color 0.2s, color 0.2s;
}

.auth-tab-btn:hover {
  background-color: #f8f9fa;
  color: var(--primary);
}

.auth-tab-btn.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

.auth-form {
  display: none;
  padding: 2rem;
}

.auth-form.active {
  display: block;
}

.auth-form h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--primary);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 1rem;
}

.auth-button {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.auth-button:hover {
  background-color: var(--primary-dark);
}

.error-message {
  color: var(--danger);
  margin-top: 1rem;
  text-align: center;
}

#avatar-preview {
  margin-top: 0.5rem;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: #eee;
  background-size: cover;
  background-position: center;
}