/* =========================================================
   POPUPS SYSTEM
   ShadowSec / Dark Blue UI
   ========================================================= */


/* =========================================================
   VARIABLES
   ========================================================= */

:root {
  --popup-bg: rgba(8, 19, 33, .94);
  --popup-bg-soft: rgba(9, 23, 40, .82);

  --popup-line: rgba(150, 190, 230, .14);
  --popup-line-strong: rgba(74, 166, 255, .30);

  --popup-text: #f4f8ff;
  --popup-muted: #8fa4ba;

  --popup-blue: #2d8cff;
  --popup-cyan: #42c8ff;

  --popup-success: #35d58a;
  --popup-error: #ef5361;
  --popup-warning: #f2b84b;
  --popup-info: #42c8ff;

  --popup-radius: 15px;

  --popup-shadow:
    0 25px 80px rgba(0, 0, 0, .45),
    0 0 40px rgba(45, 140, 255, .08);
}


/* =========================================================
   POPUP CONTAINER
   ========================================================= */

.popup {
  position: fixed;

  display: flex;
  align-items: flex-start;
  gap: 13px;

  width: min(420px, calc(100vw - 30px));

  padding: 15px 16px;

  background:
    linear-gradient(
      135deg,
      rgba(12, 32, 54, .97),
      rgba(7, 17, 29, .97)
    );

  border: 1px solid var(--popup-line);
  border-radius: var(--popup-radius);

  color: var(--popup-text);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  box-shadow: var(--popup-shadow);

  z-index: 9999;

  opacity: 0;
  pointer-events: none;

  transition:
    opacity .3s ease,
    transform .3s cubic-bezier(.2,.8,.2,1),
    filter .3s ease;
}


/* =========================================================
   POPUP ACTIVE
   ========================================================= */

.popup.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(0, 0);
}


/* =========================================================
   POPUP ICON
   ========================================================= */

.popup-icon {
  width: 38px;
  height: 38px;

  flex: 0 0 38px;

  display: grid;
  place-items: center;

  border-radius: 11px;

  font-size: 15px;

  background: rgba(45, 140, 255, .10);
  color: var(--popup-cyan);

  border: 1px solid rgba(74, 166, 255, .12);
}


/* =========================================================
   POPUP CONTENT
   ========================================================= */

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

.popup-title {
  margin: 1px 0 4px;

  font-family: "Space Grotesk", Inter, system-ui, sans-serif;

  font-size: 13px;
  font-weight: 800;

  line-height: 1.3;
}

.popup-message {
  margin: 0;

  color: var(--popup-muted);

  font-size: 11px;
  line-height: 1.55;

  overflow-wrap: anywhere;
}


/* =========================================================
   CLOSE BUTTON
   ========================================================= */

.popup-close {
  width: 25px;
  height: 25px;

  flex: 0 0 25px;

  display: grid;
  place-items: center;

  margin: -2px -3px 0 0;

  border: 0;
  background: transparent;

  color: #61778d;

  font-size: 17px;
  line-height: 1;

  cursor: pointer;

  border-radius: 7px;

  transition:
    color .2s ease,
    background .2s ease;
}

.popup-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, .06);
}


/* =========================================================
   SUCCESS
   ========================================================= */

.popup.success {
  border-color: rgba(53, 213, 138, .25);
}

.popup.success .popup-icon {
  color: var(--popup-success);

  background: rgba(53, 213, 138, .10);

  border-color: rgba(53, 213, 138, .18);

  box-shadow:
    0 0 25px rgba(53, 213, 138, .08);
}


/* =========================================================
   ERROR
   ========================================================= */

.popup.error {
  border-color: rgba(239, 83, 97, .28);
}

.popup.error .popup-icon {
  color: var(--popup-error);

  background: rgba(239, 83, 97, .10);

  border-color: rgba(239, 83, 97, .18);

  box-shadow:
    0 0 25px rgba(239, 83, 97, .09);
}


/* =========================================================
   WARNING
   ========================================================= */

.popup.warning {
  border-color: rgba(242, 184, 75, .28);
}

.popup.warning .popup-icon {
  color: var(--popup-warning);

  background: rgba(242, 184, 75, .10);

  border-color: rgba(242, 184, 75, .18);

  box-shadow:
    0 0 25px rgba(242, 184, 75, .08);
}


/* =========================================================
   INFO
   ========================================================= */

.popup.info {
  border-color: rgba(66, 200, 255, .25);
}

.popup.info .popup-icon {
  color: var(--popup-info);

  background: rgba(66, 200, 255, .10);

  border-color: rgba(66, 200, 255, .17);

  box-shadow:
    0 0 25px rgba(66, 200, 255, .08);
}


/* =========================================================
   TOAST POSITIONS
   ========================================================= */

.popup.toast-bottom-right {
  right: 25px;
  bottom: 25px;

  transform: translateY(25px);
}

.popup.toast-bottom-left {
  left: 25px;
  bottom: 25px;

  transform: translateY(25px);
}

.popup.toast-top-right {
  right: 25px;
  top: 100px;

  transform: translateY(-25px);
}

