/* ===============================================
   ERROR MESSAGE STYLES
   Custom error modals and form validation
   =============================================== */

/* ================ SweetAlert2 Customization ================ */
.swal2-popup {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  border-radius: 16px;
  padding: 2rem;
}

.swal2-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
}

.swal2-content {
  font-size: 1rem;
  color: #4b5563;
  line-height: 1.6;
}

.swal2-confirm,
.swal2-cancel {
  border-radius: 8px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 1rem;
  min-width: 100px;
  transition: all 0.3s ease;
}

.swal2-confirm:hover,
.swal2-cancel:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.swal2-footer {
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
  margin-top: 1rem;
}

.swal2-footer a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.swal2-footer a:hover {
  text-decoration: underline;
}

/* Error popup customization */
.error-popup .swal2-icon.swal2-error {
  border-color: #ef4444;
  color: #ef4444;
}

.error-popup .swal2-title {
  color: #dc2626;
}

/* Success popup customization */
.success-popup .swal2-icon.swal2-success {
  border-color: #10b981;
}

.success-popup .swal2-success-ring {
  border-color: rgba(16, 185, 129, 0.3);
}

.success-popup .swal2-title {
  color: #059669;
}

/* Warning popup customization */
.warning-popup .swal2-icon.swal2-warning {
  border-color: #f59e0b;
  color: #f59e0b;
}

.warning-popup .swal2-title {
  color: #d97706;
}

/* Confirm popup customization */
.confirm-popup .swal2-icon.swal2-question {
  border-color: #2563eb;
  color: #2563eb;
}

/* ================ Custom Error Modal (Fallback) ================ */
.custom-error-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.custom-error-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.custom-error-content {
  position: relative;
  background: white;
  border-radius: 16px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
              0 10px 10px -5px rgba(0, 0, 0, 0.04);
  text-align: center;
  animation: slideUp 0.3s ease;
}

.custom-error-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  background: #fee2e2;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #ef4444;
  animation: scaleIn 0.5s ease;
}

.custom-error-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #dc2626;
  margin-bottom: 1rem;
}

.custom-error-message {
  font-size: 1rem;
  color: #4b5563;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.custom-error-support {
  margin-bottom: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.custom-error-support a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.custom-error-support a:hover {
  text-decoration: underline;
}

.custom-error-button {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 120px;
}

.custom-error-button:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.custom-error-button:active {
  transform: translateY(0);
}

/* ================ Form Validation Errors ================ */
.error-message {
  color: #dc2626;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: slideDown 0.3s ease;
}

.error-message::before {
  content: '⚠';
  font-size: 1rem;
}

input.error,
textarea.error,
select.error {
  border-color: #ef4444 !important;
  background-color: #fef2f2;
}

input.error:focus,
textarea.error:focus,
select.error:focus {
  outline-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Success state for forms */
input.success,
textarea.success,
select.success {
  border-color: #10b981 !important;
  background-color: #f0fdf4;
}

input.success:focus,
textarea.success:focus,
select.success:focus {
  outline-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.success-message {
  color: #059669;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: slideDown 0.3s ease;
}

.success-message::before {
  content: '✓';
  font-size: 1rem;
  font-weight: bold;
}

/* ================ Inline Error Messages ================ */
.inline-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideDown 0.3s ease;
}

.inline-error-icon {
  color: #ef4444;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.inline-error-content {
  flex: 1;
}

.inline-error-title {
  font-weight: 600;
  color: #dc2626;
  margin-bottom: 0.25rem;
}

.inline-error-message {
  color: #991b1b;
  font-size: 0.9rem;
  line-height: 1.5;
}

.inline-error-close {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.inline-error-close:hover {
  background: #fee2e2;
}

/* Success variant */
.inline-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  border-left-color: #10b981;
}

.inline-success .inline-error-icon {
  color: #10b981;
}

.inline-success .inline-error-title {
  color: #059669;
}

.inline-success .inline-error-message {
  color: #047857;
}

.inline-success .inline-error-close {
  color: #059669;
}

.inline-success .inline-error-close:hover {
  background: #d1fae5;
}

/* Warning variant */
.inline-warning {
  background: #fffbeb;
  border-color: #fde68a;
  border-left-color: #f59e0b;
}

.inline-warning .inline-error-icon {
  color: #f59e0b;
}

.inline-warning .inline-error-title {
  color: #d97706;
}

.inline-warning .inline-error-message {
  color: #b45309;
}

.inline-warning .inline-error-close {
  color: #d97706;
}

.inline-warning .inline-error-close:hover {
  background: #fef3c7;
}

/* Info variant */
.inline-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  border-left-color: #2563eb;
}

.inline-info .inline-error-icon {
  color: #2563eb;
}

.inline-info .inline-error-title {
  color: #1d4ed8;
}

.inline-info .inline-error-message {
  color: #1e40af;
}

.inline-info .inline-error-close {
  color: #1d4ed8;
}

.inline-info .inline-error-close:hover {
  background: #dbeafe;
}

/* ================ Error Page Styles ================ */
.error-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.error-page-content {
  max-width: 600px;
}

.error-page-code {
  font-size: 6rem;
  font-weight: 700;
  color: #ef4444;
  line-height: 1;
  margin-bottom: 1rem;
}

.error-page-title {
  font-size: 2rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1rem;
}

.error-page-message {
  font-size: 1.1rem;
  color: #6b7280;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.error-page-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ================ Animations ================ */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ================ Mobile Adjustments ================ */
@media (max-width: 767px) {
  .custom-error-content {
    padding: 1.5rem;
  }

  .custom-error-icon {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }

  .custom-error-title {
    font-size: 1.25rem;
  }

  .custom-error-message {
    font-size: 0.95rem;
  }

  .error-page-code {
    font-size: 4rem;
  }

  .error-page-title {
    font-size: 1.5rem;
  }

  .error-page-message {
    font-size: 1rem;
  }

  .error-page-actions {
    flex-direction: column;
  }

  .inline-error {
    padding: 0.75rem;
  }
}

/* ================ Reduced Motion ================ */
@media (prefers-reduced-motion: reduce) {
  .custom-error-modal,
  .custom-error-content,
  .custom-error-icon,
  .error-message,
  .inline-error {
    animation: none !important;
  }
}

/* ================ High Contrast Mode ================ */
@media (prefers-contrast: high) {
  .custom-error-content {
    border: 2px solid #000;
  }

  .error-message,
  .inline-error {
    border-width: 2px;
  }

  input.error,
  textarea.error,
  select.error {
    border-width: 2px;
  }
}

/* ================ Print Styles ================ */
@media print {
  .custom-error-modal,
  .error-message,
  .inline-error {
    display: none;
  }
}
