/* Custom utilities & overrides that sit on top of Tailwind */

body {
  font-family: "Inter", sans-serif;
  overflow-x: hidden;
  width: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6,
.font-heading {
  font-family: "Lexend", sans-serif;
}

/* Slow pulse animation */
.animate-pulse-slow {
  animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Disabled button — striped pattern */
.btn-disabled {
  background-image: repeating-linear-gradient(
    45deg,
    #f1f5f9,
    #f1f5f9 10px,
    #f8fafc 10px,
    #f8fafc 20px
  );
  opacity: 0.6;
  cursor: not-allowed;
  border-color: #e2e8f0 !important;
  color: #94a3b8 !important;
}

/* Hard-stop button */
.btn-hard-stop {
  background-color: #94a3b8 !important;
  cursor: not-allowed;
  box-shadow: none !important;
}

/* Modal scroll container */
.modal-scroll {
  max-height: 60vh;
  overflow-y: auto;
}

/* webkit scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: rgb(67, 181, 235);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* =============================================================
   RESPONSIVE DESIGN
   ============================================================= */

/* ── Large tablets / small laptops ──────────────────────────── */
@media (max-width: 1280px) {
  #dialog_controller {
    width: 270px !important;
  }
}

/* ── Mobile / small tablets (< 768px) ──────────────────────── */
@media (max-width: 1024px) {
  div[data-layer-id] > div:nth-child(2) {
    opacity: 1 !important;
  }

  /* ---- TOP NAVBAR ---- */
  /* Show buttons that are hidden on mobile by Tailwind */
  #delete-layer-btn {
    display: flex !important;
  }

  #add-to-cart-btn {
    display: block !important;
    padding: 0.4rem 0.85rem !important;
    font-size: 12px !important;
  }

  /* ---- LEFT ASIDE → FIXED BOTTOM BAR ---- */
  main > aside {
    position: fixed !important;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto !important;
    flex-direction: column-reverse !important;
    padding: 0 !important;
    gap: 0 !important;
    z-index: 60 !important;
  }

  /* Navigator → horizontal bottom tab bar */
  main > aside > nav {
    width: 100% !important;
    border-radius: 0 !important;
    padding: 0.45rem 0.5rem 0.35rem !important;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08) !important;
    border-top: 1px solid #e2e8f0;
    z-index: 100;
  }

  #navigator-list {
    flex-direction: row !important;
    gap: 0 !important;
    justify-content: space-around !important;
  }

  /* ---- DIALOG PANEL → BOTTOM SHEET ---- */
  #dialog-wrapper {
    border-radius: 0 !important;
    overflow: visible !important;
    transform: translateY(100%);
    transition: transform 0.5s ease-in-out;
  }

  #dialog_controller {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 35vh !important;
    min-height: auto !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1) !important;
    border: none !important;
    border-top: 1px solid #e2e8f0 !important;
    padding: 10px 15px;
  }

  /* Pull-handle at top of bottom sheet */
  #pull-handle {
    display: block;
    width: 36px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 999px;
    margin: 0 auto 12px;
    position: sticky;
    top: 0;
  }

  /* ---- RESOLUTION DISPLAY ---- */
  #resolution-display {
    & > div {
      font-size: 10px;
      padding: 2px 5px;
      & > div:last-child {
        margin-top: 4px;
        padding: 2px 0px;
        & > svg {
          display: none;
        }
        & > p {
          font-size: 9px;
        }
      }
    }
    position: fixed;
    top: 65px;
    left: 5px;
    max-width: 186px;
    padding: 2px;
    border-radius: 8px;
  }

  #side-controller {
    right: 0;
    left: unset;
    transform: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }

  /* ---- EDITOR PANEL → BOTTOM SHEET ---- */
  #editor {
    position: fixed;
    bottom: 52px;
    left: 0;
    right: 0;
    top: auto;
    max-width: 100%;
    width: 100%;
    border-radius: 16px 16px 0 0;
    height: auto;
    max-height: 38dvh;
    overflow-y: auto;
    padding: 10px 15px;
    box-shadow: none;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
  }

  /* Pull-handle for editor sheet */
  #editor::before {
    content: "";
    display: block;
    position: sticky;
    top: 0;
    width: 36px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 999px;
    margin: 0 auto 8px;
  }

  /* ---- BOTTOM SETTINGS BAR ---- */
  /* Hide since all settings are accessible via Settings panel */
  #setting-dialog {
    display: none !important;
  }

  /* ---- FRONT / BACK TOGGLE ---- */
  /* Smaller on mobile, scoot down slightly so it doesn't overlap nav */
  main > .absolute.top-3 {
    top: 0.5rem !important;
    padding: 0.2rem !important;
  }

  main > .absolute.top-3 button {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    font-size: 12px !important;
  }

  /* Give main area bottom padding so iframe isn't fully covered */
  main {
    padding-bottom: 52px;
  }
}

/* ── Small mobile (≤ 480px) ────────────────────────────────── */
@media (max-width: 480px) {
  /* Compact top navbar */
  nav .flex.justify-between.items-center {
    height: 4.4rem !important;
  }

  nav .flex.justify-between.items-center .h-10 {
    height: 2rem !important;
  }

  /* Logo smaller */
  nav img {
    height: 2rem !important;
  }

  /* Hide the tagline */
  nav span.hidden.xl\\:block {
    display: none !important;
  }

  /* Undo/Redo slightly smaller */
  #undo-btn svg,
  #redo-btn svg {
    width: 15px !important;
    height: 15px !important;
  }

  /* Spacing */
  #add-to-cart-btn {
    padding: 0.3rem 0.6rem !important;
    font-size: 11px !important;
  }
}

.selected-layer {
  border-color: rgb(14 165 233 / 0.4) !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.08) !important;
}

/* Slide-up entrance animation for notifications */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Progress bar shrink for notifications */
@keyframes notifShrink {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}