.popup.toast-top-left {
  left: 25px;
  top: 100px;

  transform: translateY(-25px);
}


/* =========================================================
   BOTTOM CENTER
   ========================================================= */

.popup.bottom-center {
  left: 50%;
  bottom: 25px;

  transform: translate(-50%, 30px);
}

.popup.bottom-center.show {
  transform: translate(-50%, 0);
}


/* =========================================================
   TOP CENTER
   ========================================================= */

.popup.top-center {
  left: 50%;
  top: 100px;

  transform: translate(-50%, -30px);
}

.popup.top-center.show {
  transform: translate(-50%, 0);
}


/* =========================================================
   SLIDE FROM RIGHT
   ========================================================= */

.popup.slide-right {
  right: 25px;
  bottom: 25px;

  transform: translateX(120%);
}

.popup.slide-right.show {
  transform: translateX(0);
}


/* =========================================================
   SLIDE FROM LEFT
   ========================================================= */

.popup.slide-left {
  left: 25px;
  bottom: 25px;

  transform: translateX(-120%);
}

.popup.slide-left.show {
  transform: translateX(0);
}


/* =========================================================
   SLIDE FROM BOTTOM
   ========================================================= */

.popup.slide-bottom {
  left: 50%;
  bottom: 25px;

  transform: translate(-50%, 140%);
}

.popup.slide-bottom.show {
  transform: translate(-50%, 0);
}


/* =========================================================
   SLIDE FROM TOP
   ========================================================= */

.popup.slide-top {
  left: 50%;
  top: 100px;

  transform: translate(-50%, -140%);
}

.popup.slide-top.show {
  transform: translate(-50%, 0);
}


/* =========================================================
   MODAL OVERLAY
   ========================================================= */

.popup-overlay {
  position: fixed;
  inset: 0;

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

  padding: 20px;

  background: rgba(2, 7, 13, .72);

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  z-index: 9998;

  opacity: 0;
  visibility: hidden;

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

.popup-overlay.show {
  opacity: 1;
  visibility: visible;
}


/* =========================================================
   CENTER MODAL
   ========================================================= */

.popup.modal {
  position: relative;

  width: min(500px, 100%);

  left: auto;
  right: auto;
  top: auto;
  bottom: auto;

  transform: translateY(20px) scale(.97);

  pointer-events: auto;
}

.popup-overlay.show .popup.modal {
  opacity: 1;

  transform: translateY(0) scale(1);
}


/* =========================================================
   LARGE MODAL
   ========================================================= */

.popup.modal.large {
  width: min(720px, 100%);
}


/* =========================================================
   MODAL HEADER
   ========================================================= */

.popup-header {
  display: flex;
  align-items: center;
  gap: 12px;

  padding-bottom: 14px;

  border-bottom: 1px solid var(--popup-line);
}

.popup-header .popup-title {
  margin: 0;
  font-size: 15px;
}


/* =========================================================
   MODAL BODY
   ========================================================= */

.popup-body {
  padding: 17px 0;

  color: #8296ab;

  font-size: 12px;
  line-height: 1.7;
}


/* =========================================================
   MODAL FOOTER
   ========================================================= */

.popup-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;

  gap: 9px;

  padding-top: 14px;

  border-top: 1px solid var(--popup-line);
}


/* =========================================================
   POPUP BUTTONS
   ========================================================= */

.popup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 10px 15px;

  border-radius: 10px;

  border: 1px solid var(--popup-line);

  background: rgba(9, 20, 35, .7);

  color: #c9d7e6;

  font-family: inherit;
  font-size: 11px;
  font-weight: 800;

  cursor: pointer;

  transition:
    transform .2s ease,
    border-color .2s ease,
    background .2s ease;
}

.popup-btn:hover {
  transform: translateY(-1px);

  border-color: rgba(74, 166, 255, .35);

  background: rgba(25, 55, 88, .75);
}

.popup-btn.primary {
  background: linear-gradient(
    135deg,
    #2c8cff,
    #1260d9
  );

  border-color: rgba(111, 194, 255, .35);

  color: #fff;

  box-shadow:
    0 10px 25px rgba(26, 113, 232, .22);
}

.popup-btn.danger {
  background: rgba(239, 83, 97, .10);

  border-color: rgba(239, 83, 97, .25);

  color: #ff7b87;
}


/* =========================================================
   ALERT BAR
   ========================================================= */

.popup-alert {
  position: fixed;

  left: 50%;
  top: 95px;

  width: min(700px, calc(100vw - 30px));

  display: flex;
  align-items: center;
  gap: 12px;

  padding: 12px 15px;

  border: 1px solid var(--popup-line);

  border-radius: 12px;

  background: rgba(8, 19, 33, .94);

  backdrop-filter: blur(16px);

  box-shadow: var(--popup-shadow);

  z-index: 9999;

  opacity: 0;

  transform: translate(-50%, -20px);

  pointer-events: none;

  transition:
    opacity .3s ease,
    transform .3s ease;
}

.popup-alert.show {
  opacity: 1;

  transform: translate(-50%, 0);

  pointer-events: auto;
}

.popup-alert-icon {
  color: var(--popup-cyan);

  font-size: 15px;
}

