/* ========================================
   MODERN SIGN LANGUAGE TRANSLATOR
   Modern UI/UX Enhancement
   ======================================== */

/* ========================================
   CSS VARIABLES - MODERN COLOR PALETTE
   ======================================== */
:root {
  --primary-gradient: linear-gradient(135deg, #06B6D4 0%, #0D9488 50%, #8B5CF6 100%);
  --primary-dark: #0D9488;
  --primary-light: #06B6D4;
  --accent-purple: #8B5CF6;
  --accent-pink: #EC4899;
  --bg-light: #F8FAFC;
  --bg-white: #FFFFFF;
  --text-dark: #1E293B;
  --text-muted: #64748B;
  --border-light: #E2E8F0;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
}

/* ========================================
   GLOBAL STYLES
   ======================================== */
body {
  font-family: "Google Sans", "Segoe UI", "Helvetica Neue", sans-serif;
  margin: 0;
  padding: 0;
  padding-top: 180px;
  background: linear-gradient(180deg, #F8FAFC 0%, #F1F5F9 100%);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
}

/* Modern Scrollbar Styling */
body::-webkit-scrollbar {
  width: 10px;
}

body::-webkit-scrollbar-track {
  background: var(--bg-light);
}

body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary-light), var(--accent-purple));
  border-radius: 10px;
  border: 3px solid var(--bg-light);
}

body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--primary-dark), var(--accent-purple));
}

/* ========================================
   WELCOME SCREEN
   ======================================== */
#welcomeContainer {
  width: 100%;
  height: 100%;
  position: absolute;
  background: linear-gradient(135deg, #F8FAFC 0%, #E0F2FE 100%);
  z-index: 10;
  box-shadow: none;
}

#welcomeScreen {
  text-align: center;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: "Google Sans", "sans-serif";
}

#welcomeScreen h1 {
  font-size: 56px;
  font-weight: 600;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  overflow: hidden;
  border-right: 2px solid var(--primary-dark);
  white-space: nowrap;
  font-family: "Google Sans", "sans-serif";
  margin: 0px;
  animation: typing 3s steps(35, end), blink-caret .5s step-end infinite;
  letter-spacing: -0.5px;
}

@keyframes typing {
  from {
    width: 0
  }
  to {
    width: 100%
  }
}

@keyframes blink-caret {
  from, to {
    border-color: transparent
  }
  50% {
    border-color: var(--primary-dark)
  }
}

#welcomeScreen h3 {
  padding-top: 20px;
  margin: 0px;
  color: var(--text-muted);
  font-size: 24px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.5px;
}

/* ========================================
   VIDEO ELEMENTS
   ======================================== */
#video {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
  -moz-transform: rotateY(180deg);
  background-color: #000;
  transition: all 0.3s ease;
  border-radius: 12px;
}

#videoHolder {
  background-color: #000;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 12px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 650px;
  aspect-ratio: 16 / 9;
}

.videoContainerTrain {
  height: auto;
  width: 100%;
  max-width: 550px;
  margin: 0;
}

.videoContainerPredict {
  width: 100%;
  max-width: 650px;
  height: auto;
  margin: 0;
}

.videoTrain {
  height: 100%;
  width: 100%;
  border-radius: 12px;
}

.videoPredict {
  height: 100%;
  width: 100%;
  border-radius: 12px;
}

#videoCall {
  display: none;
  width: 650px;
  height: 370px;
  border: none;
  overflow: hidden;
  left: 2.5%;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
h5 {
  font-size: 28px;
  font-weight: 600;
  margin: 0px;
  height: auto;
  color: var(--text-dark);
  letter-spacing: -0.5px;
}

h7 {
  font-size: 16px;
  margin: 0px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: 'Google Sans', sans-serif;
}

/* ========================================
   BUTTONS
   ======================================== */
button {
  text-align: center;
  font-family: "Google Sans", "sans-serif";
  background: var(--primary-gradient);
  color: white;
  font-size: 16px;
  padding: 12px 28px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

button:active {
  transform: translateY(0px);
  box-shadow: var(--shadow-sm);
}

button:focus {
  outline: 2px solid var(--accent-purple);
  outline-offset: 2px;
}

button:focus-visible {
  outline: 3px solid var(--accent-purple);
  outline-offset: 2px;
}

/* ========================================
   SPECIFIC BUTTONS
   ======================================== */
#proceedButton {
  top: 88%;
  transform: translateX(-50%);
  left: 50%;
  position: fixed;
  display: none;
  font-size: 18px;
  padding: 14px 32px;
  z-index: 11;
}

