/**
 * Tamil Tracing CSS - Enhanced Edition
 * Version: 3.0.0
 * 
 * NEW STYLES:
 * - Progress bar indicator
 * - Difficulty preset buttons
 * - Completion celebration animation
 * - Sound toggle button styling
 * - Improved mobile responsiveness
 * - Undo and Clear button styles
 */

.tamil-tracing-wrapper {
  position: relative;
  margin: 20px auto;
  text-align: center;
  max-width: 100%;
  padding: 20px;
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Progress Bar */
.tracing-progress {
  height: 12px;
  background: #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 20px;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.tracing-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4CAF50, #8BC34A);
  width: 0%;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.tracing-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.tracing-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: bold;
  color: #333;
  text-shadow: 0 0 3px rgba(255,255,255,0.8);
}

/* Canvas */
.tamil-tracing-wrapper canvas {
  border: 3px solid #333;
  border-radius: 10px;
  background: linear-gradient(to top, #fc6, #ffc);
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  cursor: crosshair;
  transition: all 0.3s ease;
}

.tamil-tracing-wrapper canvas:hover {
  border-color: #4CAF50;
}

/* Completion Animation */
@keyframes successPulse {
  0%, 100% { 
    transform: scale(1);
    border-color: #333;
    box-shadow: 0 0 0 rgba(76, 175, 80, 0);
  }
  50% { 
    transform: scale(1.02);
    border-color: #4CAF50;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.6);
  }
}

.canvas-success {
  animation: successPulse 0.6s ease-in-out;
}

/* Difficulty Selector */
.difficulty-selector {
  margin: 15px 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.difficulty-selector label {
  font-weight: bold;
  margin-right: 10px;
  line-height: 38px;
  color: #555;
}

.difficulty-btn {
  background: #f0f0f0;
  color: #333;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 8px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.difficulty-btn:hover {
  background: #e0e0e0;
  border-color: #ccc;
  transform: translateY(-2px);
}

.difficulty-btn.active {
  background: #4CAF50;
  color: white;
  border-color: #4CAF50;
}

@keyframes difficultySelect {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.difficulty-btn.selected-difficulty {
  animation: difficultySelect 0.3s ease;
}

/* Controls */
.tracing-controls {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tracing-controls button {
  background: #060;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.tracing-controls button:hover {
  background: #050;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.tracing-controls button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Specific button colors */
#tamil-tracing-start {
  background: #4CAF50;
}

#tamil-tracing-start:hover {
  background: #45a049;
}

#tamil-tracing-reset {
  background: #FF9800;
}

#tamil-tracing-reset:hover {
  background: #F57C00;
}

#tamil-tracing-undo {
  background: #2196F3;
}

#tamil-tracing-undo:hover {
  background: #1976D2;
}

#tamil-tracing-clear {
  background: #f44336;
}

#tamil-tracing-clear:hover {
  background: #d32f2f;
}

/* Sound Toggle */
#tamil-tracing-sound-toggle {
  background: #9C27B0;
  font-size: 18px;
  padding: 10px 16px;
  min-width: 50px;
}

#tamil-tracing-sound-toggle:hover {
  background: #7B1FA2;
}

#tamil-tracing-sound-toggle.muted {
  background: #757575;
  opacity: 0.7;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .tamil-tracing-wrapper {
    padding: 15px;
  }

  .tamil-tracing-wrapper canvas {
    border-width: 2px;
  }

  .tracing-progress {
    height: 10px;
    margin-bottom: 15px;
  }

  .tracing-progress-text {
    font-size: 9px;
  }

  .difficulty-selector {
    margin: 10px 0;
  }

  .difficulty-selector label {
    width: 100%;
    text-align: center;
    line-height: normal;
    margin-bottom: 8px;
  }

  .difficulty-btn {
    padding: 10px 18px;
    font-size: 15px;
    flex: 1;
    min-width: 80px;
  }

  .tracing-controls {
    margin-top: 12px;
    gap: 8px;
  }

  .tracing-controls button {
    padding: 12px 18px;
    font-size: 16px;
    flex: 1;
    min-width: 70px;
    /* Larger touch targets for mobile */
  }

  #tamil-tracing-sound-toggle {
    font-size: 20px;
    padding: 12px 18px;
  }
}

