/**
 * WPEE Register Form Error Enhancer - Styles
 * Version: 2.0.1 - Luôn hi?n th? ? d?u trang và màu xanh #76D7C0
 */

/* Error Summary Container - Tru?t t? ph?i, ngang v?i d?u form */
.wpee-error-summary {
  background: #76d7c0 !important;
  border: none;
  border-radius: 12px;
  padding: 0;
  margin-bottom: 25px;
  box-shadow: 0 4px 16px rgba(118, 215, 192, 0.3) !important;
  position: fixed !important;
  overflow: hidden;
  top: 20px !important;
  right: 20px;
  width: 380px;
  max-width: calc(100% - 40px);
  z-index: 99999 !important;
  transform: translateX(110%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
              opacity 0.4s ease;
}

.wpee-error-summary.visible {
  transform: translateX(0) !important;
  opacity: 1 !important;
}

/* Error Summary Header - Compact Design */
.wpee-error-summary-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: transparent;
  border-bottom: none;
  gap: 12px;
}

/* Icon Container - Circular Badge */
.wpee-error-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wpee-error-icon i {
  display: block;
}

/* Header Text Container */
.wpee-error-header-text {
  flex: 1;
  min-width: 0;
}

/* Username/Title - Bold White Text */
.wpee-error-username {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

/* Error Messages - White Text */
.wpee-error-messages {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.4;
}

.wpee-error-messages p {
  margin: 0 0 4px 0;
}

.wpee-error-messages p:last-child {
  margin-bottom: 0;
}

/* Close Button - Clean Design */
.wpee-error-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
  flex-shrink: 0;
  color: #ffffff;
  font-size: 16px;
}

.wpee-error-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.wpee-error-close:focus {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.wpee-error-close i {
  display: block;
  line-height: 1;
}

/* Error Summary Body - Optional expanded view */
.wpee-error-summary-body {
  padding: 0 20px 16px 20px;
  display: none;
}

.wpee-error-summary.expanded .wpee-error-summary-body {
  display: block;
}

.wpee-error-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wpee-error-list li {
  padding: 8px 0 8px 28px;
  position: relative;
  color: rgba(255, 255, 255, 0.95);
  font-size: 14px;
  line-height: 1.5;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.wpee-error-list li:last-child {
  border-bottom: none;
}

.wpee-error-list li:before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
}

/* Ghi dè các màu khác - Luôn gi? màu xanh */
.wpee-error-summary.wpee-error-severe,
.wpee-error-summary.wpee-error-warning,
.wpee-error-summary.wpee-error-info {
  background: #76d7c0 !important;
  box-shadow: 0 4px 16px rgba(118, 215, 192, 0.3) !important;
}

/* Individual Field Errors Enhancement */
.form-group-error {
  position: relative;
  overflow: visible !important; /* Cho phép error message hi?n th? ra ngoài */
  margin-bottom: 0 !important; /* Không thêm margin d? không d?y element khác */
  padding-bottom: 0 !important; /* Không thêm padding m?c d?nh */
}

/* Thêm padding-bottom ch? khi có error message d? tránh b? che
.form-group-error:has(.input-error) {
  padding-bottom: 50px !important; /* T?o không gian cho error message absolute */
} */

.form-group-error .dsp-form-control,
.form-group-error .dspdp-form-control {
  border-color: #dc3545 !important;
  background-color: #fff5f5 !important;
}

.form-group-error .input-error {
  display: block !important;
  position: absolute !important; /* Absolute d? không d?y các input khác */
  top: calc(100% + 5px) !important; /* Hi?n th? ngay du?i input field */
  left: 0 !important;
  right: 0 !important;
  margin-top: 0 !important;
  padding: 10px 14px;
  background: #fee !important;
  border-left: 3px solid #dc3545;
  border-radius: 6px;
  color: #721c24 !important;
  font-size: 13px;
  animation: fadeIn 0.3s ease-out;
  z-index: 1000 !important; /* Z-index cao d? hi?n th? trên các element khác */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  pointer-events: auto; /* Cho phép click vào error message n?u c?n */
}

.form-group-error .input-error i {
  margin-right: 6px;
  color: #dc3545;
}

/* Ð?m b?o error message hi?n th? trong grid layout */
.prfc-custom-register .form-group-error {
  overflow: visible !important;
  margin-bottom: 0 !important; /* Không thêm margin d? không d?y element khác */
}

.prfc-custom-register .form-group-error .input-error {
  display: block !important;
  position: absolute !important;
  top: calc(100% + 5px) !important;
  left: 0 !important;
  right: 0 !important;
  margin-top: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  z-index: 1000 !important;
}

/* Xóa class floating-right - gi? v? trí c? d?nh */
.wpee-error-summary.floating-right {
  /* K? th?a style m?c d?nh - không c?n override */
}

/* Success Message Styling */
.success-message-info {
  background: #76d7c0;
  border: none;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 25px;
  box-shadow: 0 4px 16px rgba(118, 215, 192, 0.3);
  animation: slideDown 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 12px;
}

.success-message-info:before {
  content: "?";
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #ffffff;
  flex-shrink: 0;
}

.success-message-info span {
  color: #ffffff;
  font-size: 15px;
  line-height: 1.5;
  display: block;
  font-weight: 500;
}

/* Animation */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Loading State */
.wpee-error-summary.loading {
  opacity: 0.7;
  pointer-events: none;
}

.wpee-error-summary.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(2px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .wpee-error-summary {
    margin-bottom: 20px;
    right: 16px;
    left: 16px;
    max-width: none;
  }

  .wpee-error-summary-header {
    padding: 14px 16px;
  }

  .wpee-error-username {
    font-size: 15px;
  }

  .wpee-error-messages {
    font-size: 12px;
  }

  .wpee-error-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .wpee-error-close {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .wpee-error-summary {
    top: 10px !important;
    right: 12px;
    left: 12px;
  }

  .wpee-error-summary-header {
    padding: 12px 14px;
  }

  .wpee-error-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .wpee-error-summary,
  .form-group-error .input-error,
  .wpee-error-close {
    animation: none;
    transition: none;
  }
  
  .wpee-error-summary.floating-right {
    transition: opacity 0.2s ease;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .wpee-error-summary {
    border: 2px solid #ffffff;
  }

  .form-group-error .dsp-form-control,
  .form-group-error .dspdp-form-control {
    border-width: 2px !important;
  }

  .wpee-error-close {
    border: 2px solid rgba(255, 255, 255, 0.5);
  }
}

/* Print Styles */
@media print {
  .wpee-error-summary {
    position: relative !important;
    right: auto;
    top: auto;
    left: auto;
    width: 100%;
    transform: none !important;
    opacity: 1 !important;
  }
}