/* Modern Glass Morphism Design System */

:root {
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  --glass-backdrop: blur(10px);
  --primary-gradient: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
  --success-gradient: linear-gradient(45deg, #00b09b, #96c93d);
  --warning-gradient: linear-gradient(45deg, #ffd700, #ffb700);
  --danger-gradient: linear-gradient(45deg, #ff416c, #ff4b2b);
  --info-gradient: linear-gradient(45deg, #8e2de2, #4a00e0);
  --secondary-gradient: linear-gradient(45deg, #2193b0, #6dd5ed);
}

/* 🔵 Animated Wave Background */
.wave-bg {
  position: fixed;
  width: 100%;
  height: 100%;
  overflow: hidden;
  top: 0;
  left: 0;
  z-index: -1;
  background: radial-gradient(circle at 20% 30%, #3b82f6 0%, #111827 80%);
  animation: bgPulse 20s infinite alternate ease-in-out;
}

.wave {
  position: absolute;
  width: 200%;
  height: 200px;
  background: rgba(255,255,255,0.15);
  bottom: 0;
  left: 0;
  border-radius: 1000px;
  animation: waveMotion 12s infinite linear;
  transform-origin: center;
  box-shadow: 0 0 50px rgba(59, 130, 246, 0.2);
}

.wave:nth-child(1) {
  animation: waveMotion 12s infinite linear;
  opacity: 0.4;
  height: 220px;
  background: rgba(59, 130, 246, 0.2);
}

.wave:nth-child(2) {
  animation: waveMotion 8s infinite linear reverse;
  animation-delay: -2s;
  opacity: 0.6;
  height: 250px;
  background: rgba(6, 182, 212, 0.25);
}

.wave:nth-child(3) {
  animation: waveMotion 15s infinite linear;
  animation-delay: -4s;
  opacity: 0.3;
  height: 280px;
  background: rgba(139, 92, 246, 0.15);
}

@keyframes waveMotion {
  0% { transform: translateX(0) translateY(0) rotate(0deg); }
  25% { transform: translateX(-25%) translateY(-15px) rotate(2deg); }
  50% { transform: translateX(-50%) translateY(-10px) rotate(0deg); }
  75% { transform: translateX(-25%) translateY(-5px) rotate(-2deg); }
  100% { transform: translateX(0) translateY(0) rotate(0deg); }
}

@keyframes bgPulse {
  0% { background: radial-gradient(circle at 20% 30%, #3b82f6 0%, #111827 80%); }
  50% { background: radial-gradient(circle at 30% 40%, #06b6d4 0%, #111827 80%); }
  100% { background: radial-gradient(circle at 40% 50%, #8b5cf6 0%, #111827 80%); }
}

/* Base body styling */
.glass-body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--primary-gradient);
  color: #fff;
  margin: 0;
  min-height: 100vh;
  direction: rtl;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  animation: bgShift 30s ease infinite;
  background-size: 200% 200%;
}

@keyframes bgShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Glass container */
.glass-container {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 40px;
  width: 90%;
  max-width: 700px;
  text-align: center;
  animation: fadeIn 0.8s ease-out;
  transform: translateZ(0);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  z-index: 10;
}

.glass-container:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 50px rgba(0,0,0,0.4);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Glass card */
.glass-card {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-radius: 15px;
  border: 1px solid var(--glass-border);
  padding: 25px;
  margin: 20px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-3px);
}

/* Headings */
.glass-h1 {
  color: #fff;
  font-size: 2.2rem;
  margin-bottom: 15px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.glass-h2 {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.5rem;
  margin-top: 0;
  margin-bottom: 15px;
}

/* Paragraphs */
.glass-p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1rem;
  line-height: 1.6;
}

/* Glass sentence box */
.glass-sentence-box {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-radius: 15px;
  border: 1px solid var(--glass-border);
  padding: 25px;
  margin: 30px 0;
  font-size: 1.6em;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
  line-height: 1.4;
  touch-action: manipulation;
  user-select: text;
}

.glass-sentence-box:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.glass-sentence-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: 0.5s;
}

.glass-sentence-box:hover::before {
  left: 100%;
}

/* Controls container */
.glass-controls {
  margin-bottom: 30px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* Glass buttons */
.glass-button {
  padding: 14px 28px;
  font-size: 1.1em;
  font-weight: 600;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  margin: 6px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  outline: none;
  min-width: 140px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transform: translateZ(0);
  will-change: transform;
  touch-action: manipulation;
}

.glass-button::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 20px;
  height: 200%;
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(25deg);
  transition: all 0.6s;
}

.glass-button:hover::after {
  left: 120%;
}

.glass-button:hover:not(:disabled) {
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 8px 25px rgba(255,255,255,0.3);
}

.glass-button:active:not(:disabled) {
  transform: translateY(2px) scale(0.98);
  transition: all 0.1s ease;
}

.glass-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.glass-button:hover::before {
  transform: translateX(0);
}

.glass-button:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.glass-button:active:not(:disabled) {
  transform: translateY(1px);
}

.glass-button:disabled {
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.1) !important;
  color: rgba(255, 255, 255, 0.5) !important;
  box-shadow: none;
  transform: none;
}

/* Button variants */
.glass-button-primary {
  background: var(--secondary-gradient);
  color: white;
}

.glass-button-success {
  background: var(--success-gradient);
  color: white;
}

.glass-button-warning {
  background: var(--warning-gradient);
  color: #333;
}

.glass-button-danger {
  background: var(--danger-gradient);
  color: white;
}

.glass-button-info {
  background: var(--info-gradient);
  color: white;
}

/* Recording button animation */
.glass-button-record.recording {
  background: var(--danger-gradient);
  animation: pulse 1.5s infinite;
  position: relative;
  overflow: hidden;
}

.glass-button-record.recording::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 20px;
  height: 200%;
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(25deg);
  transition: all 0.6s;
  animation: shine 1.5s infinite;
}

@keyframes shine {
  0% { left: -60%; }
  20% { left: -30%; }
  40% { left: 0%; }
  60% { left: 30%; }
  80% { left: 60%; }
  100% { left: 100%; }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 75, 43, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(255, 75, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 75, 43, 0); }
}

/* Status indicator */
.glass-status {
  margin: 20px 0;
  font-size: 1.2em;
  color: rgba(255, 255, 255, 0.9);
  height: 25px;
  font-weight: 500;
  text-align: center;
  transition: all 0.3s ease;
}

.glass-status.recording {
  color: #ff4b2b;
  font-weight: 600;
  text-shadow: 0 0 10px rgba(255, 75, 43, 0.7);
  animation: pulseText 2s infinite;
}

@keyframes pulseText {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* 🎵 Wave Visualization */
.wave-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 60px;
  margin: 20px 0;
  opacity: 0;
  transition: opacity 0.5s ease;
  perspective: 1000px;
  position: relative;
  z-index: 5;
}

.wave-visual.active {
  opacity: 1;
}

.wave-visual span {
  display: inline-block;
  width: 6px;
  height: 20px;
  background: linear-gradient(to top, #3b82f6, #06b6d4);
  margin: 0 4px;
  border-radius: 3px;
  animation: waveAnimation 1.5s infinite ease-in-out;
  transform-origin: bottom;
  box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
}

.wave-visual span:nth-child(1) {
  animation-delay: 0s;
  height: 15px;
  background: linear-gradient(to top, #3b82f6, #8b5cf6);
}

.wave-visual span:nth-child(2) {
  animation-delay: 0.1s;
  height: 30px;
  background: linear-gradient(to top, #3b82f6, #06b6d4);
}

.wave-visual span:nth-child(3) {
  animation-delay: 0.2s;
  height: 45px;
  background: linear-gradient(to top, #06b6d4, #a3e635);
}

.wave-visual span:nth-child(4) {
  animation-delay: 0.3s;
  height: 30px;
  background: linear-gradient(to top, #3b82f6, #06b6d4);
}

.wave-visual span:nth-child(5) {
  animation-delay: 0.4s;
  height: 15px;
  background: linear-gradient(to top, #8b5cf6, #3b82f6);
}

@keyframes waveAnimation {
  0%, 100% { 
    transform: scaleY(1) translateY(0);
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
  }
  50% { 
    transform: scaleY(2.5) translateY(-10px);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.8);
  }
}

@keyframes waveAnimationRecording {
  0% { 
    transform: scaleY(1) translateY(0);
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
  }
  25% { 
    transform: scaleY(3) translateY(-15px);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.9);
  }
  50% { 
    transform: scaleY(1.5) translateY(-5px);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.7);
  }
  75% { 
    transform: scaleY(4) translateY(-20px);
    box-shadow: 0 0 25px rgba(59, 130, 246, 1);
  }
}

/* Enhanced wave visualization for recording */
.wave-visual.active span {
  animation: waveAnimationRecording 1s infinite ease-in-out;
  animation-play-state: running;
}

.wave-visual:not(.active) span {
  animation-play-state: paused;
}

/* Textarea */
.glass-textarea {
  width: 95%;
  height: 200px;
  margin: 15px 0 25px;
  padding: 15px;
  font-size: 1.1em;
  border-radius: 15px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.glass-textarea:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.15);
}

.glass-textarea::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

/* Audio player */
.glass-audio {
  width: 100%;
  margin-top: 20px;
  display: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
}

/* Response message */
.glass-response {
  margin-top: 25px;
  font-weight: 600;
  font-size: 1.1em;
  padding: 15px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
}

/* AI Indicator */
.glass-ai-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  animation: float 3s ease-in-out infinite;
}

.glass-ai-icon {
  width: 35px;
  height: 35px;
  background: linear-gradient(45deg, #8b5cf6, #4f46e5);
  border-radius: 50%;
  margin-left: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: rotate 4s linear infinite;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(142, 45, 226, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(142, 45, 226, 0); }
  100% { box-shadow: 0 0 0 0 rgba(142, 45, 226, 0); }
}

.glass-ai-icon::after {
  content: "AI";
  font-size: 13px;
  font-weight: bold;
  color: white;
}

.glass-ai-text {
  font-weight: 600;
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Responsive design */
@media (max-width: 768px) {
  .glass-container {
    padding: 25px;
    width: 95%;
  }
  
  .glass-sentence-box {
    font-size: 1.3em;
    padding: 20px;
  }
  
  .glass-controls {
    flex-direction: column;
    align-items: center;
  }
  
  .glass-button {
    width: 100%;
    max-width: 300px;
    margin: 8px 0;
  }
  
  .glass-textarea {
    height: 150px;
  }
  
  .glass-h1 {
    font-size: 1.8rem;
  }
  
  .glass-h2 {
    font-size: 1.3rem;
  }
  
  .glass-sentence-box {
    font-size: 1.4em;
  }
}