/**
 * Custom CAPTCHA Styles for ISCASTLE
 * Accessible and responsive CAPTCHA styling
 */

/* ===== CAPTCHA CONTAINER ===== */
.captcha-container {
  background: #ffffff;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  max-width: 400px;
}

.captcha-header {
  margin-bottom: 15px;
}

.captcha-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #333;
  font-size: 16px;
  margin: 0;
}

.captcha-label i {
  color: #007bff;
  font-size: 18px;
}

/* ===== CAPTCHA BODY ===== */
.captcha-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.captcha-image-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

#captcha-canvas {
  border: 2px solid #ddd;
  border-radius: 4px;
  background: #f8f9fa;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

#captcha-canvas:hover {
  border-color: #007bff;
}

.captcha-refresh {
  background: #007bff;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 16px;
}

.captcha-refresh:hover {
  background: #0056b3;
  transform: rotate(180deg);
}

.captcha-refresh:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

.captcha-refresh:active {
  transform: scale(0.95);
}

/* ===== CAPTCHA INPUT ===== */
.captcha-input-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.captcha-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  color: #000000;
  transition: all 0.3s ease;
  background: #f8f9fa;
}

.captcha-input:focus {
  outline: none;
  border-color: #007bff;
  background: #ffffff;
  color: #000000;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.captcha-input.success {
  border-color: #28a745;
  background: #d4edda;
  color: #000000;
}

.captcha-input.error {
  border-color: #dc3545;
  background: #f8d7da;
  color: #000000;
}

.captcha-input::placeholder {
  color: #6c757d;
  text-transform: none;
  letter-spacing: normal;
  font-family: Arial, sans-serif;
}

/* ===== CAPTCHA HELP AND ERROR ===== */
.captcha-help {
  font-size: 14px;
  color: #6c757d;
  text-align: center;
  margin: 0;
}

.captcha-error {
  font-size: 14px;
  color: #dc3545;
  text-align: center;
  margin: 0;
  display: none;
  font-weight: 500;
}

/* ===== CAPTCHA STATUS ===== */
.captcha-footer {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
}

.captcha-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.captcha-status-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
}

.captcha-status-icon.pending {
  background: #ffc107;
  animation: pulse 2s infinite;
}

.captcha-status-icon.success {
  background: #28a745;
}

.captcha-status-icon.success::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 10px;
  font-weight: bold;
}

.captcha-status-icon.error {
  background: #dc3545;
}

.captcha-status-icon.error::after {
  content: '✗';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 10px;
  font-weight: bold;
}

.captcha-status-text {
  color: #6c757d;
}

.captcha-status-icon.success + .captcha-status-text {
  color: #28a745;
}

.captcha-status-icon.error + .captcha-status-text {
  color: #dc3545;
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.captcha-input.error {
  animation: shake 0.5s ease-in-out;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .captcha-container {
    margin: 15px 0;
    padding: 15px;
  }
  
  .captcha-body {
    gap: 12px;
  }
  
  .captcha-image-container {
    flex-direction: column;
    gap: 15px;
  }
  
  #captcha-canvas {
    width: 100%;
    max-width: 300px;
    height: auto;
  }
  
  .captcha-refresh {
    width: 50px;
    height: 50px;
    font-size: 18px;
  }
  
  .captcha-input {
    font-size: 18px;
    padding: 14px 16px;
  }
}

@media (max-width: 480px) {
  .captcha-container {
    padding: 12px;
  }
  
  .captcha-label {
    font-size: 14px;
  }
  
  .captcha-input {
    font-size: 16px;
    padding: 12px;
  }
  
  .captcha-help,
  .captcha-error {
    font-size: 13px;
  }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
.captcha-container:focus-within {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .captcha-container {
    border-color: #000000;
  }
  
  .captcha-input {
    border-color: #000000;
  }
  
  .captcha-refresh {
    background: #000000;
    color: #ffffff;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .captcha-refresh:hover {
    transform: none;
  }
  
  .captcha-status-icon.pending {
    animation: none;
  }
  
  .captcha-input.error {
    animation: none;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .captcha-container {
    border: 1px solid #000000;
    box-shadow: none;
    background: #ffffff;
  }
  
  .captcha-refresh {
    display: none;
  }
  
  .captcha-status {
    display: none;
  }
}
