/* ==== GLOBAL RESET ==== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  background: radial-gradient(circle at center, #0b0c14 0%, #05050a 100%);
  color: #f1f5f9;
  text-align: center;
}

html,
body {
  overflow-x: hidden !important;
  width: 100%;
}

/* ==== HERO SECTION ==== */
.hero {
  min-height: calc(100vh - 80px); /* ensures footer sits below content */
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 120px;
  padding-bottom: 60px;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(
    circle at center,
    rgba(99, 102, 241, 0.4),
    transparent 70%
  );
  filter: blur(100px);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
}

/* ==== TEXT ==== */
.hero h1 {
  font-size: 3rem;
  margin-bottom: 10px;
  font-weight: 700;
  background: linear-gradient(90deg, #a78bfa, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subheading {
  font-size: 1.4rem;
  color: #e0e0e0;
  margin-bottom: 12px;
}

.description {
  color: #9ca3af;
  font-size: 1.05rem;
  margin-bottom: 20px;
}

/* ==== CARDS ==== */
.card-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 30px;
}

.info-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 30px;
  width: 280px;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
}

.info-card:hover {
  transform: translateY(-8px);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 8px 40px rgba(99, 102, 241, 0.15);
}

.icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.info-card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.info-card p {
  color: #a3a3a3;
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.card-btn {
  background: linear-gradient(to right, #6366f1, #ec4899);
  border: none;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.3s ease;
}

.card-btn:hover {
  transform: scale(1.05);
  opacity: 0.95;
}

/* ==== FORM ==== */
.form-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 40px;
  transition: all 0.4s ease;
}

#room-form {
  width: 100%;
  max-width: 380px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.4s ease;
}

#room-form.show {
  opacity: 1;
  transform: translateY(0);
}

#room-form.hidden {
  display: none;
}

.styled-form {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.styled-form input {
  width: 100%;
  padding: 10px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #f1f5f9;
  font-size: 1rem;
}

.styled-form input::placeholder {
  color: #9ca3af;
}

.styled-form input:focus {
  border-color: #8b5cf6;
  outline: none;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

.styled-form button {
  width: 100%;
  padding: 12px;
  background: linear-gradient(to right, #6366f1, #ec4899);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s ease;
}

.styled-form button:hover {
  transform: scale(1.03);
  opacity: 0.95;
}

/* ==== FOOTER ==== */
.footer {
  margin-top: auto;
  padding: 20px 10px;
  color: #7c7c7c;
  font-size: 0.9rem;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(10px);
  width: 100%;
  position: relative;
  bottom: 0;
}

/* ==== MEET LAYOUT ==== */
.meet-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: radial-gradient(circle at center, #0b0c14 0%, #05050a 100%);
  color: #f1f5f9;
  overflow: hidden;
  position: relative;
}

/* ==== VIDEO AREA ==== */
.video-area {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 20px;
}

.video-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  width: 100%;
  height: 100%;
  max-width: 1200px;
  transition: all 0.4s ease;
}

.video-grid.single video#local-video {
  width: 60%;
  max-width: 720px;
  height: auto;
  border-radius: 16px;
  transition: all 0.3s ease;
}

.video-grid.dual video {
  width: 48%;
  height: auto;
  max-height: 80vh;
  border-radius: 16px;
  object-fit: cover;
  transition: all 0.3s ease;
}

video {
  width: 100%;
  background: #000;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.video-grid.single {
  justify-content: center;
  align-items: center;
}

/* ==== ROOM INFO ==== */
.room-info-bar {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.08);
  padding: 8px 14px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  z-index: 20;
  backdrop-filter: blur(8px);
}

.copy-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  transition: 0.2s;
}

.copy-btn:hover {
  transform: scale(1.1);
}

/* ==== FLOATING CONTROLS ==== */
.floating-controls {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: fit-content;
  border-radius: 40px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 20px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(15px);
  z-index: 20;
}

/* ==== CONTROL BUTTONS ==== */
.control-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.ctrl-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.08);
}

.chat-btn {
  background: rgba(255, 255, 255, 0.12);
}

