@import url('https://fonts.googleapis.com/css2?family=Segoe+UI:wght@400;500;600&display=swap');

:root {
  --teams-purple: #464775;
  --teams-purple-hover: #6264A7;
  --teams-purple-light: rgba(98, 100, 167, 0.08);
  --teams-bg-white: #FFFFFF;
  --teams-bg-grey: #F5F5F5;
  --teams-border: #E1E1E1;
  --teams-text-primary: #252424;
  --teams-text-secondary: #616161;
  --teams-status-online: #6BB700;
  --teams-status-offline: #C4314B;
  --teams-hover: #F0F2F5;
  --teams-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --teams-toolbar: #F0F0F0;
  --nav-width: 48px;
  --sidebar-width: 340px;
  --header-height: 48px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', sans-serif;
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--teams-bg-white);
}

/* Main Layout */
.wrapper {
  display: grid;
  grid-template-columns: var(--nav-width) var(--sidebar-width) 1fr;
  width: 100vw;
  height: 100vh;
}

/* Left Navigation */
.nav-sidebar {
  background: #292929;
  width: var(--nav-width);
  height: 100%;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: none;
}

.nav-item {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0.8;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  opacity: 1;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.15);
  opacity: 1;
  color: #fff;
}

/* Users List */
.users {
  background: #F5F5F5;
  border-right: 1px solid var(--teams-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.users header {
  height: 56px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--teams-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.users header .content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.users header .user-avatar {
  position: relative;
}

.users header img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.users header .details span {
  font-size: 15px;
  font-weight: 600;
  color: var(--teams-text-primary);
}

.users header .details p {
  font-size: 13px;
  color: var(--teams-text-secondary);
}

.users header .logout {
  padding: 6px 16px;
  background: var(--teams-purple);
  color: white;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.users header .logout:hover {
  background: var(--teams-purple-hover);
  transform: translateY(-1px);
}

.users .search {
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--teams-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.users .search input {
  flex: 1;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--teams-border);
  border-radius: 4px;
  font-size: 14px;
  background: var(--teams-bg-grey);
  transition: all 0.2s ease;
}

.users .search input:focus {
  border-color: var(--teams-purple);
  box-shadow: 0 0 0 2px var(--teams-purple-light);
  outline: none;
  background: #fff;
}

.users .search button {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--teams-text-secondary);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.users .search button:hover {
  background: var(--teams-hover);
  color: var(--teams-text-primary);
}

.users-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #fff;
}

.users-list a {
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--teams-text-primary);
  transition: all 0.2s ease;
  text-decoration: none;
  position: relative;
}

.users-list a:hover {
  background: var(--teams-hover);
}

.users-list a.active {
  background: var(--teams-purple-light);
}

.users-list .user-avatar {
  position: relative;
}

.users-list .user-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.users-list .details {
  flex: 1;
  min-width: 0;
}

.users-list .details span {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--teams-text-primary);
  margin-bottom: 2px;
}

.users-list .details p {
  font-size: 13px;
  color: var(--teams-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

/* Chat Area */
.chat-area {
  display: flex;
  flex-direction: column;
  background: var(--teams-bg-white);
  height: 100vh;
}

.chat-area header {
  height: var(--header-height);
  padding: 0 16px;
  background: var(--teams-bg-white);
  border-bottom: 1px solid var(--teams-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-area header .back-icon {
  display: none;
}

.chat-area header .user-avatar {
  position: relative;
}

.chat-area header img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-area header .details {
  flex: 1;
}

.chat-area header .details span {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--teams-text-primary);
}

.chat-area header .details p {
  font-size: 12px;
  color: var(--teams-text-secondary);
}

.chat-area header .actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.chat-area header .action-btn {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teams-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-area header .action-btn:hover {
  background: var(--teams-hover);
  color: var(--teams-text-primary);
}

.chat-box {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #fff;
}

.chat {
  margin-bottom: 20px;
}

.outgoing {
  display: flex;
  justify-content: flex-end;
}

.outgoing .details {
  max-width: 60%;
}

.outgoing .details p {
  background: var(--teams-purple);
  color: white;
  padding: 12px 16px;
  border-radius: 8px 8px 0 8px;
  margin-left: auto;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
}

.incoming {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.incoming img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin-top: 4px;
}

.incoming .details {
  max-width: 60%;
}

.incoming .details p {
  background: #F0F0F0;
  color: var(--teams-text-primary);
  padding: 12px 16px;
  border-radius: 8px 8px 8px 0;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.typing-area {
  padding: 12px 16px;
  background: var(--teams-bg-white);
  border-top: 1px solid var(--teams-border);
  display: flex;
  gap: 12px;
  align-items: center;
}

.typing-area input {
  flex: 1;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--teams-border);
  border-radius: 4px;
  font-size: 14px;
  background: var(--teams-bg-white);
}

.typing-area input:focus {
  border-color: var(--teams-purple);
  box-shadow: 0 0 0 2px var(--teams-purple-light);
}

.typing-area button {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: var(--teams-purple);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.typing-area button:hover {
  background: var(--teams-purple-hover);
  transform: scale(1.05);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

/* Animations */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 1200px) {
  .wrapper {
    grid-template-columns: var(--nav-width) 280px 1fr;
  }
}

@media (max-width: 768px) {
  .wrapper {
    grid-template-columns: 1fr;
  }
  
  .nav-sidebar {
    display: none;
  }
  
  .users {
    display: none;
  }
  
  .chat-area header .back-icon {
    display: block;
  }
}

/* Empty State Improvements */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  background: #fff;
  text-align: center;
}

.empty-state i {
  font-size: 72px;
  color: var(--teams-purple);
  margin-bottom: 24px;
  opacity: 0.8;
}

.empty-state h3 {
  font-size: 24px;
  font-weight: 600;
  color: var(--teams-text-primary);
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 15px;
  color: var(--teams-text-secondary);
  max-width: 400px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.empty-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--teams-purple);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.new-chat-btn:hover {
  background: var(--teams-purple-hover);
  transform: translateY(-1px);
}

.new-chat-btn i {
  font-size: 16px;
  margin-bottom: 0;
  opacity: 1;
}

/* User Avatar Styling */
.user-avatar {
  position: relative;
  display: inline-block;
}

.user-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #f0f0f0;
}

.users header .user-avatar img {
  width: 36px;
  height: 36px;
}

.users-list .user-avatar img {
  width: 40px;
  height: 40px;
}

.chat-area header .user-avatar img {
  width: 32px;
  height: 32px;
}

/* Status Indicator */
.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  position: absolute;
  bottom: 0;
  right: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.status-online {
  background: var(--teams-status-online);
}

.status-offline {
  background: var(--teams-status-offline);
}

/* Message Time Stamps */
.message-time {
  font-size: 11px;
  color: var(--teams-text-secondary);
  margin-top: 4px;
  opacity: 0.8;
}

.outgoing .message-time {
  text-align: right;
}

/* Top Navigation Bar */
.top-nav {
  height: var(--header-height);
  background: var(--teams-bg-white);
  border-bottom: 1px solid var(--teams-border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-nav input {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--teams-border);
  border-radius: 4px;
  font-size: 13px;
  background: var(--teams-bg-grey);
  width: 300px;
  margin-left: auto;
}

.top-nav input:focus {
  border-color: var(--teams-purple);
  box-shadow: 0 0 0 2px var(--teams-purple-light);
  outline: none;
}

.supporter-badge {
  font-size: 11px;
  padding: 2px 6px;
  background: var(--teams-purple-light);
  color: var(--teams-purple);
  border-radius: 3px;
  margin-left: 6px;
  font-weight: 500;
}
