/**
 * Fostore Alerts & Notifications Engine - Styling System
 * Ultra-premium, Glassmorphism, Responsive Bottom-Sheet & Toast Stacking
 */

:root {
  --fa-bg: rgba(255, 255, 255, 0.98);
  --fa-bg-glass: rgba(255, 255, 255, 0.88);
  --fa-border: rgba(226, 232, 240, 0.9);
  --fa-backdrop: rgba(15, 23, 42, 0.55);
  --fa-text-main: #0f172a;
  --fa-text-muted: #64748b;
  --fa-radius: 28px;
  --fa-radius-sm: 16px;
  --fa-shadow-modal: 0 25px 60px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  --fa-shadow-toast: 0 14px 34px -6px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  --fa-font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Brand accents */
  --fa-brand: #2f4156;
  --fa-primary: #4f46e5;
  --fa-success: #10b981;
  --fa-success-bg: #ecfdf5;
  --fa-error: #ef4444;
  --fa-error-bg: #fef2f2;
  --fa-warning: #f59e0b;
  --fa-warning-bg: #fffbeb;
  --fa-info: #0ea5e9;
  --fa-info-bg: #f0f9ff;
}

/* ==========================================================================
   MODAL CONTAINER & BACKDROP
   ========================================================================== */
.fa-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background-color: var(--fa-backdrop);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
}

.fa-backdrop.fa-active {
  opacity: 1;
  visibility: visible;
}

.fa-modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--fa-bg);
  border-radius: var(--fa-radius);
  border: 1px solid var(--fa-border);
  box-shadow: var(--fa-shadow-modal);
  padding: 2rem 1.75rem 1.75rem;
  text-align: center;
  font-family: var(--fa-font);
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease-out;
  box-sizing: border-box;
}

.fa-backdrop.fa-active .fa-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   ANIMATED ICONS
   ========================================================================== */
.fa-icon-wrapper {
  width: 76px;
  height: 76px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.fa-icon-wrapper.fa-type-success {
  background: var(--fa-success-bg);
  color: var(--fa-success);
}
.fa-icon-wrapper.fa-type-error {
  background: var(--fa-error-bg);
  color: var(--fa-error);
}
.fa-icon-wrapper.fa-type-warning {
  background: var(--fa-warning-bg);
  color: var(--fa-warning);
}
.fa-icon-wrapper.fa-type-info {
  background: var(--fa-info-bg);
  color: var(--fa-info);
}
.fa-icon-wrapper.fa-type-question {
  background: #f1f5f9;
  color: var(--fa-brand);
}

.fa-icon-svg {
  width: 42px;
  height: 42px;
}

/* SVG Line Animations */
.fa-animate-path {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: faDash 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards 0.15s;
}

@keyframes faDash {
  to {
    stroke-dashoffset: 0;
  }
}

.fa-animate-pop {
  animation: faPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes faPop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Spinner Loader */
.fa-spinner-ring {
  width: 52px;
  height: 52px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--fa-primary);
  border-radius: 50%;
  animation: faSpin 0.8s linear infinite;
}

@keyframes faSpin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   TYPOGRAPHY & CONTENT
   ========================================================================== */
.fa-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--fa-text-main);
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.fa-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fa-text-muted);
  line-height: 1.55;
  margin: 0 0 1.5rem 0;
  word-break: break-word;
}

.fa-custom-html {
  margin-bottom: 1.25rem;
}

/* Input Fields inside prompt */
.fa-input-field {
  width: 100%;
  padding: 0.85rem 1.15rem;
  border: 2px solid #e2e8f0;
  border-radius: var(--fa-radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--fa-text-main);
  background: #f8fafc;
  box-sizing: border-box;
  margin-bottom: 1.25rem;
  transition: all 0.2s;
  outline: none;
}