.leave-btn {
  background: linear-gradient(90deg, #ef4444, #b91c1c);
}

.leave-btn:hover {
  opacity: 0.9;
  transform: scale(1.1);
}

/* ==== CHAT SIDEBAR ==== */
.chat-sidebar {
  position: absolute;
  top: 0;
  right: -400px;
  width: 350px;
  height: 100%;
  background: rgba(25, 25, 40, 0.96);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -2px 0 15px rgba(0, 0, 0, 0.4);
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.chat-sidebar.active {
  right: 0;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
}

.chat-header h3 {
  font-size: 1.1rem;
  color: #fff;
}

.close-chat {
  background: transparent;
  border: none;
  color: #f87171;
  font-size: 1.2rem;
  cursor: pointer;
}

/* ==== CHAT MESSAGES ==== */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 15px;
  overflow-y: auto;
  color: #e5e7eb;
}

.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.3;
  word-wrap: break-word;
  animation: fadeInUp 0.25s ease;
  backdrop-filter: blur(8px);
  text-align: left;
}

.chat-bubble.other {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
  border-bottom-left-radius: 4px;
}

.chat-bubble.self {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.18);
  color: #f9fafb;
  border-bottom-right-radius: 4px;
}

/* ==== CHAT INPUT ==== */
.chat-input {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  margin-top: auto;
}

.chat-input textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  margin-right: 10px;
}

.chat-input button {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #ec4899);
  color: #e5e7eb;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-input button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.15);
}

/* ==== MODE TOGGLE ==== */
.mode-toggle {
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
  padding: 3px;
  border-radius: 30px;
  width: fit-content;
  margin: 0 auto 20px;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.2);
}

.toggle-btn {
  background: transparent;
  border: none;
  color: #f1f5f9;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 6px 20px;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle-btn.active {
  background: #fff;
  color: #6d28d9;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* ==== ANIMATIONS ==== */
.fade-out {
  animation: fadeOut 0.4s ease forwards;
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-15px);
  }
}

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

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

/* ==== UTILITIES ==== */
.hidden {
  display: none;
}

#dynamic-form {
  width: 360px;
  max-width: 90vw;
}

#room-code {
  transition: all 0.3s ease;
}

#room-code[style*="display: none"] + button {
  margin-top: 6px;
}

.hero,
.card-container,
.footer,
.video-area,
.video-grid,
.chat-sidebar {
  max-width: 100vw;
  overflow-x: hidden;
}

/* ==== MOBILE RESPONSIVE ==== */
@media (max-width: 768px) {
  body {
    font-size: 0.95rem;
    overflow: hidden;
  }

  html,
  body {
    overflow-x: hidden !important;
  }
  * {
    max-width: 100vw;
  }

  .hero {
    padding-top: 80px;
    padding-bottom: 80px;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .subheading {
    font-size: 1.1rem;
  }

  .description {
    font-size: 0.95rem;
  }

  .info-card {
    width: 85%;
  }

  /* ==== VIDEO CALL VIEW ==== */
  .video-grid.dual {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }

  .video-grid.single video#local-video {
    width: 95%;
    height: auto;
    max-height: 45vh;
    border-radius: 12px;
    object-fit: cover;
  }

  .video-grid.single {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .video-grid.dual video#remote-video,
  .video-grid.dual video#local-video {
    width: 95%;
    height: auto;
    max-height: 45vh;
    border-radius: 12px;
    object-fit: cover;
  }
  /* Room info repositioned */
  .room-info-bar {
    top: 10px;
    left: 10px;
    font-size: 0.85rem;
    padding: 6px 10px;
  }

  /* Floating controls */
  .floating-controls {
    bottom: 15px;
    padding: 6px 10px;
  }

  .ctrl-btn {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }

  /* Chat sidebar becomes full screen overlay */
  .chat-sidebar {
    width: 100%;
    right: -100%;
  }

  .chat-sidebar.active {
    right: 0;
  }

  .chat-header h3 {
    font-size: 1rem;
  }

  .chat-messages {
    padding: 8px 10px;
  }

  .chat-bubble {
    font-size: 0.9rem;
    max-width: 90%;
  }

  .chat-input {
    padding: 8px 10px;
  }

  .chat-input textarea {
    font-size: 0.9rem;
    padding: 6px 8px;
  }

  .chat-input button {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  /* Form adjustments */
  .styled-form {
    width: 90%;
    padding: 20px;
  }

  .styled-form input {
    padding: 8px;
  }

  .styled-form button {
    padding: 10px;
  }
  .footer {
    position: relative;
    bottom: 0;
    width: 100%;
    left: 0;
    right: 0;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(10px);
    padding: 18px 8px;
    font-size: 0.85rem;
  }

  body.chat-open .floating-controls {
    display: none !important;
  }
}
