/*
 * Alert/Flash Component Styles
 * Pop Art Design System - Bold borders with pastel backgrounds
 */

@layer components {
  /* ==========================================================================
     Base Alert
     ========================================================================== */

  .alert {
    --alert-bg: var(--color-surface);
    --alert-color: var(--color-ink);
    --alert-icon-bg: var(--color-ink);
    --alert-icon-color: white;

    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background-color: var(--alert-bg);
    color: var(--alert-color);
    border: 4px solid var(--color-comic-border);
    border-radius: 0;
    box-shadow: 4px 4px 0 var(--comic-shadow-color);
    font-weight: var(--font-medium);
    margin-block-end: var(--space-4);
    transition: all 0.15s ease;

    /* Hover: slide right */
    &:hover {
      transform: translateX(4px);
    }

    &:hover .alert-icon {
      transform: scale(1.1) rotate(10deg);
    }
  }

  .alert-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background-color: var(--alert-icon-bg);
    color: var(--alert-icon-color);
    border: 2px solid var(--color-comic-border);
    border-radius: 0;
    transition: transform 0.2s ease;
  }

  .alert-icon svg {
    width: 1.25rem;
    height: 1.25rem;
  }

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

  .alert-title {
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: 0.025em;
  }

  .alert-message {
    margin-inline-start: var(--space-2);
  }

  .alert-dismiss {
    flex-shrink: 0;
    padding: var(--space-1);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--alert-color);
    opacity: 0.5;
    font-size: var(--text-xl);
    line-height: 1;
    transition: opacity var(--duration-fast) var(--ease-out);

    &:hover {
      opacity: 1;
    }
  }

  /* ==========================================================================
     Semantic Variants
     Light: Tailwind -100 shades (light pastels)
     Dark: Tailwind -900 shades mixed at 40% with gray-800 background
     ========================================================================== */

  .alert-success {
    /* Light: green-100, Dark: green-900 @ 40% over gray-800 */
    --alert-bg: light-dark(oklch(0.96 0.05 145), oklch(0.28 0.05 145));
    --alert-color: var(--color-ink);
    --alert-icon-bg: #22C55E;
    --alert-icon-color: white;
  }

  .alert-info {
    /* Light: blue-100, Dark: blue-900 @ 40% over gray-800 */
    --alert-bg: light-dark(oklch(0.95 0.04 250), oklch(0.28 0.06 250));
    --alert-color: var(--color-ink);
    --alert-icon-bg: #3B82F6;
    --alert-icon-color: white;
  }

  .alert-warning {
    /* Light: yellow-100, Dark: yellow-900 @ 40% over gray-800 */
    --alert-bg: light-dark(oklch(0.97 0.07 95), oklch(0.32 0.06 85));
    --alert-color: var(--color-ink);
    --alert-icon-bg: #FBBF24;
    --alert-icon-color: var(--color-ink);
  }

  .alert-error {
    /* Light: red-100, Dark: red-900 @ 40% over gray-800 */
    --alert-bg: light-dark(oklch(0.95 0.04 25), oklch(0.30 0.08 25));
    --alert-color: var(--color-ink);
    --alert-icon-bg: #EF4444;
    --alert-icon-color: white;
  }

  /* ==========================================================================
     Flash Messages - Pop Art Style (used by Rails flash)
     ========================================================================== */

  .flash {
    --flash-bg: var(--color-surface);
    --flash-color: var(--color-ink);
    --flash-border-color: var(--border-color);
    --flash-accent: var(--color-ink);

    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background-color: var(--flash-bg);
    color: var(--flash-color);
    border: var(--border-thick) solid var(--flash-border-color);
    box-shadow: var(--comic-shadow-md);
    font-weight: var(--font-medium);
    margin-block-end: var(--space-4);
    position: relative;
    transition: transform var(--duration-fast) var(--ease-out);

    /* Left accent bar */
    &::before {
      content: "";
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      width: 6px;
      background-color: var(--flash-accent);
    }

    padding-inline-start: calc(var(--space-4) + 6px);

    /* Hover: slide right */
    &:hover {
      transform: translateX(4px);
    }
  }

  .flash-notice {
    --flash-bg: light-dark(oklch(0.96 0.05 145), oklch(0.28 0.05 145));
    --flash-accent: var(--color-boom-green);
  }

  .flash-alert {
    --flash-bg: light-dark(oklch(0.95 0.04 25), oklch(0.30 0.08 25));
    --flash-accent: var(--color-pow-red);
  }

  .flash-warning {
    --flash-bg: light-dark(oklch(0.97 0.07 95), oklch(0.32 0.06 85));
    --flash-accent: var(--color-zap-yellow);
  }

  .flash-info {
    --flash-bg: light-dark(oklch(0.95 0.04 250), oklch(0.28 0.06 250));
    --flash-accent: var(--color-wham-blue);
  }

  /* ==========================================================================
     Toast Notifications (animated alerts)
     ========================================================================== */

  .toast {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    z-index: 1000;
    max-width: 400px;
    animation: toast-in var(--duration-normal) var(--ease-out);
  }

  .toast-stack {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-width: 400px;
  }
}
