
/* =========================================
   SANDIP DAWADI
   Global Loader and Toast Notifications
   ========================================= */

/* Hide unfinished website content */
html.site-booting body > :not(#site-loader):not(#site-toast-container) {
  visibility: hidden;
}

/* ---------- Full-screen loader ---------- */

#site-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;

  display: flex;
  justify-content: center;
  align-items: center;

  min-height: 100vh;
  min-height: 100dvh;
  background: #102a3d;
  color: #ffffff;

  opacity: 1;
  visibility: visible;
  pointer-events: auto;

  transition: opacity .35s ease, visibility .35s ease;
}

#site-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

/* ---------- SD logo with rotating ring ---------- */

.loader-logo-wrap {
  position: relative;
  width: 112px;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-logo-wrap::before {
  content: "";
  position: absolute;
  inset: -7px;
  border: 3px solid rgba(255,255,255,.16);
  border-top-color: #5cd7b4;
  border-radius: 50%;
  animation: sd-ring-spin 1s linear infinite;
}

.loader-logo {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(0,0,0,.2);
  animation: sd-logo-pulse 1.8s ease-in-out infinite;
}

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

@keyframes sd-logo-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

.loader-title {
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -.5px;
  line-height: 1.3;
}

.loader-subtitle {
  font-size: 13px;
  color: #b2c8d4;
}

/* =========================================
   TOAST NOTIFICATIONS
   ========================================= */

#site-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100000;

  width: min(370px, calc(100vw - 32px));

  display: flex;
  flex-direction: column;
  gap: 10px;

  pointer-events: none;
}

.site-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 17px;

  background: #ffffff;
  color: #183047;

  border: 1px solid #dce8e7;
  border-left: 4px solid #16836f;
  border-radius: 12px;

  box-shadow: 0 12px 35px rgba(0,0,0,.13);

  font-size: 14px;
  line-height: 1.5;
  pointer-events: auto;

  animation: toast-enter .25s ease-out;
}

.site-toast.success {
  border-left-color: #16836f;
}

.site-toast.error {
  border-left-color: #dc3545;
}

.site-toast.info {
  border-left-color: #2679bd;
}

.site-toast-icon {
  flex-shrink: 0;
  color: #16836f;
  font-size: 19px;
  font-weight: bold;
}

.site-toast.error .site-toast-icon {
  color: #dc3545;
}

.site-toast.info .site-toast-icon {
  color: #2679bd;
}

.site-toast-message {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.site-toast-close {
  background: transparent;
  border: 0;
  color: #66788a;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.site-toast-close:hover {
  color: #183047;
}

.site-toast.leaving {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .2s, transform .2s;
}

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

/* ---------- Mobile ---------- */

@media (max-width: 600px) {
  .loader-logo-wrap {
    width: 96px;
    height: 96px;
  }

  .loader-logo {
    width: 82px;
    height: 82px;
  }

  .loader-title {
    font-size: 20px;
  }

  #site-toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .site-toast {
    padding: 13px 14px;
    font-size: 13px;
  }
}

/* ---------- Accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
  .loader-logo-wrap::before,
  .loader-logo,
  .site-toast {
    animation: none;
  }

  #site-loader,
  .site-toast.leaving {
    transition: none;
  }
}
