:root {
  --primary-color: #8E44AD;
  --background-overlay: rgba(255, 255, 255, 0.8);
  --border-radius: 12px;
  --transition-speed: 0.3s;
}

/* General Reset */
body {
  font-family: 'Nunito', sans-serif;
  margin: 0;
  padding: 0;
  background: url('BearFurImage.jpg') no-repeat center center fixed;
  background-size: cover;
  color: #333;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;
  overflow: hidden;
}

/* App Name */
.app-name {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 32px;
  /* Slightly smaller for better fit */
  font-weight: 800;
  color: #ffffff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  z-index: 1005;
  transition: all 0.3s ease;
}

/* Creator Name */
.creator-name {
  position: fixed;
  /* Fixed relative to viewport */
  bottom: 12px;
  right: 20px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.5px;
  z-index: 1005;
  transition: all 0.3s ease;
}

/* Container */
.container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-grow: 1;
  padding: 20px;
  gap: 10px;
}

/* Section Separator */

/*
side 
| [ textarea         | 
|   input buttons ]  | ← side-top grouped together
|--------------------|
| language-grid      |
*/

.side {
  flex: 1;
  display: flex;
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px 0;
  gap: 20px;
}

.side:first-child::after {
  content: "";
  position: absolute;
  right: -5.5px;
  /* Centers in the 10px gap */
  top: 15%;
  height: 70%;
  width: 2px;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.6), transparent);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
  pointer-events: none;
}

.side-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 5px;
}

.side:last-child {
  border-right: none;
}

.center-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
}

/* Input Group */
.input-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

/* Text Field */
.text-field {
  width: 90%;
  max-width: 600px;
  height: 180px;
  padding: 15px;
  font-size: 28px;
  font-family: 'Nunito', sans-serif;
  border: 2px solid #A67C52;
  border-radius: 5px;
  background-color: rgba(245, 222, 179, 0.8);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
  resize: none;
  overflow: auto;
}

/* Dropdown Styling */
/*
.dropdown {
    padding: 10px;
    font-size: 16px;
    border-radius: 5px;
    border: 1px solid #ccc;
    background-color: #fff;
    color: #333;
}
    */

/* Button Styling */
.button {
  padding: 12px 24px;
  font-size: 24px;
  font-family: 'Nunito', sans-serif;
  font-weight: bold;
  border: none;
  border-radius: var(--border-radius);
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  color: var(--primary-color);
  cursor: pointer;
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.1);
}

/* Button Styling */
/* Global Busy State: Disable everything except the active action */
body.app-busy button:not(.active-action),
body.app-busy .language-grid:not(.active-action) {
  opacity: 0.6;
  pointer-events: none;
  cursor: not-allowed;
}

/* Ensure the active action stays interactive */
body.app-busy .active-action {
  opacity: 1;
  pointer-events: auto;
  filter: none;
  cursor: pointer;
  position: relative;
  z-index: 1001;
}

.button:hover {
  transform: translateY(-3px);
  box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.2);
}

/* Translation Button - Circular with Icon */
.translate-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 32px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.translate-btn i {
  pointer-events: none;
}

/* Circular Icon Buttons with Font Awesome */
.mic {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 80px;
  height: 80px;
  background-color: #f44336;
  color: #fff;
  font-size: 28px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.25s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mic::before {
  content: "";
  position: absolute;
  width: inherit;
  height: inherit;
  border-radius: inherit;
  background-color: inherit;
  z-index: -1;
}

.mic:hover {
  background-color: #da190b;
}

.listening {
  background-color: #ff0000;
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.7);
  transform: scale(1.1);
}

.listening::before {
  animation: listening 1.3s infinite;
}

@keyframes listening {
  from {
    opacity: 0.25;
  }

  to {
    transform: scale(2);
    opacity: 0;
  }
}

