/*
 * Dashboard-wide UI polish: page transitions, sidebar menu, SweetAlert dialogs.
 * Loaded after style.css and sweetalert.css so equal-specificity rules win.
 * Motion is subtle (<= 280ms) and switched off under prefers-reduced-motion.
 */

/* ---------- Page transitions ----------
 * animate.css fadeInRight runs 1s with a 20px slide on every navigation.
 * Replace it with a short fade-up. Ending on transform:none (not translateX(0))
 * also avoids leaving a containing block that traps position:fixed children.
 */
@keyframes gt-page-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.wrapper-content.animated.fadeInRight {
  animation: gt-page-in 0.28s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

/* ---------- Sidebar menu ---------- */
#side-menu > li > a,
#side-menu .nav-second-level > li > a {
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    text-indent 0.15s ease;
}

/* Sub-items nudge right on hover (text-indent moves the label, not the row). */
#side-menu .nav-second-level > li > a:hover {
  text-indent: 3px;
}

/* Active sub-item gets an accent marker that grows in. */
#side-menu .nav-second-level > li > a::before {
  content: "";
  position: absolute;
  left: 38px;
  top: 50%;
  width: 3px;
  height: 14px;
  margin-top: -7px;
  border-radius: 2px;
  background: #1080f2;
  transform: scaleY(0);
  transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.3, 1);
}

#side-menu .nav-second-level > li.active > a::before {
  transform: scaleY(1);
}

/* Collapsed sidebar shows sub-items as a flyout with different padding. */
.mini-navbar #side-menu .nav-second-level > li > a::before {
  display: none;
}

/* ---------- SweetAlert dialogs ---------- */
.sweet-overlay {
  background-color: rgba(15, 23, 42, 0.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.sweet-alert {
  border-radius: 12px;
  box-shadow:
    0 20px 50px rgba(15, 23, 42, 0.18),
    0 2px 6px rgba(15, 23, 42, 0.08);
}

.sweet-alert h2 {
  font-size: 26px;
  margin: 20px 0 12px;
}

.sweet-alert p {
  font-size: 15px;
  line-height: 1.5;
}

.sweet-alert button {
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 28px;
  transition:
    background-color 0.15s ease,
    transform 0.1s ease;
}

.sweet-alert button:active {
  transform: scale(0.97);
}

.sweet-alert button.cancel {
  background-color: #eef0f3;
  color: #4b5563;
}

.sweet-alert button.cancel:hover {
  background-color: #e3e6ea;
}

.sweet-alert button.cancel:active {
  background-color: #d9dde2;
}

/* "Setup not saved" (Stay / Exit) passes confirmButtonColor #D0D0D0 so both
 * buttons look neutral. SweetAlert writes that colour inline, darkening it on
 * hover (200) and press (179); match those shades so Exit pairs with the new
 * cancel style instead of looking disabled. */
.sweet-alert button.confirm[style*="rgb(208, 208, 208)"] {
  background-color: #eef0f3 !important;
  color: #4b5563;
  box-shadow: none !important;
}

.sweet-alert button.confirm[style*="rgb(200, 200, 200)"] {
  background-color: #e3e6ea !important;
  color: #4b5563;
  box-shadow: none !important;
}

.sweet-alert button.confirm[style*="rgb(179, 179, 179)"] {
  background-color: #d9dde2 !important;
  color: #4b5563;
  box-shadow: none !important;
}

/* Replace the bouncy pop (0.7 -> 1.05 -> 0.95 -> 1) with a calm scale-in. */
@keyframes gt-swal-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes gt-swal-out {
  to {
    opacity: 0;
    transform: scale(0.97);
  }
}

.showSweetAlert[data-animation="pop"] {
  animation: gt-swal-in 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.hideSweetAlert[data-animation="pop"] {
  animation: gt-swal-out 0.15s ease-in;
}

@media (prefers-reduced-motion: reduce) {
  .wrapper-content.animated.fadeInRight,
  .showSweetAlert[data-animation="pop"],
  .hideSweetAlert[data-animation="pop"] {
    animation: none;
  }

  #side-menu > li > a,
  #side-menu .nav-second-level > li > a,
  #side-menu .nav-second-level > li > a::before,
  .sweet-alert button {
    transition: none;
  }
}
