/* ========================================
   アラート（Alert）コンポーネント
   ======================================== */

/* アラートベース */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  margin-bottom: var(--space-4);
  position: relative;
  overflow: hidden;
  animation: slideDown 0.3s ease-out;
}

/* アラートアイコン */
.alert-icon {
  flex-shrink: 0;
  width: var(--space-6);
  height: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.alert-icon .material-symbols-outlined {
  font-size: 20px;
  font-variation-settings:
    'FILL' 1,
    'wght' 500,
    'GRAD' 0,
    'opsz' 20;
}

/* アラートコンテンツ */
.alert-content {
  flex: 1;
  font-size: var(--text-xs);
  line-height: var(--leading-relaxed);
}

.alert-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  margin: 0 0 var(--space-2) 0;
  line-height: var(--leading-tight);
}

.alert-list {
  margin: 0;
  padding-left: var(--space-4);
  list-style-type: disc;
}

.alert-list li {
  font-size: var(--text-xs);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-1);
}

.alert-list li:last-child {
  margin-bottom: 0;
}

/* エラーアラート */
.alert-error {
  background: var(--color-error-light);
  border-color: var(--color-error);
  color: var(--text-secondary);
}

.alert-error .alert-icon {
  color: var(--color-error);
}

/* 成功アラート */
.alert-success {
  background: var(--color-success-light);
  border-color: var(--color-success);
  color: var(--text-secondary);
}

.alert-success .alert-icon {
  color: var(--color-success);
}

/* 警告アラート */
.alert-warning {
  background: var(--color-warning-light);
  border-color: var(--color-warning);
  color: var(--text-secondary);
}

.alert-warning .alert-icon {
  color: var(--color-warning);
}

/* 情報アラート */
.alert-info {
  background: var(--color-info-light);
  border-color: var(--color-info);
  color: var(--text-secondary);
}

.alert-info .alert-icon {
  color: var(--color-info);
}

/* 閉じるボタン付きアラート */
.alert-dismissible {
  padding-right: var(--space-12);
}

.alert-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: var(--space-6);
  height: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: currentColor;
  opacity: 0.7;
  transition: all var(--transition-fast);
}

.alert-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.alert-close .material-symbols-outlined {
  font-size: 18px;
}

/* レスポンシブ */
@media (max-width: 768px) {
  .alert {
    padding: var(--space-3);
    gap: var(--space-2);
  }
  
  .alert-title {
    font-size: var(--text-sm);
  }
  
  .alert-list li {
    font-size: var(--text-xs);
  }
}

/* アニメーション */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* フェードアウトアニメーション */
.alert-fade-out {
  animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* プリファードモーション設定 */
@media (prefers-reduced-motion: reduce) {
  .alert {
    animation: none !important;
  }
  
  .alert-fade-out {
    animation: none !important;
  }
}
/* ========================================
   トースト通知コンポーネント
   ======================================== */

/* トーストコンテナ - モーダル上に表示 */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: var(--z-notification);
    pointer-events: none;
}

/* トースト基本スタイル */
.toast {
    min-width: 300px;
    max-width: 500px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 0.75rem;
    box-shadow: 
        0 20px 40px -12px rgba(0, 0, 0, 0.15),
        0 8px 24px -8px rgba(0, 0, 0, 0.1),
        0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: all;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    will-change: transform, opacity;
}

/* トーストアイコン */
.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    position: relative;
    z-index: 2;
}

.toast-success .toast-icon { 
    color: #22c55e; 
    filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.3));
}

.toast-error .toast-icon { 
    color: #ef4444; 
    filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.3));
}

.toast-warning .toast-icon { 
    color: #f59e0b; 
    filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.3));
}

.toast-info .toast-icon { 
    color: #3b82f6; 
    filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.3));
}

/* トーストコンテンツ */
.toast-content {
    flex: 1;
    position: relative;
    z-index: 2;
}

.toast-message {
    font-size: 0.875rem;
    color: #1f2937;
    font-weight: 500;
    line-height: 1.625;
}

/* クローズボタン */
.toast-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #6b7280;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    position: relative;
    z-index: 2;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1f2937;
    transform: scale(1.1) rotate(90deg);
}

.toast-close:active {
    transform: scale(0.95) rotate(90deg);
}

/* トーストアニメーション */
.toast-enter {
    opacity: 0;
    transform: translateX(100%) scale(0.8);
}

.toast-enter-active {
    animation: toastSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast-exit {
    animation: toastSlideOut 0.4s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
}

/* ホバーエフェクト */
.toast:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.2),
        0 12px 32px -8px rgba(0, 0, 0, 0.15),
        var(--shadow-2xl);
}

/* 光沢エフェクト */
.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: left 0.6s ease-out;
    z-index: 1;
}

.toast:hover::before {
    left: 100%;
}

/* タイプ別背景 */
.toast-success {
    border-left: 4px solid #22c55e;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(34, 197, 94, 0.02) 100%
    );
}

.toast-error {
    border-left: 4px solid #ef4444;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(239, 68, 68, 0.02) 100%
    );
}

.toast-warning {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(245, 158, 11, 0.02) 100%
    );
}

.toast-info {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(59, 130, 246, 0.02) 100%
    );
}

/* プリファードモーション設定 - トーストは常にアニメーション有効 */
@media (prefers-reduced-motion: reduce) {
    .toast-enter-active {
        animation: toastSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important;
        animation-duration: 0.4s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.4s !important;
    }
    
    .toast-exit {
        animation: toastSlideOut 0.4s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards !important;
        animation-duration: 0.4s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.4s !important;
    }
    
    .toast:hover {
        transform: translateY(-2px) scale(1.02) !important;
        transition: all 0.2s ease !important;
        transition-duration: 0.2s !important;
    }
    
    .toast-close:hover {
        transform: scale(1.1) rotate(90deg) !important;
        transition: all 0.2s ease !important;
        transition-duration: 0.2s !important;
    }
    
    .toast::before {
        transition: left 0.6s ease-out !important;
        transition-duration: 0.6s !important;
    }
    
    .toast:hover::before {
        left: 100% !important;
    }
}

/* レスポンシブ */
@media (max-width: 768px) {
    .toast-container {
        top: var(--space-4);
        right: var(--space-4);
        left: var(--space-4);
    }
    
    .toast {
        min-width: auto;
        max-width: none;
    }
    
    /* モバイルでは上からスライド */
    .toast-enter {
        transform: translateY(-100%) scale(0.8);
    }
    
    @keyframes toastSlideIn {
        from {
            opacity: 0;
            transform: translateY(-100%) scale(0.8);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
    
    @keyframes toastSlideOut {
        from {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
        to {
            opacity: 0;
            transform: translateY(-100%) scale(0.9);
        }
    }
}