/* Play Button Circle */
.play-btn-circle {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 80px;
  height: 80px;
  background-color: #4CAF50;
  color: #fff;
  font-size: 28px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.25s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.play-btn-circle:hover {
  background-color: #45a049;
}

/* Loader */
.loader {
  width: 30px;
  height: 60px;
  padding-top: 60px;
  box-sizing: border-box;
  display: grid;
  background:
    linear-gradient(currentColor 0 0) bottom/10px calc(100% - 15px),
    conic-gradient(from 134deg at top, #0000, currentColor 1deg 90deg, #0000 91deg) top/100% 15px;
  background-origin: content-box;
  background-repeat: no-repeat;
  animation: l10-0 2s infinite;
  z-index: 900;
}

.loader:before,
.loader:after {
  content: "";
  grid-area: 1/1;
  background: inherit;
  background-size: 10px calc(100% - 25px), 100% 25px;
  animation: l10-1 2s infinite;
}

.loader:after {
  background-size: 10px calc(100% - 30px), 100% 30px;
  animation: l10-2 2s infinite;
}

@keyframes l10-0 {

  25%,
  100% {
    padding-top: 0px
  }
}

@keyframes l10-1 {

  0%,
  25% {
    margin: 60px -10px 0
  }

  50%,
  100% {
    margin: 8px -10px 0
  }
}

@keyframes l10-2 {

  0%,
  50% {
    margin: 60px -15px 0
  }

  75%,
  100% {
    margin: 20px -15px 0
  }
}


/* Grid of Language Buttons */
.language-grid {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  width: 90%;
  max-width: 600px;
  margin-top: 10px;
  /* Small base margin for modal */
  margin-bottom: 20px;
}

/* Specific margin for the main screen grids */
.side .language-grid {
  margin-top: 90px;
  margin-bottom: 40px;
}

/*
 Transparent Box for Icons
 */
.language-grid button {
  background-color: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.side .language-grid .language-option {
  min-width: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: 'Nunito', sans-serif;
}

.language-name {
  max-width: 88px;
  color: rgba(72, 50, 31, 0.72);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  overflow-wrap: anywhere;
}

.language-grid button img {
  width: 75px;
  height: 75px;
}

.language-grid button.selected img {
  box-shadow: 0 0 0 4px #e7e4da, 0 0 8px rgba(241, 196, 15, 0.6);
  border-radius: 50%;
  transform: scale(1.1);
  /* slightly enlarge */
  transition: all 0.2s ease;
}


/* Settings Button: slightly enlarges on hover for a dynamic feel */
.settings-button {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 32px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all var(--transition-speed);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.settings-button:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Settings Modal: uses the overlay background and refined borders */
.settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.settings-modal.hidden {
  display: none;
}

.settings-content {
  background: var(--background-overlay);
  padding: 30px 40px;
  border-radius: var(--border-radius);
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--primary-color);
}

.settings-section {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.settings-title {
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
  margin-bottom: 0;
  min-width: 130px;
}

/* Tabs Styling */
.tabs-header {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 25px;
  border-bottom: 2px solid #ddd;
  padding-bottom: 10px;
}

.tab-btn {
  background: none;
  border: none;
  font-size: 18px;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.3s;
}

.tab-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--primary-color);
}

.tab-btn.active {
  color: var(--primary-color);
  background-color: rgba(142, 68, 173, 0.1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.tab-content {
  animation: fadeIn 0.3s ease;
}

.settings-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.user-button {
  padding: 8px 16px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 8px;
  border: 2px solid #ccc;
  background-color: #f5f5f5;
  color: #777;
  cursor: pointer;
  transition: all 0.2s;
}

.user-button:hover {
  border-color: #4CAF50;
  background-color: rgba(0, 0, 0, 0.02);
}

.user-button.selected {
  border: 2px solid #4CAF50;
  background-color: #e8f5e9;
  color: #2c3e50;
  font-weight: bold;
}

.top-controls {
  position: absolute;
  top: 15px;
  right: 100px;
  display: flex;
  align-items: stretch;
  gap: 8px;
  z-index: 100;
}

.fullscreen-button {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  width: 54px;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  cursor: pointer;
  font-size: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all var(--transition-speed);
  touch-action: manipulation;
}

.fullscreen-button:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.fullscreen-button:focus-visible {
  outline: 3px solid rgba(142, 68, 173, 0.35);
  outline-offset: 2px;
}

.speed-control-box {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  min-width: 140px;
}

.speed-title {
  font-size: 11px;
  font-weight: bold;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.speed-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

#playback-speed {
  -webkit-appearance: none;
  appearance: none;
  flex-grow: 1;
  height: 6px;
  background: linear-gradient(to right, var(--primary-color) 100%, #ddd 100%);
  border-radius: 5px;
  outline: none;
  cursor: pointer;
}

#playback-speed::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary-color);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s;
}

#playback-speed::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--primary-color);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s;
}

#playback-speed:hover::-webkit-slider-thumb {
  transform: scale(1.1);
}

#playback-speed:hover::-moz-range-thumb {
  transform: scale(1.1);
}

#speed-value {
  font-weight: bold;
  min-width: 35px;
  color: #fff;
  background: var(--primary-color);
  padding: 1px 5px;
  border-radius: 8px;
  font-size: 10px;
  text-align: center;
}



