/**
 * Alerts System Styles
 *
 * Styles for organization-wide alert displays.
 * Three display modes: popup (toast), modal, and fullscreen.
 * Uses marketing.css CSS variables.
 */

/* ==========================================================================
   Popup Alerts (Toast-style)
   ========================================================================== */

.alert-popup-container {
  position: fixed;
  top: calc(var(--nav-height, 64px) + 16px);
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  pointer-events: none;
}

.alert-popup {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary, #ffffff);
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border-left: 4px solid var(--gradient-start, #2A00E5);
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}

.alert-popup-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Popup type variants */
.alert-popup-notice { border-left-color: var(--link-color, #2A00E5); }
.alert-popup-message { border-left-color: var(--success, #10b981); }
.alert-popup-alert { border-left-color: var(--warning, #f59e0b); }
.alert-popup-warning { border-left-color: var(--error, #ef4444); }
.alert-popup-emergency {
  border-left-color: var(--error, #ef4444);
  animation: popup-pulse 1s ease-in-out infinite;
}

@keyframes popup-pulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(239, 68, 68, 0.2); }
  50% { box-shadow: 0 8px 32px rgba(239, 68, 68, 0.5); }
}

.alert-popup-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(42, 0, 229, 0.1), rgba(236, 7, 209, 0.1));
  color: var(--gradient-start, #2A00E5);
}

.alert-popup-notice .alert-popup-icon { color: var(--link-color, #2A00E5); }
.alert-popup-message .alert-popup-icon { background: rgba(16, 185, 129, 0.1); color: var(--success, #10b981); }
.alert-popup-alert .alert-popup-icon { background: rgba(245, 158, 11, 0.1); color: var(--warning, #f59e0b); }
.alert-popup-warning .alert-popup-icon,
.alert-popup-emergency .alert-popup-icon { background: rgba(239, 68, 68, 0.1); color: var(--error, #ef4444); }

.alert-popup-content {
  flex: 1;
  min-width: 0;
}

.alert-popup-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.alert-popup-message {
  font-size: 0.8125rem;
  color: var(--text-secondary, #4a4a68);
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.alert-popup-close {
  background: none;
  border: none;
  color: var(--text-muted, #8888a0);
  cursor: pointer;
  padding: 4px;
  font-size: 0.875rem;
  opacity: 0.7;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.alert-popup-close:hover {
  opacity: 1;
}

/* Dark mode popups */
[data-theme="dark"] .alert-popup {
  background: var(--bg-secondary, #101821);
  border: 1px solid var(--border-light, rgba(255, 255, 255, 0.08));
}

/* ==========================================================================
   Modal Alerts
   ========================================================================== */

.alert-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  z-index: 10001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.alert-modal-visible {
  opacity: 1;
  visibility: visible;
}

.alert-modal {
  background: var(--bg-secondary, #ffffff);
  border-radius: var(--radius-lg, 20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  transform: translateY(-20px) scale(0.95);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.alert-modal-visible .alert-modal {
  transform: translateY(0) scale(1);
}

.alert-modal-accent {
  height: 4px;
  background: var(--gradient, linear-gradient(135deg, #2A00E5, #EC07D1));
}

/* Modal type variants */
.alert-modal-notice .alert-modal-accent { background: var(--gradient); }
.alert-modal-message .alert-modal-accent { background: var(--success, #10b981); }
.alert-modal-alert .alert-modal-accent { background: var(--warning, #f59e0b); }
.alert-modal-warning .alert-modal-accent,
.alert-modal-emergency .alert-modal-accent { background: var(--error, #ef4444); }

.alert-modal-content {
  padding: 32px 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.alert-modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(42, 0, 229, 0.1), rgba(236, 7, 209, 0.1));
  color: var(--gradient-start, #2A00E5);
  font-size: 1.5rem;
}

.alert-modal-notice .alert-modal-icon { color: var(--link-color, #2A00E5); }
.alert-modal-message .alert-modal-icon { background: rgba(16, 185, 129, 0.1); color: var(--success, #10b981); }
.alert-modal-alert .alert-modal-icon { background: rgba(245, 158, 11, 0.1); color: var(--warning, #f59e0b); }
.alert-modal-warning .alert-modal-icon,
.alert-modal-emergency .alert-modal-icon { background: rgba(239, 68, 68, 0.1); color: var(--error, #ef4444); }

.alert-modal-text {
  margin-bottom: 16px;
}

.alert-modal-title {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
  margin: 0 0 12px 0;
  line-height: 1.3;
}

.alert-modal-message {
  font-size: 1rem;
  color: var(--text-secondary, #4a4a68);
  margin: 0;
  line-height: 1.6;
  white-space: pre-wrap;
}

.alert-modal-buttons {
  display: flex;
  gap: 12px;
  padding: 0 32px 32px;
  justify-content: center;
}

.alert-modal-btn {
  padding: 14px 28px;
  border-radius: var(--radius-md, 12px);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.alert-modal-btn-primary {
  background: var(--gradient, linear-gradient(135deg, #2A00E5, #EC07D1));
  color: white;
  box-shadow: 0 4px 20px rgba(42, 0, 229, 0.3);
}

.alert-modal-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(42, 0, 229, 0.4);
}

.alert-modal-warning .alert-modal-btn-primary,
.alert-modal-emergency .alert-modal-btn-primary {
  background: var(--error, #ef4444);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

.alert-modal-warning .alert-modal-btn-primary:hover,
.alert-modal-emergency .alert-modal-btn-primary:hover {
  box-shadow: 0 6px 25px rgba(239, 68, 68, 0.4);
}

/* Dark mode modals */
[data-theme="dark"] .alert-modal {
  background: var(--bg-secondary, #101821);
  border: 1px solid var(--border-light, rgba(255, 255, 255, 0.08));
}

/* ==========================================================================
   Fullscreen Alerts (Emergency)
   ========================================================================== */

.alert-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.alert-fullscreen-visible {
  opacity: 1;
  visibility: visible;
}

/* Emergency fullscreen background */
.alert-fullscreen-emergency {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  animation: fullscreen-pulse 2s ease-in-out infinite;
}

.alert-fullscreen-warning {
  background: linear-gradient(135deg, #ea580c, #c2410c);
}

.alert-fullscreen-alert {
  background: linear-gradient(135deg, #d97706, #b45309);
}

.alert-fullscreen-notice,
.alert-fullscreen-message {
  background: linear-gradient(135deg, #2A00E5, #7c3aed);
}

@keyframes fullscreen-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.9; }
}

.alert-fullscreen-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 800px;
  color: white;
}

.alert-fullscreen-icon {
  margin-bottom: 32px;
  animation: icon-bounce 1s ease-in-out infinite;
}

@keyframes icon-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.alert-fullscreen-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  margin: 0 0 24px 0;
  line-height: 1.2;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.alert-fullscreen-message {
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  margin: 0 0 40px 0;
  line-height: 1.6;
  opacity: 0.95;
  max-width: 600px;
}

.alert-fullscreen-buttons {
  display: flex;
  gap: 16px;
}

.alert-fullscreen-btn {
  padding: 16px 40px;
  border-radius: var(--radius-md, 12px);
  font-family: inherit;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.2);
  color: white;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.alert-fullscreen-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

/* ==========================================================================
   Media Embeds (Video/Image)
   ========================================================================== */

.alert-modal-media,
.alert-fullscreen-media {
  width: 100%;
  margin-top: 20px;
  border-radius: var(--radius-md, 12px);
  overflow: hidden;
  position: relative;
}

.alert-modal-media img,
.alert-fullscreen-media img {
  width: 100%;
  height: auto;
  display: block;
}

.alert-media-video {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
}

.alert-media-video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.alert-media-unmute {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s ease;
  backdrop-filter: blur(10px);
}

.alert-media-unmute:hover {
  background: rgba(0, 0, 0, 0.85);
}

.alert-fullscreen-media {
  max-width: 800px;
  margin-bottom: 32px;
}

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

@media (max-width: 600px) {
  .alert-popup-container {
    left: 16px;
    right: 16px;
    max-width: none;
  }

  .alert-popup {
    transform: translateY(-100%);
  }

  .alert-popup-visible {
    transform: translateY(0);
  }

  .alert-modal-content {
    padding: 24px 20px 16px;
  }

  .alert-modal-buttons {
    padding: 0 20px 24px;
    flex-direction: column;
  }

  .alert-modal-btn {
    width: 100%;
    justify-content: center;
  }

  .alert-fullscreen {
    padding: 24px 16px;
  }

  .alert-fullscreen-btn {
    padding: 14px 28px;
    font-size: 1rem;
  }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .alert-popup,
  .alert-modal-overlay,
  .alert-modal,
  .alert-fullscreen,
  .alert-fullscreen-btn,
  .alert-modal-btn {
    transition: none;
  }

  .alert-popup-emergency,
  .alert-fullscreen-emergency,
  .alert-fullscreen-icon {
    animation: none;
  }
}
