:root {
  --primary-color: #4f46e5;
  --secondary-color: #7c3aed;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --dark-bg: #1f2937;
  --light-bg: #f9fafb;
  --text-dark: #111827;
  --text-light: #ffffff;
  --border-color: #e5e7eb;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Roboto",
    sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* LOGIN SCREEN STYLES */
.login-screen {
  width: 100%;
  max-width: 500px;
  animation: fadeIn 0.5s ease;
}

.login-container {
  background: white;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 48px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  color: var(--text-dark);
  font-size: 2em;
  margin-bottom: 12px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-header p {
  color: #6b7280;
  font-size: 1.05em;
  font-weight: 400;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  color: var(--text-dark);
  font-weight: 600;
  font-size: 0.95em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group label i {
  color: var(--primary-color);
}

.form-group input {
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 1em;
  transition: all 0.2s ease;
  font-family: inherit;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group input::placeholder {
  color: #9ca3af;
}

.login-button {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border: none;
  padding: 16px 32px;
  font-size: 1.1em;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.3);
  margin-top: 8px;
}

.login-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(79, 70, 229, 0.4);
}

.login-button:active {
  transform: translateY(0);
}

/* USER INFO DISPLAY */
.user-info {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
}

#userDisplay {
  display: none;
}

.logout-button {
  background: white;
  color: #6b7280;
  border: none;
  padding: 8px 14px;
  font-size: 0.85em;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.logout-button:hover {
  background: var(--danger-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  border-color: var(--danger-color);
}

.logout-button i {
  font-size: 0.9em;
}

.logout-button span {
  display: inline-block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.container {
  background: white;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 850px;
  width: 100%;
  padding: 48px;
  backdrop-filter: blur(10px);
  position: relative;
}

.logo-container {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border-color);
}

.sarv-logo {
  height: 40px;
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.header {
  text-align: center;
  margin-bottom: 40px;
}

.header h1 {
  color: var(--text-dark);
  font-size: 2.75em;
  margin-bottom: 12px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header p {
  color: #6b7280;
  font-size: 1.15em;
  font-weight: 400;
}

.control-panel {
  text-align: center;
  margin: 40px 0;
}

.start-button {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border: none;
  padding: 22px 56px;
  font-size: 1.15em;
  font-weight: 600;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.3);
}

.start-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 40px rgba(79, 70, 229, 0.4);
}

.start-button:active {
  transform: translateY(-1px);
}

.start-button.recording {
  background: linear-gradient(135deg, var(--danger-color), #dc2626);
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.3);
}

.start-button.recording:hover {
  box-shadow: 0 20px 40px rgba(239, 68, 68, 0.4);
}

.visualization {
  height: 160px;
  background: var(--light-bg);
  border-radius: 16px;
  margin: 32px 0;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

#waveCanvas {
  width: 100%;
  height: 100%;
}

.result-panel {
  background: var(--light-bg);
  padding: 36px;
  border-radius: 16px;
  margin-top: 32px;
  min-height: 110px;
  border: 1px solid var(--border-color);
}

.result-title {
  font-size: 1.6em;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 24px;
  text-align: center;
  letter-spacing: -0.02em;
}

.language-result {
  background: white;
  padding: 1px 48px;
  border-radius: 40px;
  margin-bottom: 0px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border-color);
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

.language-result:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.language-name {
  font-size: 3em;
  color: var(--primary-color);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.status-message {
  text-align: center;
  padding: 1px;
  font-size: 1.15em;
  font-weight: 500;
  color: #6b7280;
}

.status-message.listening {
  color: var(--warning-color);
  font-weight: 600;
  animation: pulse 1.5s infinite;
}

.status-message.speaking {
  color: var(--success-color);
  font-weight: 600;
  animation: pulse 1.5s ease-in-out infinite;
}

.status-message.processing {
  color: var(--warning-color);
  font-weight: 500;
}

/* FEEDBACK SECTION */
.feedback-section {
  margin-top: 24px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.03), rgba(124, 58, 237, 0.03));
  border-radius: 16px;
  border: 2px dashed rgba(79, 70, 229, 0.2);
  animation: fadeIn 0.3s ease;
}

.feedback-question {
  text-align: center;
  font-size: 1.05em;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 16px;
}

.feedback-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.feedback-btn {
  flex: 1;
  min-width: 110px;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.feedback-correct {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.feedback-correct:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.feedback-wrong {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.feedback-wrong:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.feedback-noise {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.feedback-noise:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.feedback-btn:active {
  transform: translateY(0);
}

.feedback-btn.submitted {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.flag-icon {
  font-size: 4em;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
  line-height: 1;
}

/* Tablet Styles */
@media (max-width: 768px) {
  body {
    padding: 15px;
  }

  .user-info {
    top: 16px;
    right: 16px;
  }

  .logout-button {
    padding: 8px 16px;
    font-size: 0.85em;
  }

  .container {
    padding: 32px 24px;
    border-radius: 20px;
  }

  .logo-container {
    margin-bottom: 24px;
    padding-bottom: 20px;
  }

  .sarv-logo {
    height: 36px;
  }

  .header {
    margin-bottom: 32px;
  }

  .header h1 {
    font-size: 2.2em;
  }

  .header p {
    font-size: 1.05em;
  }

  .control-panel {
    margin: 32px 0;
  }

  .start-button {
    padding: 18px 40px;
    font-size: 1.05em;
  }

  .visualization {
    height: 140px;
    margin: 28px 0;
  }

  .result-panel {
    padding: 1px;
    min-height: 100px;
  }

  .result-title {
    font-size: 1.4em;
    margin-bottom: 10px;
  }

  .language-result {
    flex-direction: column;
    gap: 20px;
    padding: 28px;
  }

  .flag-icon {
    font-size: 3.5em;
  }

  .language-name {
    font-size: 2.5em;
  }
}

/* Mobile Styles */
@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  .login-container {
    padding: 32px 24px;
    border-radius: 20px;
  }

  .login-header h1 {
    font-size: 1.75em;
  }

  .login-header p {
    font-size: 0.95em;
  }

  .form-group input {
    padding: 12px 14px;
    font-size: 0.95em;
  }

  .login-button {
    padding: 14px 28px;
    font-size: 1em;
  }

  .user-info {
    top: 12px;
    right: 12px;
  }

  .logout-button {
    padding: 8px 16px;
    font-size: 0.85em;
  }

  .logout-button span {
    display: inline-block;
  }

  .container {
    padding: 24px 20px;
    border-radius: 16px;
    max-width: 100%;
  }

  .logo-container {
    margin-bottom: 20px;
    padding-bottom: 16px;
  }

  .sarv-logo {
    height: 28px;
  }

  .header {
    margin-bottom: 24px;
  }

  .header h1 {
    font-size: 1.75em;
    margin-bottom: 8px;
  }

  .header p {
    font-size: 0.95em;
    line-height: 1.4;
  }

  .control-panel {
    margin: 24px 0;
  }

  .start-button {
    padding: 16px 32px;
    font-size: 1em;
    width: 100%;
    max-width: 280px;
  }

  .visualization {
    height: 120px;
    margin: 20px 0;
    border-radius: 12px;
  }

  .result-panel {
    padding: 10px;
    min-height: 160px;
    border-radius: 12px;
    margin-top: 20px;
  }

  .result-title {
    font-size: 1.25em;
    margin-bottom: 16px;
  }

  .language-result {
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    border-radius: 12px;
  }

  .flag-icon {
    font-size: 3em;
  }

  .language-name {
    font-size: 2em;
  }

  .status-message {
    padding: 1px;
    font-size: 1em;
  }

  .feedback-section {
    padding: 16px;
    margin-top: 20px;
  }

  .feedback-question {
    font-size: 0.95em;
    margin-bottom: 12px;
  }

  .feedback-buttons {
    gap: 8px;
  }

  .feedback-btn {
    min-width: 90px;
    padding: 10px 16px;
    font-size: 0.85em;
  }
}

/* Small Mobile Styles */
@media (max-width: 360px) {
  .container {
    padding: 20px 16px;
  }

  .user-info {
    top: 10px;
    right: 10px;
  }

  .logout-button {
    padding: 7px 14px;
    font-size: 0.8em;
  }

  .sarv-logo {
    height: 24px;
  }

  .header h1 {
    font-size: 1.5em;
  }

  .header p {
    font-size: 0.9em;
  }

  .start-button {
    padding: 14px 28px;
    font-size: 0.95em;
  }

  .visualization {
    height: 100px;
  }

  .language-name {
    font-size: 1.75em;
  }

  .flag-icon {
    font-size: 2.5em;
  }
}
