/* Base Styles */
:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;
  --primary: 262 83.3% 57.8%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 262 83.3% 57.8%;
  --radius: 0.5rem;
}

.dark {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 4.9%;
  --card-foreground: 210 40% 98%;
  --popover: 222.2 84% 4.9%;
  --popover-foreground: 210 40% 98%;
  --primary: 262 83.3% 57.8%;
  --primary-foreground: 210 40% 98%;
  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 40% 98%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 262 83.3% 57.8%;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
    "Helvetica Neue", sans-serif;
  line-height: 1.6;
  color: hsl(var(--foreground));
  background: linear-gradient(to bottom, #111827, #000000);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-weight: 500;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 0.875rem;
  gap: 0.5rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.btn-primary:hover {
  background-color: hsl(var(--primary) / 0.9);
}

.btn-outline {
  background-color: transparent;
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
}

.btn-outline:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: transparent;
  color: hsl(var(--muted-foreground));
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  width: 2.5rem;
  height: 2.5rem;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-nav {
  display: none;
}

@media (min-width: 768px) {
  .main-nav {
    display: flex;
    gap: 2rem;
  }

  .main-nav a {
    color: hsl(var(--foreground));
    transition: color 0.2s ease;
  }

  .main-nav a:hover {
    color: hsl(var(--primary));
  }
}

/* Hero Section */
.hero {
  padding: 5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-content {
  max-width: 48rem;
  margin-bottom: 4rem;
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  background: linear-gradient(to right, hsl(var(--primary)), #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 2.5rem;
}

.hero-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

@media (min-width: 640px) {
  .hero-buttons {
    flex-direction: row;
    justify-content: center;
  }
}

/* Chat Preview */
.chat-preview {
  position: relative;
  width: 100%;
  max-width: 24rem;
  border-radius: var(--radius);
  overflow: hidden;
  background-color: #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.chat-preview::before {
  content: "";
  position: absolute;
  inset: -0.5px;
  background: linear-gradient(to right, hsl(var(--primary)), #a855f7);
  border-radius: calc(var(--radius) + 0.5px);
  z-index: -1;
  opacity: 0.75;
  filter: blur(8px);
}

.chat-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid hsl(var(--border));
}

.chat-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.avatar {
  width: 2rem;
  height: 2rem;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.chat-messages {
  padding: 1rem;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  margin-bottom: 1rem;
}

.message.received {
  align-self: flex-start;
}

.message.sent {
  align-self: flex-end;
  margin-left: auto;
}

.message-content {
  padding: 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.received .message-content {
  background-color: hsl(var(--secondary));
  border-top-left-radius: 0;
}

.sent .message-content {
  background-color: hsl(var(--primary) / 0.2);
  border-top-right-radius: 0;
}

.message-time {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
  text-align: right;
}

/* Features Section */
.features {
  padding: 5rem 0;
}

.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-header h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.section-header p {
  max-width: 36rem;
  margin: 0 auto;
  color: hsl(var(--muted-foreground));
}

.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 640px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.feature-card {
  background-color: hsl(var(--card) / 0.5);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.2s ease;
}

.feature-card:hover {
  border-color: hsl(var(--primary) / 0.5);
}

.feature-icon {
  width: 3rem;
  height: 3rem;
  background-color: hsl(var(--primary) / 0.2);
  color: hsl(var(--primary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
}

/* How It Works Section */
.how-it-works {
  padding: 5rem 0;
}

.timeline {
  position: relative;
  max-width: 48rem;
  margin: 0 auto;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 1.5rem;
  width: 2px;
  background: linear-gradient(to bottom, hsl(var(--primary) / 0.8), hsl(var(--primary) / 0.2));
}

@media (min-width: 768px) {
  .timeline::before {
    left: 50%;
    transform: translateX(-50%);
  }
}

.timeline-item {
  position: relative;
  padding-left: 4rem;
  margin-bottom: 3rem;
}

@media (min-width: 768px) {
  .timeline-item {
    padding-left: 0;
    width: 50%;
  }

  .timeline-item:nth-child(odd) {
    margin-left: auto;
    padding-left: 3rem;
  }

  .timeline-item:nth-child(even) {
    margin-right: auto;
    padding-right: 3rem;
    text-align: right;
  }
}

.timeline-number {
  position: absolute;
  left: 0;
  top: 0;
  width: 3rem;
  height: 3rem;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  z-index: 1;
}

@media (min-width: 768px) {
  .timeline-item:nth-child(odd) .timeline-number {
    left: -1.5rem;
  }

  .timeline-item:nth-child(even) .timeline-number {
    right: -1.5rem;
    left: auto;
  }
}

.timeline-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.timeline-content p {
  color: hsl(var(--muted-foreground));
}

/* Footer */
.main-footer {
  padding: 2rem 0;
  text-align: center;
  border-top: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.social-link {
  width: 2.5rem;
  height: 2.5rem;
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.social-link:hover {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

/* Chat Page Styles */
.chat-page {
  background: #0f172a;
  height: 100vh;
  overflow: hidden;
}

.chat-container {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 320px;
  background-color: #1e293b;
  border-right: 1px solid hsl(var(--border));
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid hsl(var(--border));
}

.sidebar-header .logo {
  font-size: 0.875rem;
}

.sidebar-header .logo-icon {
  width: 2rem;
  height: 2rem;
}

.user-status {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

.status-indicator {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
}

.status-indicator.online {
  background-color: #10b981;
}

.user-address {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-container {
  padding: 1rem;
}

.search-input-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: hsl(var(--muted-foreground));
}

.search-input {
  width: 100%;
  padding: 0.5rem 0.5rem 0.5rem 2.25rem;
  background-color: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  color: hsl(var(--foreground));
  font-size: 0.875rem;
}

.search-input:focus {
  outline: none;
  border-color: hsl(var(--primary));
}

.contacts-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.5rem;
}

.contacts-header {
  padding: 0.5rem 0.5rem 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
  font-weight: 600;
}

.contact {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.contact:hover,
.contact.active {
  background-color: hsl(var(--secondary));
}

.contact.active {
  background-color: hsl(var(--primary) / 0.15);
}

.contact-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.contact-info {
  overflow: hidden;
}

.contact-name {
  font-weight: 500;
}

.contact-last-message {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main Chat Area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid hsl(var(--border));
}

.chat-contact-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.contact-address {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.chat-actions {
  display: flex;
  gap: 0.5rem;
}

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

.message-input-container {
  padding: 1rem;
  display: flex;
  gap: 0.75rem;
  border-top: 1px solid hsl(var(--border));
}

.message-input-wrapper {
  flex: 1;
  background-color: hsl(var(--secondary));
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: flex-end;
}

.message-input {
  flex: 1;
  background: transparent;
  border: none;
  color: hsl(var(--foreground));
  resize: none;
  max-height: 120px;
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0;
}

.message-input:focus {
  outline: none;
}

.message-actions {
  display: flex;
  gap: 0.5rem;
  padding-bottom: 0.25rem;
}

.send-button {
  align-self: flex-end;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 50%;
}

.message-footer {
  padding: 0.5rem 1rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.message-tools {
  display: flex;
  gap: 0.5rem;
}

.encryption-status {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 10;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .chat-header .mobile-menu-button {
    display: block;
  }
}

@media (min-width: 769px) {
  .chat-header .mobile-menu-button {
    display: none;
  }
}

