/**
 * practice.css - Styles specific to the practice page
 */

:root {
  --ai-bg: #ffe0f0;
  --user-bg: #e0e7ff;
}

html,
body {
  overflow: hidden;
  height: 100%;
}

.page-content {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.conversation-wrapper {
  flex: 1;
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
  overflow: hidden;
}

.conversation-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  gap: 20px;
  max-width: 100%;
  margin: 0 auto;
  width: 80%;
  scroll-behavior: smooth;
  padding: 40px 20px 200px;
  box-sizing: border-box;
  min-height: 300px;
}

.message-block {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  width: 100%;
}

.message-block.user {
  flex-direction: row;
  justify-content: flex-end;
}

.message-block.ai {
  flex-direction: row;
  justify-content: flex-start;
}

.avatar {
  width: 60px;
  height: 60px;
  border: 3px solid var(--primary-color);
  border-radius: 50%;
  background-color: transparent;
  color: var(--primary-color);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.8rem;
  position: relative;
  top: 26px;
  flex-shrink: 0;
}

.message-column {
  display: flex;
  flex-direction: column;
  max-width: 100%;
}

.message-block.user .message-column {
  align-items: flex-end;
}

.sender-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #777;
}

.message-content {
  background: var(--white);
  padding: 20px 28px;
  font-size: 1.2rem;
  line-height: 1.6;
  border-radius: 28px;
  box-shadow: 0 6px 18px var(--shadow-light);
  max-width: 800px;
  position: relative;
  transition: box-shadow 0.3s ease;
  word-wrap: break-word;
  width: 100%;
  box-sizing: border-box;
}

#initialUserContent {
  min-height: 120px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: all 0.5s ease;
}

#initialUserContent:not(:empty) {
  min-height: unset;
  height: auto;
}

#initialAIContent {
  min-height: 120px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: all 0.5s ease;
}

#initialAIContent:not(:empty) {
  min-height: unset;
  height: auto;
}

.message-content:hover {
  box-shadow: 0 8px 22px var(--shadow-med);
}

.message-block.user .message-content {
  background: var(--user-bg);
  border-bottom-right-radius: 8px;
}

.message-block.ai .message-content {
  background: var(--ai-bg);
  border-bottom-left-radius: 8px;
}

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

.message-block.user .actions-container {
  justify-content: flex-end;
}

.action-button {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.action-button:hover {
  background: var(--primary-color);
  color: white;
  transform: scale(1.05);
}

.definition-popup,
.reformulation {
  display: none;
  margin-top: 12px;
  font-size: 1rem;
  background: #f0f4ff;
  padding: 12px;
  border-radius: 10px;
  width: 100%;
  box-sizing: border-box;
}

.clickable-word {
  cursor: pointer;
}

.clickable-word.loading {
  background-color: #fef3c7;
  border-radius: 3px;
  padding: 0 2px;
}

.mic-container {
  display: none;
}

.microphone-button {
  display: block;
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.5rem;
  color: white;
  background-color: #e74c3c;
  border: none;
  border-radius: 50%;
  width: 100px;
  height: 100px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
  z-index: 50;
}

.microphone-button:hover {
  transform: translateX(-50%) scale(1.1);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.microphone-button.recording {
  background-color: #a31616;
  animation: pulse-shadow 1.6s infinite linear;
}

@keyframes pulse-shadow {
  0% {
    box-shadow: 0 0 0 0 rgba(227, 45, 45, 0.6);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(227, 45, 45, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(227, 45, 45, 0);
  }
}

.click-here-indicator {
  position: fixed;
  bottom: 150px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  pointer-events: none;
  animation: float-up-down 2s ease-in-out infinite;
}

.click-here-indicator svg {
  width: 250px;
  height: auto;
}

@keyframes float-up-down {
  0% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-15px);
  }
  100% {
    transform: translateX(-50%) translateY(0);
  }
}

@media (max-width: 600px) {
  .conversation-container {
    width: 95%;
    padding: 20px 10px 180px;
    gap: 15px;
  }

  .message-content {
    padding: 15px 20px;
    font-size: 1rem;
    border-radius: 22px;
  }

  .avatar {
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
    top: 18px;
  }

  .action-button {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  .microphone-button {
    width: 80px;
    height: 80px;
    font-size: 2rem;
    bottom: 30px;
  }

  .click-here-indicator {
    bottom: 120px;
  }

  .click-here-indicator svg {
    width: 200px;
  }

  .mic-help-text {
    font-size: 0.9rem;
    margin-bottom: 80px;
  }

  #initialUserContent,
  #initialAIContent {
    min-height: 100px;
    min-width: 200px;
  }

  .message-block {
    gap: 10px;
  }

  .message-column {
    max-width: calc(100% - 55px);
  }
}

@media (max-width: 380px) {
  .conversation-container {
    width: 98%;
    padding: 15px 8px 170px;
    gap: 12px;
  }

  .message-content {
    padding: 12px 16px;
    font-size: 0.95rem;
  }

  .avatar {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    top: 15px;
  }

  .microphone-button {
    width: 70px;
    height: 70px;
    font-size: 1.8rem;
    bottom: 25px;
  }

  .click-here-indicator {
    bottom: 105px;
  }

  .click-here-indicator svg {
    width: 150px;
  }
}

body::after {
  content: "";
  display: block;
  height: 0;
  flex: 0;
}
