.messages__wrapper {
  margin: 0 auto;
  padding: 0 1rem;
  width: 100%;
}

/* Tablet */
@media (min-width: 768px) {
  .messages__wrapper {
    max-width: 720px;
  }
}

/* Medium desktop */
@media (min-width: 992px) {
  .messages__wrapper {
    max-width: 960px;
  }
}

/* Large desktop */
@media (min-width: 1400px) {
  .messages__wrapper {
    max-width: 1320px;
  }
}

/* Message container styling */
.messages__container {
  border-radius: 8px;
  border: 1px solid;
  margin: 1rem 0;
  padding: 1rem;
  position: relative;
}

.messages__header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.messages__icon {
  flex-shrink: 0;
}

.messages__icon svg {
  width: 24px;
  height: 24px;
}

.messages__content {
  flex: 1;
  margin: 0;
}

.messages__content p:last-child {
  margin-bottom: 0;
}

/* Success messages (green) */
.messages--status {
  background-color: #f0f9f4;
  border-color: #10b981;
  color: #065f46;
}

.messages--status .messages__icon svg {
  fill: #10b981;
}

.messages--status a {
  color: #047857 !important;
  text-decoration: underline !important;
  font-weight: 600 !important;
}

.messages--status a:hover {
  color: #064e3b !important;
  text-decoration: none !important;
}

/* Info messages (blue) */
.webform-submission-form .messages--info {
  background-color: #eff6ff;
  border-color: #3b82f6;
  color: #1e40af;
}

.webform-submission-form .messages--info .messages__icon svg {
  fill: #3b82f6;
}

.webform-submission-form .messages--info a {
  color: #1d4ed8 !important;
  text-decoration: underline !important;
  font-weight: 600 !important;
}

.webform-submission-form .messages--info a:hover {
  color: #1e3a8a !important;
  text-decoration: none !important;
}

.webform-submission-form .messages--info a:focus {
  color: #1e3a8a !important;
  outline: 2px solid #3b82f6 !important;
  outline-offset: 2px !important;
}

/* Warning messages (orange) */
.messages--warning {
  background-color: #fffbeb;
  border-color: var(--qridaOrange);
  color: #92400e;
}

.messages--warning .messages__icon svg {
  fill: var(--qridaOrange);
}

.messages--warning a {
  color: #b45309 !important;
  text-decoration: underline !important;
  font-weight: 600 !important;
}

.messages--warning a:hover {
  color: #92400e !important;
  text-decoration: none !important;
}

/* Error messages (red) */
.messages--error {
  background-color: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
}

.messages--error .messages__icon svg {
  fill: #ef4444;
}

.messages--error a {
  color: #dc2626 !important;
  text-decoration: underline !important;
  font-weight: 600 !important;
}

.messages--error a:hover {
  color: #991b1b !important;
  text-decoration: none !important;
}

/* Sidebar info messages - compact styling */
.paragraph-text-resources-form .col-xl-3 .messages--info,
.paragraph-text-info .col-xl-3 .messages--info {
  font-size: 0.8rem !important;
  line-height: 1.35 !important;
  margin: 0.5rem 0 !important;
  padding: 0.6rem !important;
  max-height: 120px !important;
  overflow-y: auto !important;
  border-radius: 6px !important;
}

.paragraph-text-resources-form .col-xl-3 .messages__content,
.paragraph-text-info .col-xl-3 .messages__content {
  line-height: 1.35 !important;
  margin-top: 0.1rem !important;
}

.paragraph-text-resources-form .col-xl-3 .messages__header,
.paragraph-text-info .col-xl-3 .messages__header {
  gap: 0.5rem !important;
}

.paragraph-text-resources-form .col-xl-3 .messages__icon svg,
.paragraph-text-info .col-xl-3 .messages__icon svg {
  width: 18px !important;
  height: 18px !important;
  margin-top: 1px !important;
}

/* Compact messages in narrow spaces */
.col-xl-3 .messages__container,
.col-xl-4 .messages__container {
  margin: 0.75rem 0 !important;
  padding: 0.75rem !important;
  font-size: 0.85rem !important;
  line-height: 1.4 !important;
}