#startButton {
  display: block;
  margin: 0 auto;
  background: linear-gradient(135deg, #06B6D4 0%, #0D9488 100%);
  width: 100%;
  max-width: 200px;
}

#stopButton {
  margin: 0 auto;
  display: block;
  background: linear-gradient(135deg, #06B6D4 0%, #0D9488 100%);
  width: 100%;
  max-width: 200px;
}

.clearButton {
  padding: 8px 16px;
  font-size: 14px;
  color: white;
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  margin: 0 auto;
  font-weight: 600;
  width: 100%;
  max-width: 140px;
}

.trainBtn {
  padding: 8px 16px;
  font-size: 14px;
  color: white;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  margin: 0 auto;
  margin-right: 20px;
  font-weight: 600;
}

.trainButton {
  margin-top: 25px;
  right: 2.5%;
  z-index: 3;
}

#nextButton {
  position: relative;
  top: auto;
  right: auto;
  z-index: auto;
}

#predictButton {
  position: relative;
  top: auto;
  right: auto;
  z-index: auto;
  display: none;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-purple) 100%);
}

#backButton {
  position: relative;
  top: auto;
  left: auto;
  z-index: auto;
  display: none;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
}

.videoCallBtn {
  position: relative;
  top: auto;
  right: auto;
  z-index: auto;
  display: none;
  background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
}

/* ========================================
   STATUS BAR
   ======================================== */
#status {
  width: auto;
  min-width: 280px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
  position: fixed;
  z-index: 99;
  left: 20px;
  top: 200px;
  border: none;
  text-align: center;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  display: none;
  padding: 0 16px;
}

#status p {
  color: white;
  font-weight: 600;
  margin: 8px 0;
  font-size: 14px;
}

/* ========================================
   TITLE BAR
   ======================================== */
#titleBar {
  text-align: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  font-family: "Google Sans", "sans-serif";
  background: linear-gradient(180deg, var(--bg-white) 0%, #F8FAFC 100%);
  z-index: 100;
  box-shadow: var(--shadow-md);
  border-radius: 0 0 12px 12px;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#titleBar h1 {
  font-size: 42px;
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  overflow: hidden;
  border-right: 2px solid var(--primary-dark);
  white-space: nowrap;
  font-family: "Google Sans", "sans-serif";
  margin: 0px;
  display: inline-block;
  animation: typing 3s steps(35, end), blink-caret .5s step-end infinite;
  margin-top: 12px;
}

#titleBar h3 {
  padding: 0;
  margin: 0;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

#titleBar nav {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  padding: 0 16px;
}

#titleBar nav button {
  font-size: 14px;
  padding: 10px 20px;
}

/* ========================================
   CARDS & CONTAINERS
   ======================================== */
.trained-gestures {
  width: 100%;
  height: 220px;
  margin: 0;
  background: var(--bg-white);
  color: var(--text-dark);
  text-align: center;
  cursor: pointer;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 16px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--border-light);
  animation: fadeIn 0.5s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.trained-gestures:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

#trainedCardsHolder {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

#trainingHolder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 450px;
  height: auto;
  margin: 0;
  background: linear-gradient(135deg, #1E293B 0%, #334155 100%);
  color: white;
  text-align: center;
  cursor: pointer;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 24px;
}

#initialTrainingHolder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 500px;
  padding: 24px;
  background: var(--bg-white);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

#translatorWindow {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  z-index: 1;
  color: var(--text-dark);
  min-height: calc(100vh - 200px);
}

#translationHolder {
  width: 100%;
  max-width: 450px;
  color: var(--text-dark);
  background: linear-gradient(135deg, var(--bg-white) 0%, #F1F5F9 100%);
  text-align: center;
  cursor: pointer;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
  animation: slideInFromRight 0.4s ease-out;
}

#translationHolder:hover {
  box-shadow: var(--shadow-lg);
}

#translationHolder h3 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0;
}

/* ========================================
   TRAINING ELEMENTS
   ======================================== */
#trainingCommands {
  margin-top: 20px;
}

#add-gesture {
  color: white;
  margin-bottom: 12px;
  font-size: 24px;
  font-weight: 600;
}

img.plus_sign {
  height: 80px;
  display: block;
  padding: 12px;
  margin: 0 auto;
  opacity: 0.8;
  transition: all 0.3s ease;
}

img.plus_sign:hover {
  opacity: 1;
  transform: scale(1.05);
}

.checkMark {
  height: 32px;
  opacity: 0.9;
  animation: scaleIn 0.4s ease-out;
}

#checkmark_startButton {
  padding-bottom: 5px;
}

#checkmark_stopButton {
  display: block;
  margin: 0 auto;
  margin-top: 5px;
}