.popup-alert-content {
  flex: 1;

  font-size: 11px;

  color: #9bb0c5;
}


/* =========================================================
   LOADING POPUP
   ========================================================= */

.popup.loading {
  align-items: center;
}

.popup-spinner {
  width: 20px;
  height: 20px;

  flex: 0 0 20px;

  border-radius: 50%;

  border: 2px solid rgba(66, 200, 255, .15);

  border-top-color: var(--popup-cyan);

  animation: popup-spin .75s linear infinite;
}

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


/* =========================================================
   PROGRESS
   ========================================================= */

.popup-progress {
  position: absolute;

  left: 0;
  right: 0;
  bottom: 0;

  height: 2px;

  overflow: hidden;

  border-radius: 0 0 var(--popup-radius) var(--popup-radius);

  background: rgba(255, 255, 255, .04);
}

.popup-progress-bar {
  width: 100%;
  height: 100%;

  background: linear-gradient(
    90deg,
    var(--popup-blue),
    var(--popup-cyan)
  );

  transform-origin: left;

  animation: popup-progress 5s linear forwards;
}

@keyframes popup-progress {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}


/* =========================================================
   CONFIRMATION POPUP
   ========================================================= */

.popup.confirm {
  text-align: center;

  display: block;

  padding: 25px;
}

.popup.confirm .popup-icon {
  margin: 0 auto 15px;
}

.popup.confirm .popup-title {
  font-size: 17px;
}

.popup.confirm .popup-message {
  max-width: 390px;

  margin: 8px auto 20px;
}


/* =========================================================
   CONFIRM BUTTONS
   ========================================================= */

.popup-confirm-actions {
  display: flex;

  justify-content: center;

  gap: 9px;
}


/* =========================================================
   FULLSCREEN NOTICE
   ========================================================= */

.popup-fullscreen {
  position: fixed;
  inset: 0;

  z-index: 10000;

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

  padding: 25px;

  background:
    radial-gradient(
      circle at center,
      rgba(45, 140, 255, .08),
      transparent 45%
    ),
    rgba(3, 8, 15, .96);

  opacity: 0;
  visibility: hidden;

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

.popup-fullscreen.show {
  opacity: 1;
  visibility: visible;
}

.popup-fullscreen-content {
  width: min(550px, 100%);

  text-align: center;

  padding: 35px;

  border: 1px solid var(--popup-line);

  border-radius: 22px;

  background:
    linear-gradient(
      145deg,
      rgba(10, 27, 46, .96),
      rgba(6, 15, 26, .96)
    );

  box-shadow: var(--popup-shadow);
}

.popup-fullscreen-icon {
  font-size: 38px;

  color: var(--popup-cyan);

  margin-bottom: 20px;
}

.popup-fullscreen-content h2 {
  margin: 0 0 10px;

  font-family: "Space Grotesk", Inter, sans-serif;

  font-size: 26px;
}

.popup-fullscreen-content p {
  margin: 0;

  color: var(--popup-muted);

  font-size: 12px;

  line-height: 1.7;
}


/* =========================================================
   STACKING TOASTS
   ========================================================= */

.popup-stack {
  position: fixed;

  right: 25px;
  bottom: 25px;

  width: min(420px, calc(100vw - 30px));

  display: flex;

  flex-direction: column;

  gap: 10px;

  z-index: 9999;

  pointer-events: none;
}

.popup-stack .popup {
  position: relative;

  inset: auto;

  width: 100%;

  pointer-events: auto;

  transform: translateX(120%);
}

.popup-stack .popup.show {
  transform: translateX(0);
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

  .popup {
    width: calc(100vw - 24px);

    padding: 14px;

    border-radius: 13px;
  }

  .popup-icon {
    width: 35px;
    height: 35px;

    flex-basis: 35px;
  }

  .popup-title {
    font-size: 12px;
  }

  .popup-message {
    font-size: 10px;
  }

  .popup-bottom-right,
  .popup-bottom-left,
  .popup-top-right,
  .popup-top-left {
    left: 12px;
    right: 12px;

    width: auto;
  }

  .popup.bottom-center,
  .popup.top-center {
    width: calc(100vw - 24px);
  }

  .popup-footer {
    flex-direction: column-reverse;
  }

  .popup-footer .popup-btn {
    width: 100%;
  }

  .popup-confirm-actions {
    flex-direction: column-reverse;
  }

  .popup-confirm-actions .popup-btn {
    width: 100%;
  }

  .popup-stack {
    left: 12px;
    right: 12px;

    bottom: 12px;

    width: auto;
  }

  .popup-alert {
    left: 12px;
    right: 12px;

    top: 90px;

    width: auto;

    transform: translateY(-20px);
  }

  .popup-alert.show {
    transform: translateY(0);
  }

  .popup-fullscreen-content {
    padding: 28px 22px;

    border-radius: 18px;
  }
}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

  .popup,
  .popup-overlay,
  .popup-alert,
  .popup-fullscreen {
    transition: none;
  }

  .popup-spinner {
    animation: none;
  }

  .popup-progress-bar {
    animation: none;
  }
}