.col-xl-3 .messages__content,
.col-xl-4 .messages__content {
  line-height: 1.4 !important;
}

/* Scrollable for long messages */
.col-xl-3 .messages--info,
.col-xl-4 .messages--info {
  max-height: 140px !important;
  overflow-y: auto !important;
}

/* Override accessibility tool modifications */
.messages__container[data-original-line-height] {
  line-height: 1.5 !important;
}

.messages__header[data-original-line-height] {
  line-height: 1.5 !important;
}

.messages__content[data-original-line-height] {
  line-height: 1.6 !important;
}

/* Compact messages override accessibility modifications */
.col-xl-3 .messages__container[data-original-line-height],
.col-xl-4 .messages__container[data-original-line-height] {
  line-height: 1.4 !important;
}

.col-xl-3 .messages__content[data-original-line-height],
.col-xl-4 .messages__content[data-original-line-height] {
  line-height: 1.4 !important;
}

/* Custom close button styling */
.messages__close {
  position: relative;
  width: 20px !important;
  height: 20px !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer;
  border: none !important;
  border-radius: 50% !important;
  background-color: rgba(255, 255, 255, 0.2) !important;
  transition: all 0.2s ease-in-out !important;
  flex-shrink: 0 !important;
}

.messages__close:hover {
  background-color: rgba(255, 255, 255, 0.3) !important;
  transform: scale(1.1) !important;
}

.messages__close:focus {
  outline: 2px solid var(--qridaOrange) !important;
  outline-offset: 2px !important;
}

.messages__close::before,
.messages__close::after {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 12px !important;
  height: 2px !important;
  content: "";
  background-color: currentColor !important;
  border: none !important;
  border-radius: 1px !important;
  transition: all 0.2s ease-in-out !important;
}

.messages__close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.messages__close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.messages__close:hover::before,
.messages__close:hover::after {
  background-color: var(--qridaOrange) !important;
}

/* Compact close button for sidebar */
.paragraph-text-resources-form .col-xl-3 .messages__close,
.paragraph-text-info .col-xl-3 .messages__close {
  width: 16px !important;
  height: 16px !important;
  margin-top: 2px !important;
}

.paragraph-text-resources-form .col-xl-3 .messages__close::before,
.paragraph-text-info .col-xl-3 .messages__close::before,
.paragraph-text-resources-form .col-xl-3 .messages__close::after,
.paragraph-text-info .col-xl-3 .messages__close::after {
  width: 10px !important;
  height: 1.5px !important;
}

/* Webform message close button styling */
.webform-message__link,
.js-webform-message__link {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  width: 20px !important;
  height: 20px !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer !important;
  border: none !important;
  border-radius: 50% !important;
  background-color: rgba(255, 255, 255, 0.2) !important;
  font-size: 16px !important;
  line-height: 20px !important;
  text-align: center !important;
  text-decoration: none !important;
  color: currentColor !important;
  transition: all 0.2s ease-in-out !important;
  opacity: 0.7 !important;
}

.webform-message__link:hover,
.js-webform-message__link:hover,
.webform-message__link:focus,
.js-webform-message__link:focus {
  background-color: var(--qridaOrange) !important;
  color: white !important;
  opacity: 1 !important;
  transform: scale(1.1) !important;
  text-decoration: none !important;
}

.webform-message__link:focus,
.js-webform-message__link:focus {
  outline: 2px solid var(--qridaOrange) !important;
  outline-offset: 2px !important;
}

/* Compact webform close button for sidebar */
.paragraph-text-resources-form .col-xl-3 .webform-message__link,
.paragraph-text-info .col-xl-3 .webform-message__link,
.paragraph-text-resources-form .col-xl-3 .js-webform-message__link,
.paragraph-text-info .col-xl-3 .js-webform-message__link {
  top: 6px !important;
  right: 6px !important;
  width: 16px !important;
  height: 16px !important;
  font-size: 12px !important;
  line-height: 16px !important;
} 