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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #333;
  display: flex;
  flex-direction: column;
  background-color: #000;
}

/* App container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: relative;
}

/* Camera container - fixed height */
.camera-container {
  position: relative;
  width: 100%;
  height: calc(100% - 80px); /* Subtract bottom bar height */
  background-color: #000;
  overflow: hidden;
}

/* Language selector (floating) */
.language-selector {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  background-color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(221, 221, 221, 0.6);
  border-radius: 20px;
  color: #333;
  font-size: 16px;
  outline: none;
  min-width: 120px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.language-selector option {
  background-color: white;
  color: #333;
}

/* Camera view */
#webcam {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

/* Bottom bar styles - fixed height */
.bottom-bar {
  width: 100%;
  height: 80px; /* Fixed height */
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 16px;
  z-index: 10;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.bottom-button {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 12px;
}

.button-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 4px;
  fill: currentColor;
}

.capture-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.capture-button-inner {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #f0f0f0;
  border: 2px solid #444;
}

/* Results panel - base style */
#result-container {
  position: absolute;
  bottom: 0; /* Cover the bottom bar */
  left: 0;
  right: 0;
  height: 33%; /* Default height for version 1 */
  background-color: white;
  z-index: 20; /* Above the bottom bar */
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  display: none; /* Hidden by default */
  flex-direction: column;
  transition: height 0.3s ease;
}

/* Panel heights for different versions */
.panel-version-1 #result-container {
  height: 33%;
}

.panel-version-2 #result-container {
  height: 45%;
}

.panel-version-3 #result-container {
  height: 60%;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid #eee;
}

.result-title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

.close-btn {
  background: transparent;
  border: none;
  color: #555;
  font-size: 24px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.results-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 16px;
  border-bottom: 1px solid #eee;
}

.word-container {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.english {
  color: #777;
  font-size: 14px;
  margin-bottom: 4px;
}

.translated {
  font-weight: bold;
  color: #333;
  font-size: 20px;
}

.pronunciation-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #f5f5f5;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 15px;
}

/* Additional info styles for different versions */
.additional-info {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
}

.info-title {
  color: #777;
  font-size: 14px;
  display: block;
  margin-bottom: 4px;
}

.info-content {
  color: #333;
  font-size: 16px;
}

/* Example sentences */
.example-container {
  margin-top: 4px;
}

.english-example {
  color: #555;
  font-size: 14px;
  margin-bottom: 2px;
}

.french-example {
  color: #333;
  font-weight: 500;
  font-size: 16px;
}

/* Related words */
.related-words-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.related-word {
  background-color: #f5f5f5;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
}

.related-word .english {
  font-size: 12px;
  color: #777;
}

.related-word .translated {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

/* Version indicator */
.version-indicator {
  visibility: hidden;
  position: absolute;
  top: 10px;
  right: 20px;
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 100;
}

/* Navigation links for different versions */
.version-nav {
  visibility: hidden;
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.version-link {
  background-color: rgba(255, 255, 255, 0.8);
  color: #333;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.version-link.active {
  background-color: #3498db;
  color: white;
}

.loading {
  text-align: center;
  padding: 20px;
  color: #777;
}

/* Detection target - the boxes can be clicked */
.detection-target {
  position: absolute;
  cursor: pointer;
  z-index: 3;
}

/* Status message */
#status-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.8);
  padding: 16px;
  border-radius: 8px;
  color: white;
  z-index: 20;
  max-width: 80%;
  text-align: center;
  display: none;
}
/* Language selector wrapper */
.language-selector-wrapper {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(221, 221, 221, 0.6);
  border-radius: 20px;
  padding: 4px 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

/* Selector dropdown style */
.language-selector-item {
  padding: 4px 8px;
  background-color: transparent;
  border: none;
  color: #333;
  font-size: 16px;
  outline: none;
  min-width: 90px;
}

.language-selector-item option {
  background-color: white;
  color: #333;
}

/* Direction arrow between selectors */
.direction-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  margin: 0 4px;
}
