/* Import Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

/* Base Reset */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Poppins', sans-serif;
  background: #f9f9f9;
  color: #222;
  box-sizing: border-box;
  overflow: hidden; /* desktop fit-to-screen */
}

/* Container Layout */
.container {
  display: flex;
  flex-direction: row;
  height: 100vh;
  gap: 1rem;
  padding: 1rem;
  box-sizing: border-box;
}

/* Main Content */
.main {
  flex: 2;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
}

.main h1 {
  font-size: 1.5rem; /* smaller heading */
  margin: 0.5rem 0;
  text-align: center;
  font-weight: 600;
}

/* Response Box */
.chat-container {
  flex: 1;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 1rem;
  font-size: 1rem;
  white-space: pre-wrap;
  box-shadow: 0 3px 8px rgba(0,0,0,0.05);
  overflow-y: auto;
}

/* Text Input */
#textInput {
  width: 96%;
  min-height: 80px;
  padding: 0.75rem 1rem;
  border: 1px solid #ccc;
  border-radius: 12px;
  font-size: 1rem;
  resize: vertical;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}

/* Braille Section */
.braille-section {
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid #ddd;
  box-shadow: 0 3px 8px rgba(0,0,0,0.05);
  flex-shrink: 0;
}

.braille-section h1 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  text-align: center;
}

.braille-grid {
  display: grid;
  grid-template-columns: repeat(2, 70px);
  grid-template-rows: repeat(3, 70px);
  gap: 0.8rem;
  justify-content: center;
  margin: 1rem 0;
}

.braille-dot {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 2px solid #444;
  background: #f0f0f0;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.2s, transform 0.1s;
}

.braille-dot:hover {
  background: #ddd;
}

.braille-dot:active {
  background: #2563eb;
}

.dot-shape {
  width: 18px;
  height: 18px;
  background: #444;
  border-radius: 50%;
}

.braille-dot.active .dot-shape {
  background-color: blue;
}

/* Controls */
.braille-controls {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: center;
}

.braille-controls button {
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s, opacity 0.2s;
}

.braille-controls button:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.insert-btn {
  background: #16a34a;
  color: #fff;
}

.clear-btn {
  background: #ef4444;
  color: #fff;
}

.send-btn {
  background: #2563eb;
  color: #fff;
}

.math-btn {
  background-color: red;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
}

/* Right Panel */
.right-panel {
  flex: 1;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 1rem;
  overflow-y: auto;
  box-shadow: 0 3px 8px rgba(0,0,0,0.05);
}

.right-panel h1 {
  font-size: 1.3rem;
  margin: 0.5rem 0 1rem;
  text-align: center;
  font-weight: 600;
}

/* Example Questions */
#examples ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.question-button {
  width: 100%;
  padding: 0.8rem 1rem;
  margin: 0.5rem 0;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5, #3b82f6);
  color: #fff !important;
  cursor: pointer;
  text-align: left;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.question-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(0,0,0,0.2);
}

.question-button:active {
  transform: scale(0.98);
}

/* Voice Overlay */
#listeningIndicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  z-index: 9999;
  display: none; 
}

#listeningIndicator img {
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

/* Responsive Styles */
@media (max-width: 1024px) {
  html, body {
    overflow: auto; /* allow scrolling on tablets/mobiles */
  }
  .container {
    flex-direction: column;
    height: auto;
  }
  .right-panel {
    order: 2; /* move examples below main on small screens */
    flex: unset;
    max-height: unset;
  }
  .main {
    flex: unset;
    flex-grow: 1;
  }
}

@media (max-width: 600px) {
  .braille-grid {
    grid-template-columns: repeat(2, 55px) !important;
    grid-template-rows: repeat(3, 55px) !important;
    gap: 0.6rem;
  }

  .braille-dot {
    width: 55px;
    height: 55px;
  }

  .dot-shape {
    width: 14px;
    height: 14px;
    transition: background-color 0.3s;
  }

  .braille-dot:active {
    background: #2563eb;
  }

  .braille-dot.active .dot-shape {
    background-color: blue;
  }

  #textInput {
    width: 92%;
    min-height: 70px;
    font-size: 0.9rem;
  }

  .braille-controls button {
    flex: 1;
    min-width: 90px;
    font-size: 0.85rem;
  }

  html, body {
    overflow: auto; 
  }
}

.intro-box {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.intro-box .chat-container {
  flex: 1; /* take most of the space */
}

#start {
  height: fit-content;
  padding: 0.75rem 1.2rem;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
}

#TTS {
  height: fit-content;
  padding: 0.75rem 1.2rem;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
}

#micBtn {
  height: fit-content;
  padding: 0.75rem 1.2rem;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
}