/* Custom animations and styles */
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Ensure full height on mobile */
html, body {
  height: 100%;
  width: 100%;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  /* Reduce heading sizes on mobile */
  .text-7xl {
    font-size: 3rem !important;
    line-height: 1.1 !important;
  }
  
  .text-4xl {
    font-size: 2rem !important;
  }
  
  .text-3xl {
    font-size: 1.5rem !important;
  }
  
  .text-2xl {
    font-size: 1.25rem !important;
  }
  
  /* Adjust padding for mobile */
  .p-16 {
    padding: 2rem !important;
  }
  
  .p-12 {
    padding: 2rem !important;
  }
  
  .p-10 {
    padding: 1.5rem !important;
  }
  
  .py-32 {
    padding-top: 4rem !important;
    padding-bottom: 4rem !important;
  }
  
  /* Make buttons more touch-friendly */
  .py-5 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
  
  .py-4 {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
  
  /* Reduce gap on mobile */
  .gap-8 {
    gap: 1rem !important;
  }
  
  .gap-5 {
    gap: 0.75rem !important;
  }
  
  .mb-16 {
    margin-bottom: 2rem !important;
  }
  
  .mb-12 {
    margin-bottom: 2rem !important;
  }
  
  /* Icon sizes */
  .w-16 {
    width: 3rem !important;
    height: 3rem !important;
  }
  
  .w-12 {
    width: 2.5rem !important;
    height: 2.5rem !important;
  }
  
  .w-10 {
    width: 2rem !important;
    height: 2rem !important;
  }
  
  /* Make background blobs smaller */
  .w-96 {
    width: 16rem !important;
    height: 16rem !important;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .text-7xl {
    font-size: 2.5rem !important;
  }
  
  .text-lg {
    font-size: 1rem !important;
  }
  
  /* Stack buttons on very small screens */
  #copyChannelBtn span,
  #leaveChannelBtn span {
    display: none;
  }
  
  #copyChannelBtn,
  #leaveChannelBtn {
    padding: 0.75rem !important;
  }
}

/* Chat screen mobile optimization */
@media (max-width: 768px) {
  #chatScreen .min-h-screen {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
  }
  
  #chatScreen .flex-1 {
    flex: 1;
    min-height: 0;
  }
  
  /* Message bubbles on mobile */
  .message-item .max-w-lg {
    max-width: 85% !important;
  }
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  button:hover {
    transform: none !important;
  }
  
  /* Add active state instead */
  button:active {
    transform: scale(0.98) !important;
    opacity: 0.9;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.delay-1000 {
  animation-delay: 1s;
}

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

.message-item {
  animation: fadeIn 0.3s ease-out;
}

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

/* Thinner scrollbar on mobile */
@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 6px;
  }
}

::-webkit-scrollbar-track {
  background: rgba(30, 41, 59, 0.5);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #9333ea, #ec4899);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, #a855f7, #f472b6);
}

/* Focus states */
input:focus,
button:focus {
  outline: none;
}

/* Disabled button states */
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:disabled:hover {
  transform: none !important;
}

/* Prevent text selection on buttons */
button {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Improve input experience on mobile */
input {
  font-size: 16px !important; /* Prevents zoom on iOS */
}

/* Safe area padding for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
  #chatScreen > .min-h-screen > div:last-child {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)) !important;
  }
}