:root {
  --blue: #001f3f;
  --dark-blue: #172a3a;
  --light-blue: #c8ccff;
  --light-gray: #f4f4f4;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Roboto", sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--light-gray);
  color: var(--dark-blue);
  font-size: medium;
}

main {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  height: 100vh;
}

.form {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.name-section {
  border: 2px solid var(--dark-blue);
  padding: 3rem;
  border-radius: 1rem;
  background-color: white;
}

.label-input {
  font-weight: bold;
  margin-bottom: 0.2rem;
}

.text-input {
  padding: 0.5rem;
  border: 1px solid var(--blue);
  border-radius: 5px;
}

.buttons-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 0.3rem;
  height: 2.5rem;
}

.enter-btn {
  cursor: pointer;
  background-color: var(--dark-blue);
  color: var(--light-gray);
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  transition: background-color 300ms ease;
}

.enter-btn:hover {
  background-color: var(--light-blue);
  color: var(--blue);
}

.back-btn {
  cursor: pointer;
  background-color: var(--light-blue);
  color: var(--blue);

  padding: 10px 20px;

  border: none;
  border-radius: 5px;
  font-weight: bold;
  text-decoration: none;

  height: 2.2rem;

  text-align: center;
  font-size: 16px;

  transition: background-color 300ms ease;
}

.back-btn:hover {
  background-color: var(--dark-blue);
  color: var(--light-gray);
}

.main-section {
  border: 1px solid var(--blue);
  border-radius: 1rem;
  padding: 1rem;
  margin: 0 1rem;

  background-color: white;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.div-back {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1rem;
}

.out-btn,
.btn-submit,
.btn-img {
  cursor: pointer;
  background-color: var(--light-blue);
  color: var(--blue);
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  text-decoration: none;
  transition: all 300ms ease;
}

.btn-submit,
.btn-img {
  background-color: var(--blue);
  color: white;
}

.btn-submit:hover,
.btn-img:hover {
  background-color: var(--light-blue);
  color: var(--blue);
}

.chat-layout {
  margin-top: 1rem;
  display: flex;
  height: 70vh;
  width: 85vw;
  border: 1px solid var(--blue);
  border-radius: 1rem;
}

.users-container {
  width: 40%;
  border-right: 1px solid var(--blue);
  border-top-left-radius: 1rem;
  border-bottom-left-radius: 1rem;
  padding: 10px;
  background: var(--light-gray);
  overflow-y: auto;
}

.users-container h3,
.chat-messages h3 {
  margin-top: 0;
}

.users-list {
  list-style: none;
  padding: 0;
}

.chat-window {
  width: 10rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex-grow: 1;
  padding: 10px;
  overflow-y: auto;
}

.message-form {
  display: flex;
  flex-direction: column;
  padding: 10px;
  border-top: 1px solid var(--blue);
}

.message-input {
  flex-grow: 1;
  padding: 10px;
  border: 1px solid var(--blue);
  border-radius: 5px;
  margin-bottom: 10px;
}

.notification {
  font-style: italic;
  color: #888;
}

@media (min-width: 768px) {
  body {
    font-size: 1.5rem;
  }

  .chat-layout {
    height: 70vh;
    width: 70vw;
  }
}

.image-preview-area {
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  max-width: 100%;
  border-radius: 8px;
  border: 1px dashed var(--light-blue);
}

.image-preview-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 15px;
}

.image-preview-header h4 {
  display: none;
}

.close-preview-button {
  background: none;
  border: none;
  color: var(--dark-blue);
  font-size: 1.2em;
  cursor: pointer;
  padding: 0 5px;
  line-height: 1;
  border-radius: 50%;
  transition: background-color 0.2s ease;

  position: absolute;
  top: 5px;
  right: 5px;
}

.close-preview-button:hover {
  background-color: var(--light-blue);
  color: var(--blue);
}

.image-preview-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: -10px;
}

.image-preview-content img {
  max-width: 100%;
  max-height: 150px;
  object-fit: contain;
  border-radius: 5px;
}

.image-lightbox {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
  padding-top: 60px;
}

.lightbox-content {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  animation-name: zoom;
  animation-duration: 0.6s;
}

@keyframes zoom {
  from {
    transform: scale(0.1);
  }
  to {
    transform: scale(1);
  }
}

.lightbox-close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

.lightbox-caption {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #ccc;
  padding: 10px 0;
  height: 150px;
}

/* --- CSS do Modal de Chamada (Estilo Google Meet) --- */

/* Fundo escuro que cobre toda a tela */
.call-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #202124; /* Cinza escuro padrão do Meet */
    z-index: 2000; /* Acima de tudo */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Container dos vídeos */
.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Vídeo da outra pessoa (Tela Cheia) */
.remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Preenche a tela sem distorcer */
    background-color: #000;
}

/* Seu vídeo (Picture-in-Picture) */
.local-video {
    position: absolute;
    bottom: 80px; /* Espaço para os controles */
    right: 20px;
    width: 200px; /* Tamanho fixo ou use vw */
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background-color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transform: scaleX(-1); /* Espelha o vídeo local */
    z-index: 2005;
    transition: all 0.3s ease;
}

/* Barra de controles (Botões) */
.call-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    padding: 10px 20px;
    background-color: rgba(32, 33, 36, 0.9); /* Fundo translúcido */
    border-radius: 50px;
    z-index: 2010;
}

/* Estilo genérico dos botões de controle */
.control-btn {
    background-color: #3c4043;
    color: white;
    border: none;
    border-radius: 30px; /* Formato de pílula */
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.control-btn:hover {
    background-color: #5f6368;
}

/* Botão de Encerrar (Vermelho) */
#hangup-btn {
    background-color: #ea4335;
    color: white;
    padding: 12px 30px;
}

#hangup-btn:hover {
    background-color: #d93025;
}

/* --- Responsividade para Celular --- */
@media (max-width: 768px) {
    .local-video {
        width: 100px;
        height: 140px;
        bottom: 90px;
        right: 10px;
    }

    .call-controls {
        width: 90%;
        justify-content: space-between;
        gap: 5px;
        border-radius: 20px;
    }

    .control-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
        flex-grow: 1;
    }
}