/* Notlip Global Styles & Custom Animations */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Noto+Sans:wght@400;500;700;900&display=swap');

/* Prevent the untranslated HTML from flashing before i18n is applied. */
html:not([data-i18n-ready="true"]) body {
  visibility: hidden;
}

html[data-i18n-ready="true"] body {
  visibility: visible;
}

body {
  font-family: 'Manrope', 'Noto Sans', sans-serif;
  background-color: #0e150b;
  color: #dde5d3;
}

/* Flex pages must be allowed to shrink around wide tables and charts. */
body > main,
#sidebar-nav ~ main {
  min-width: 0;
  max-width: 100%;
}

canvas,
svg,
img {
  max-width: 100%;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #0e150b;
}
::-webkit-scrollbar-thumb {
  background: #253321;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3e4a38;
}

/* Keyframe Animations */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pulseEffect {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

.animate-fade-up {
  animation: fadeUp 0.5s ease-out forwards;
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }

.chart-line {
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
  animation: drawLine 2s ease-out forwards;
}

.chart-fill {
  animation: pulseEffect 4s ease-in-out infinite;
}

/* Hover & Interactive Utility Classes */
.hover-nav {
  transition: all 200ms ease-in-out;
}
.hover-nav:hover {
  transform: translateX(4px);
}
.hover-nav:active {
  transform: scale(0.97);
}

.hover-card {
  transition: all 250ms ease-in-out;
}
.hover-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px -5px rgba(83, 210, 44, 0.15);
}

.hover-btn {
  transition: all 200ms ease-in-out;
}
.hover-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 0 15px rgba(83, 210, 44, 0.35);
}
.hover-btn:active {
  transform: scale(0.96);
}

/* Autofill Overrides for Dark Mode Forms */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px #0e150b inset !important;
  -webkit-text-fill-color: #dde5d3 !important;
  transition: background-color 5000s ease-in-out 0s;
}

@media (max-width: 767px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  #sidebar-nav ~ main {
    width: 100%;
    max-width: 100vw;
    padding: 0.75rem !important;
    overflow-x: hidden;
  }

  #sidebar-nav {
    width: min(84vw, 18.5rem) !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 1rem 1rem 1.25rem 1rem !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex !important;
    flex-direction: column !important;
  }

  #sidebar-nav > * + * {
    margin-top: 0.65rem !important;
  }

  #sidebar-nav nav {
    flex: 1 1 auto !important;
    gap: 0.35rem !important;
  }

  #sidebar-nav nav a,
  #sidebar-nav .mt-auto a {
    padding: 0.5rem 0.75rem !important;
    min-height: 2.5rem !important;
  }

  #sidebar-nav .mt-auto {
    margin-top: auto !important;
    padding-top: 0.65rem !important;
    gap: 0.35rem !important;
  }

  #mobile-overlay {
    backdrop-filter: blur(3px);
  }

  #mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin: -0.375rem;
    border-radius: 0.75rem;
  }

  #sidebar-nav ~ main > header {
    position: sticky;
    top: 0.5rem;
    z-index: 30;
    margin-bottom: 1.25rem !important;
    padding: 0.875rem 1rem !important;
    background: rgba(22, 32, 19, 0.94);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  }

  main .p-6,
  main .p-7,
  main .p-8 {
    padding: 1rem !important;
  }

  main .gap-6 {
    gap: 1rem !important;
  }

  main .mb-8 {
    margin-bottom: 1.5rem !important;
  }

  main .text-3xl,
  main .text-4xl,
  main .text-5xl {
    font-size: 1.75rem !important;
    line-height: 1.2 !important;
  }

  main h1,
  main h2,
  main h3,
  main p,
  main span,
  main td,
  main th {
    overflow-wrap: anywhere;
  }

  main input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  main select,
  main textarea,
  main button:not(#btn-lock-address):not(#btn-withdraw-max):not(.lang-card):not(#chart-filters button) {
    min-height: 2.75rem;
  }

  #btn-lock-address,
  #btn-withdraw-max,
  #chart-filters button,
  .lang-card {
    min-height: unset !important;
    min-width: unset !important;
  }

  input[type="checkbox"],
  input[type="radio"] {
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    min-height: unset !important;
    max-height: unset !important;
  }

  main button:not(#btn-lock-address):not(#btn-withdraw-max):not(.lang-card):not(#chart-filters button) {
    min-width: 2.75rem;
  }

  main .overflow-x-auto {
    width: 100%;
    max-width: 100%;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  #portfolio-chart-container {
    min-width: 0;
    height: 13rem !important;
  }

  #portfolio-chart-container canvas {
    width: 100% !important;
    max-width: 100% !important;
  }

  .space-y-16 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 2.5rem !important;
  }

  #admin-login {
    margin-top: 2rem !important;
  }

  #users-list form {
    grid-template-columns: 1fr !important;
  }

  #users-list form button {
    width: 100%;
  }
}

@media (max-width: 380px) {
  #sidebar-nav ~ main {
    padding: 0.5rem !important;
  }

  #sidebar-nav ~ main > header {
    top: 0.25rem;
    border-radius: 0.75rem;
  }

  main .grid-cols-2 {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #admin-panel > header h1 {
    font-size: 1.5rem !important;
  }
}

@keyframes shake-input {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.shake-error {
  animation: shake-input 0.35s ease-in-out;
}

/* Toggle switch styles */
.toggle-switch-track {
  width: 44px;
  height: 24px;
  background-color: #252c20;
  border-radius: 9999px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.25s ease;
}

.toggle-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: #ffffff;
  border-radius: 9999px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

#toggle-2fa:checked + .toggle-switch-track,
.peer:checked + .toggle-switch-track {
  background-color: #53d22c !important;
}

#toggle-2fa:checked + .toggle-switch-track::after,
.peer:checked + .toggle-switch-track::after {
  transform: translateX(20px) !important;
}