.fa-input-field:focus {
  border-color: var(--fa-primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

/* ==========================================================================
   BUTTONS & ACTIONS
   ========================================================================== */
.fa-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
}

.fa-btn {
  flex: 1;
  padding: 0.85rem 1.25rem;
  border-radius: var(--fa-radius-sm);
  font-size: 0.92rem;
  font-weight: 750;
  font-family: inherit;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  user-select: none;
}

.fa-btn:active {
  transform: scale(0.97);
}

.fa-btn-primary {
  background: var(--fa-brand);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(47, 65, 86, 0.25);
}

.fa-btn-primary:hover {
  background: #1e2c3b;
}

.fa-btn-danger {
  background: var(--fa-error);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
}

.fa-btn-danger:hover {
  background: #dc2626;
}

.fa-btn-cancel {
  background: #f1f5f9;
  color: var(--fa-text-muted);
}

.fa-btn-cancel:hover {
  background: #e2e8f0;
  color: var(--fa-text-main);
}

.fa-btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   TOASTS CONTAINER & NOTIFICATIONS
   ========================================================================== */
.fa-toast-container {
  position: fixed;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
  padding: 1.25rem;
  box-sizing: border-box;
  max-width: 420px;
  width: 100%;
}

.fa-toast-container.top-right {
  top: 0;
  right: 0;
}
.fa-toast-container.top-center {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}
.fa-toast-container.bottom-right {
  bottom: 0;
  right: 0;
}
.fa-toast-container.bottom-center {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

.fa-toast {
  pointer-events: auto;
  position: relative;
  background: var(--fa-bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--fa-border);
  border-radius: var(--fa-radius-sm);
  box-shadow: var(--fa-shadow-toast);
  padding: 0.85rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--fa-font);
  transform: translateY(-16px) scale(0.95);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  cursor: pointer;
}

.fa-toast.fa-toast-show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.fa-toast.fa-toast-hide {
  transform: translateY(-10px) scale(0.9);
  opacity: 0;
}

.fa-toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  shrink: 0;
}

.fa-toast-icon.fa-type-success { background: var(--fa-success-bg); color: var(--fa-success); }
.fa-toast-icon.fa-type-error { background: var(--fa-error-bg); color: var(--fa-error); }
.fa-toast-icon.fa-type-warning { background: var(--fa-warning-bg); color: var(--fa-warning); }
.fa-toast-icon.fa-type-info { background: var(--fa-info-bg); color: var(--fa-info); }

.fa-toast-body {
  flex: 1;
  min-width: 0;
}

.fa-toast-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--fa-text-main);
  line-height: 1.2;
}

.fa-toast-text {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fa-text-muted);
  margin-top: 0.15rem;
  line-height: 1.35;
  word-break: break-word;
}

.fa-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.3;
  width: 100%;
  transform-origin: left;
}

/* ==========================================================================
   MOBILE BOTTOM SHEET MODE (< 640px or forced class)
   ========================================================================== */
@media (max-width: 639px) {
  .fa-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .fa-modal {
    max-width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 32px;
    border-top-right-radius: 32px;
    padding: 1.5rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
  }

  .fa-backdrop.fa-active .fa-modal {
    transform: translateY(0);
  }

  .fa-modal::before {
    content: '';
    display: block;
    width: 40px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 10px;
    margin: -0.5rem auto 1.25rem;
  }
}

/* Forced Mobile Simulation class */
.fa-force-bottom-sheet .fa-backdrop {
  align-items: flex-end;
  padding: 0;
}
.fa-force-bottom-sheet .fa-modal {
  max-width: 100%;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-top-left-radius: 32px;
  border-top-right-radius: 32px;
  padding: 1.5rem 1.25rem 2rem;
  transform: translateY(100%);
}
.fa-force-bottom-sheet .fa-backdrop.fa-active .fa-modal {
  transform: translateY(0);
}
.fa-force-bottom-sheet .fa-modal::before {
  content: '';
  display: block;
  width: 40px;
  height: 5px;
  background: #cbd5e1;
  border-radius: 10px;
  margin: -0.5rem auto 1.25rem;
}