.counter {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-dark);
  display: inline-block;
  padding: 0px;
  margin: 0px;
}

.doneRetrain {
  background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
  border: none;
  color: white;
  font-weight: 700;
  font-size: 14px;
  margin: 0 auto;
  border-radius: 6px;
  display: none;
  padding: 10px 20px;
}

/* ========================================
   IMAGES & MEDIA
   ======================================== */
#translatedCard {
  width: 100%;
  max-width: 300px;
  position: relative;
  transition: all 0.3s ease;
}

img.trained_image {
  height: 130px;
  display: block;
  padding: 0;
  margin: 0 auto;
  border-radius: 8px;
  transition: all 0.3s ease;
  max-width: 100%;
}

canvas.trained_image {
  height: 130px;
  width: 100%;
  max-width: 170px;
  display: block;
  padding: 0;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

/* ========================================
   FORMS & INPUTS
   ======================================== */
label {
  display: block;
  margin: 0;
  font-weight: 500;
  color: white;
  font-size: 14px;
  margin-bottom: 8px;
}

#add-word {
  text-align: center;
  font-size: 16px;
  width: 100%;
  max-width: 250px;
  border-radius: 8px;
  border: 2px solid var(--border-light);
  font-family: 'Google Sans', sans-serif;
  vertical-align: middle;
  padding: 10px 12px;
  transition: all 0.3s ease;
  color: var(--text-dark);
  background: var(--bg-white);
  box-sizing: border-box;
}

#add-word:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

#add-word:focus-visible {
  outline: 3px solid var(--primary-light);
  outline-offset: 2px;
}

#submit-word {
  font-family: 'Google Sans', sans-serif;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-purple) 100%);
  border: none;
  color: white;
  font-weight: 700;
  font-size: 14px;
  margin: 8px 0 0 0;
  border-radius: 8px;
  vertical-align: middle;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 250px;
  box-sizing: border-box;
}

#submit-word:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ========================================
   SMOOTH SCROLLING & TRANSITIONS
   ======================================== */
* {
  scroll-behavior: smooth;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 1024px) {
  body {
    padding-top: 200px;
  }

  #titleBar h1 {
    font-size: 32px;
  }

  #titleBar h3 {
    font-size: 14px;
  }

  #titleBar nav button {
    font-size: 13px;
    padding: 8px 16px;
  }

  button {
    font-size: 14px;
    padding: 10px 20px;
  }

  .trained-gestures {
    width: 100%;
    height: 180px;
  }

  #trainingHolder {
    max-width: 400px;
  }

  #videoHolder {
    max-width: 550px;
  }
}

@media (max-width: 768px) {
  body {
    padding-top: 240px;
  }

  #titleBar {
    padding: 12px 0;
  }

  #titleBar h1 {
    font-size: 24px;
    animation: none;
    border: none;
  }

  #titleBar h3 {
    font-size: 12px;
  }

  #titleBar nav {
    gap: 8px;
  }

  #titleBar nav button {
    font-size: 12px;
    padding: 8px 12px;
  }

  #translatorWindow {
    padding: 16px;
    gap: 16px;
  }

  button {
    font-size: 14px;
    padding: 10px 16px;
  }

  .trained-gestures {
    width: 100%;
    height: 160px;
  }

  #initialTrainingHolder,
  #trainingHolder,
  #translationHolder {
    max-width: 100%;
  }

  #videoHolder {
    max-width: 100%;
  }

  #status {
    left: 10px;
    top: 240px;
    width: auto;
    min-width: 200px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  body {
    padding-top: 280px;
  }

  #titleBar {
    padding: 10px 0;
  }

  #titleBar h1 {
    font-size: 20px;
  }

  #titleBar h3 {
    font-size: 11px;
  }

  #titleBar nav {
    gap: 6px;
    width: calc(100% - 32px);
  }

  #titleBar nav button {
    font-size: 11px;
    padding: 6px 10px;
    flex: 1;
    min-width: 80px;
  }

  #translatorWindow {
    padding: 12px;
    gap: 12px;
  }

  button {
    font-size: 12px;
    padding: 8px 12px;
  }

  .trained-gestures {
    width: 100%;
    height: 140px;
  }

  h5 {
    font-size: 20px;
  }

  #initialTrainingHolder {
    max-width: 100%;
    padding: 16px;
  }

  #trainingHolder {
    max-width: 100%;
    padding: 16px;
  }

  #translationHolder {
    max-width: 100%;
    padding: 16px;
  }

  #videoHolder {
    max-width: 100%;
  }

  #status {
    left: 10px;
    top: 280px;
    font-size: 11px;
  }
}

