/* ============================================
   TOAST NOTIFICATION SYSTEM
   Admin Guru - Shared Utility
   Gunakan var(--color-*) dari shared-theme.css
   ============================================ */

/* Container */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
  max-width: 360px;
  width: calc(100% - 48px);
}

/* Base toast */
.toast-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid;
  background: var(--color-bg-card, #ffffff);
  pointer-events: all;
  position: relative;
  overflow: hidden;
  animation: toast-slide-in 0.25s ease;
  box-sizing: border-box;
}

.toast-item.toast-hiding {
  animation: toast-slide-out 0.22s ease forwards;
}

@keyframes toast-slide-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-slide-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* Icon wrapper */
.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  line-height: 1;
}

/* Body */
.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-message {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary, #2c3e50);
  line-height: 1.4;
  word-break: break-word;
}

/* Close button */
.toast-close {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--color-text-muted, #888);
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.toast-close:hover {
  opacity: 1;
}

/* Progress bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0;
  animation: toast-progress-shrink linear forwards;
}

@keyframes toast-progress-shrink {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ── Type: SUCCESS ── */
.toast-success {
  border-color: var(--color-success-border, #a5d6a7);
  background: var(--color-success-bg, #e8f5e9);
}
.toast-success .toast-message {
  color: var(--color-success-text, #2e7d32);
}
.toast-success .toast-progress {
  background: var(--color-success-border, #a5d6a7);
}

/* ── Type: ERROR ── */
.toast-error {
  border-color: var(--color-error-border, #e53935);
  background: var(--color-error-bg, #fff5f5);
}
.toast-error .toast-message {
  color: var(--color-error-text, #c62828);
}
.toast-error .toast-progress {
  background: var(--color-error-border, #e53935);
}

/* ── Type: WARNING ── */
.toast-warning {
  border-color: var(--color-warning-border, #059669);
  background: var(--color-warning-bg, #d1fae5);
}
.toast-warning .toast-message {
  color: var(--color-warning-text, #064e3b);
}
.toast-warning .toast-progress {
  background: var(--color-warning-border, #059669);
}

/* ── Type: LOADING ── */
.toast-loading {
  border-color: var(--color-info-border, #90caf9);
  background: var(--color-info-bg, #e6f2ff);
}
.toast-loading .toast-message {
  color: var(--color-info-text, #1a365d);
}

/* Spinner untuk loading */
.toast-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-info-border, #90caf9);
  border-top-color: var(--color-info-text, #1a365d);
  border-radius: 50%;
  animation: toast-spin 0.7s linear infinite;
  flex-shrink: 0;
  margin-top: 2px;
}

@keyframes toast-spin {
  to { transform: rotate(360deg); }
}

/* Responsive: mobile */
@media (max-width: 480px) {
  #toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: 100%;
  }
}