@media (max-width: 480px) {
  .tamil-tracing-wrapper {
    padding: 10px;
    margin: 10px auto;
  }

  .tracing-controls {
    flex-direction: column;
  }

  .tracing-controls button {
    width: 100%;
    min-width: auto;
  }

  .difficulty-selector {
    flex-direction: column;
  }

  .difficulty-btn {
    width: 100%;
  }
}

/* Keyboard Shortcuts Info (optional) */
.shortcuts-info {
  margin-top: 15px;
  font-size: 12px;
  color: #666;
  font-style: italic;
}

.shortcuts-info strong {
  color: #333;
  font-weight: 600;
}

/* Accessibility */
button:focus {
  outline: 3px solid #4CAF50;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .tracing-controls,
  .difficulty-selector,
  #tamil-tracing-sound-toggle {
    display: none;
  }
}
/**
 * Stroke Order GIF + Pronunciation Styles
 * Add to existing tracing.css
 */

/* ============================================
   STROKE ORDER OVERLAY
   ============================================ */

.stroke-order-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stroke-order-overlay.active {
  opacity: 1;
}

.stroke-order-content {
  background: white;
  border-radius: 15px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.stroke-order-overlay.active .stroke-order-content {
  transform: scale(1);
}

.stroke-order-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stroke-order-header h3 {
  margin: 0;
  font-size: 24px;
  font-weight: bold;
}

.close-stroke-order {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-stroke-order:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.stroke-order-body {
  padding: 30px;
  text-align: center;
}

.stroke-gif {
  max-width: 100%;
  height: auto;
  border: 3px solid #667eea;
  border-radius: 10px;
  background: #f9f9f9;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.stroke-order-footer {
  margin-top: 20px;
}

.replay-stroke-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 5px rgba(102, 126, 234, 0.3);
}

.replay-stroke-btn:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(102, 126, 234, 0.4);
}

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

.stroke-tip {
  margin-top: 15px;
  color: #666;
  font-size: 14px;
  font-style: italic;
}

/* ============================================
   PRONUNCIATION CONTROLS
   ============================================ */

.pronunciation-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin: 15px 0;
  padding: 12px;
  background: #f5f5f5;
  border-radius: 10px;
  flex-wrap: wrap;
}

.pronunciation-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #555;
  user-select: none;
  transition: color 0.2s;
}

.pronunciation-panel label.enabled {
  color: #4CAF50;
  font-weight: 600;
}

.pronunciation-panel input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #4CAF50;
}

#play-pronunciation {
  background: #9C27B0;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 5px rgba(156, 39, 176, 0.3);
}

#play-pronunciation:hover {
  background: #7B1FA2;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(156, 39, 176, 0.4);
}

#play-pronunciation.playing {
  animation: pronunciationPulse 1s ease-in-out infinite;
}

@keyframes pronunciationPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 5px rgba(156, 39, 176, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.6);
  }
}

#show-stroke-order {
  background: #FF9800;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 5px rgba(255, 152, 0, 0.3);
}

#show-stroke-order:hover {
  background: #F57C00;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(255, 152, 0, 0.4);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.tracing-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tracing-toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .stroke-order-content {
    width: 95%;
    max-height: 85vh;
  }

  .stroke-order-header {
    padding: 15px;
  }

  .stroke-order-header h3 {
    font-size: 20px;
  }

  .stroke-order-body {
    padding: 20px;
  }

  .close-stroke-order {
    width: 35px;
    height: 35px;
    font-size: 20px;
  }

  .pronunciation-panel {
    flex-direction: column;
    gap: 10px;
  }

  #play-pronunciation,
  #show-stroke-order {
    width: 100%;
    padding: 12px 20px;
  }
}

@media (max-width: 480px) {
  .stroke-order-header h3 {
    font-size: 18px;
  }

  .stroke-order-body {
    padding: 15px;
  }

  .replay-stroke-btn {
    width: 100%;
    padding: 14px 20px;
  }

  .tracing-toast {
    bottom: 20px;
    left: 10px;
    right: 10px;
    transform: translateX(0) translateY(100px);
    font-size: 13px;
  }

  .tracing-toast.show {
    transform: translateX(0) translateY(0);
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.stroke-order-overlay:focus-within {
  outline: none;
}

.replay-stroke-btn:focus,
.close-stroke-order:focus,
#play-pronunciation:focus,
#show-stroke-order:focus {
  outline: 3px solid #4CAF50;
  outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .stroke-order-overlay,
  .stroke-order-content,
  .tracing-toast {
    transition: none;
  }
  
  #play-pronunciation.playing {
    animation: none;
  }
}