/* ========== TABLET STYLES (10-13 inch optimization) ========== */
@media (max-width: 1366px) {
  .container {
    flex-direction: row;
    gap: 5px;
    padding: 10px;
    align-items: stretch;
  }

  .side {
    padding: 15px 0;
    gap: 15px;
  }

  .text-field {
    width: 90%;
    font-size: 18px;
    height: 120px;
  }

  .input-group {
    gap: 6px;
    margin-top: 5px;
  }

  .button {
    font-size: 16px;
    padding: 8px 12px;
  }

  .language-grid {
    width: 95%;
    gap: 10px;
    margin-top: 5px;
    margin-bottom: 15px;
  }

  .side .language-grid {
    margin-top: 20px;
    /* Reduced gap for tablet text/grid */
    margin-bottom: 20px;
  }

  .language-grid button img {
    width: 60px;
    height: 60px;
  }

  .side .language-grid .language-option {
    min-width: 70px;
    gap: 4px;
  }

  .language-name {
    max-width: 76px;
    font-size: 11px;
  }

  .translate-btn {
    width: 65px;
    height: 65px;
    font-size: 28px;
  }

  .app-name {
    font-size: 22px;
    top: 10px;
    left: 15px;
  }

  .creator-name {
    font-size: 10px;
    bottom: 5px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
    text-align: center;
    pointer-events: none;
  }

  .settings-button {
    font-size: 28px;
    padding: 7px 11px;
  }

  .mic,
  .play-btn-circle {
    width: 65px;
    height: 65px;
    font-size: 24px;
  }

  .top-controls {
    transform: scale(0.9);
    transform-origin: top right;
    top: 10px;
    right: 80px;
  }

  .fullscreen-button {
    width: 56px;
    min-height: 56px;
    font-size: 24px;
  }
}

/* ========== MESSAGE DIALOG STYLES ========== */
.message-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}

.message-dialog.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.message-dialog-content {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  padding: 35px 45px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  max-width: 450px;
  width: 90%;
  animation: slideIn 0.3s ease;
  border: 2px solid #e0e0e0;
}

.message-dialog-icon {
  font-size: 56px;
  margin-bottom: 15px;
  line-height: 1;
  color: #e74c3c;
}

.message-dialog-title {
  font-size: 24px;
  font-weight: 700;
  color: #2c3e50;
  margin: 0 0 15px 0;
}

.message-dialog-text {
  font-size: 16px;
  line-height: 1.6;
  color: #555;
  margin: 0 0 25px 0;
}

.message-dialog-btn {
  padding: 12px 40px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.message-dialog-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.5);
}

.message-dialog-btn:active {
  transform: translateY(0);
}

/* Responsive adjustments for message dialog */
@media (max-width: 600px) {
  .message-dialog-content {
    padding: 25px 30px;
    max-width: 320px;
  }

  .message-dialog-icon {
    font-size: 48px;
  }

  .message-dialog-title {
    font-size: 20px;
  }

  .message-dialog-text {
    font-size: 14px;
  }

  .message-dialog-btn {
    padding: 10px 30px;
    font-size: 14px;
  }
}

/* Non-blocking banner shown when the server reports a newer build. */
.update-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  z-index: 2500;
  animation: slideIn 0.3s ease;
}

.update-banner.hidden {
  display: none;
}

.update-banner-text {
  font-size: 15px;
  font-weight: 600;
}

.update-banner-btn {
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.update-banner-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

@media (max-width: 600px) {
  .update-banner {
    left: 10px;
    right: 10px;
    transform: none;
    bottom: 10px;
  }

  .update-banner-text {
    font-size: 14px;
  }
}

/* Flashcards Navigation Button Styling */
.flashcards-nav-btn {
  background: linear-gradient(145deg, #FF9800, #E65100) !important;
  color: white !important;
  padding: 12px 24px !important;
  font-size: 18px !important;
  font-family: 'Nunito', sans-serif !important;
  font-weight: bold !important;
  border-radius: 12px !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(230, 81, 0, 0.3) !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease !important;
  margin-top: 10px;
}

.flashcards-nav-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 15px rgba(230, 81, 0, 0.4) !important;
  background: linear-gradient(145deg, #ffa726, #ef6c00) !important;
}

.flashcards-nav-btn:active {
  transform: translateY(0) !important;
}
