/**
 * Global Weather Pro - Alert Icon & Modal Styles
 * Accessible alert system with ARIA support
 */

/* ============================================= */
/* Alert Icon Styles                            */
/* ============================================= */

.alert-icon-class {
  display: none;
  position: relative;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border-radius: 50%;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  line-height: 32px;
  cursor: pointer;
  box-shadow: 
    0 4px 12px rgba(239, 68, 68, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  z-index: 10;
  animation: gwpro-alert-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: none;
}

/* Header widget alert icon positioning */
.forecast-toggle-controls .alert-icon-class {
  margin-right: 0.5rem;
}

/* Sidebar widget alert icon positioning */
.weather-widget-sidebar .alert-icon-class {
  position: relative;
  margin: 0.75rem auto 0;
  left: auto;
  transform: none;
}

/* Show alert icon when active */
.alert-icon-class.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hover and focus states */
.alert-icon-class:hover {
  transform: scale(1.1);
  box-shadow: 
    0 6px 20px rgba(239, 68, 68, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.alert-icon-class:focus {
  outline: 2px solid #fca5a5;
  outline-offset: 3px;
}

.alert-icon-class:focus-visible {
  outline: 2px solid #fca5a5;
  outline-offset: 3px;
}

/* Pulsing animation for attention */
@keyframes gwpro-alert-pulse {
  0%, 100% {
    box-shadow: 
      0 4px 12px rgba(239, 68, 68, 0.4),
      0 0 0 0 rgba(239, 68, 68, 0.5);
  }
  50% {
    box-shadow: 
      0 4px 12px rgba(239, 68, 68, 0.4),
      0 0 0 8px rgba(239, 68, 68, 0);
  }
}

/* ============================================= */
/* Modal Overlay Styles                         */
/* ============================================= */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

/* Enable text selection in modal */
.modal-overlay,
.modal-overlay * {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

/* Show modal when active */
.modal-overlay.active {
  display: flex;
}

/* ============================================= */
/* Modal Content Box                            */
/* ============================================= */

.modal-content {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  color: #1e293b;
  padding: 0;
  border-radius: 16px;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(0, 0, 0, 0.05);
  width: 100%;
  width: min(90vw, 800px) !important;
  position: relative;
  animation: gwpro-modal-enter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Modal header area */
.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #ef4444 0%, #f97316 50%, #ef4444 100%);
  border-radius: 16px 16px 0 0;
}

/* ============================================= */
/* Close Button                                 */
/* ============================================= */

.modal-close-class {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: normal;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
  transition: all 0.2s ease;
  z-index: 10;
}

.modal-close-class:hover {
  color: #1e293b;
  background: rgba(0, 0, 0, 0.05);
}

.modal-close-class:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.modal-close-class:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* ============================================= */
/* Modal Body - Scrollable Alert Content        */
/* ============================================= */

.gwpro-modal-body {
  padding: 1.75rem;
  padding-top: 2rem;
  overflow-y: auto;
  flex: 1;
}

/* Individual alert item */
.gwpro-alert-item {
  padding: 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  border-left: 4px solid #ef4444;
}

.gwpro-alert-item:not(:last-child) {
  margin-bottom: 1rem;
}

/* Alert title */
.gwpro-alert-title,
.modal-content h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: #b91c1c;
  line-height: 1.4;
  padding-right: 2rem;
}

/* Alert description */
.gwpro-alert-description {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: #1e293b !important;
}

/* Paragraphs in modal body */
.gwpro-modal-body p {
  margin: 0 0 0.75rem 0;
  line-height: 1.6;
}

.gwpro-modal-body p:last-child {
  margin-bottom: 0;
}

/* Alert timing info */
.gwpro-alert-timing {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gwpro-alert-timing::before {
  content: '';
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='12 6 12 12 16 14'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  flex-shrink: 0;
}

/* ============================================= */
/* Animations                                   */
/* ============================================= */

@keyframes gwpro-modal-enter {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================= */
/* Dark Theme Modal Overrides                   */
/* ============================================= */

[data-theme="dark"] .modal-content,
.gwpro-dark-mode .modal-content {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .gwpro-alert-item,
.gwpro-dark-mode .gwpro-alert-item {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .gwpro-alert-title,
.gwpro-dark-mode .gwpro-alert-title {
  color: #fca5a5;
}

[data-theme="dark"] .gwpro-alert-description,
.gwpro-dark-mode .gwpro-alert-description {
  color: #e2e8f0 !important;
}

[data-theme="dark"] .modal-close-class,
.gwpro-dark-mode .modal-close-class {
  color: #94a3b8;
}

[data-theme="dark"] .modal-close-class:hover,
.gwpro-dark-mode .modal-close-class:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .gwpro-alert-timing,
.gwpro-dark-mode .gwpro-alert-timing {
  color: #94a3b8;
  border-top-color: rgba(255, 255, 255, 0.1);
}

/* ============================================= */
/* Responsive Adjustments                       */
/* ============================================= */

@media (max-width: 600px) {
  .modal-content {
    max-width: 100%;
    margin: 0.5rem;
    max-height: 90vh;
    border-radius: 12px;
  }

  .gwpro-modal-body {
    padding: 1.25rem;
    padding-top: 1.5rem;
  }

  .gwpro-alert-title {
    font-size: 1rem;
  }

  .gwpro-alert-description {
    font-size: 0.85rem;
  }

  .alert-icon-class {
    width: 28px;
    height: 28px;
    font-size: 16px;
    line-height: 28px;
  }
}

/* ============================================= */
/* Accessibility - Reduced Motion               */
/* ============================================= */

@media (prefers-reduced-motion: reduce) {
  .alert-icon-class {
    animation: none;
  }

  .modal-content {
    animation: none;
  }

  .alert-icon-class,
  .modal-close-class {
    transition: none;
  }
}

/* ============================================= */
/* High Contrast Mode Support                   */
/* ============================================= */

@media (prefers-contrast: high) {
  .alert-icon-class {
    border: 2px solid #ffffff;
  }

  .modal-content {
    border: 2px solid #000000;
  }

  .gwpro-alert-item {
    border-width: 2px;
  }
}
