/* Final, shared corrections for the saved design and local preview controls. */
:root {
  --preview-sidebar-width: 16.2rem;
  --preview-focus: #a78bfa;
}

html {
  min-width: 320px;
  scrollbar-gutter: stable;
}

body {
  min-width: 320px;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

[hidden] {
  display: none !important;
}

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

.ui-icon {
  display: inline-block;
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
  vertical-align: -0.2em;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-top: 0.25rem;
  padding: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.preview-back-link {
  display: inline-block;
  margin: 1rem 0 0 1.5rem;
  color: #a78bfa;
  font-size: 0.9rem;
}

[data-page="deposit"] #qrCodePreview {
  width: 150px;
  height: 150px;
  flex: 0 0 150px;
  padding: 0;
  background: white;
}

[data-page="deposit"] #qrCodePreview img,
[data-page="deposit"] #qrCodePreview canvas {
  width: 150px;
  height: 150px;
}

.main-content .form-text {
  color: #a6a6b3;
}

.main-content,
.main-content .content-inner,
.main-content .row > *,
form {
  min-width: 0;
}

.main-content .content-inner {
  padding-bottom: 1.5rem !important;
}

aside#sidebar {
  display: flex;
  flex-direction: column;
  width: var(--preview-sidebar-width);
  max-width: calc(100vw - 3rem);
  height: 100vh;
  height: 100dvh;
  z-index: 1000;
}

#sidebar .sidebar-header {
  position: relative;
  flex-shrink: 0;
  min-height: 5rem;
  margin-bottom: 0;
  padding-right: 2.5rem;
}

#sidebar .sidebar-header .navbar-brand {
  min-width: 0;
  white-space: normal;
  font-size: 1rem;
  line-height: 1.3;
}

#sidebar .sidebar-header .navbar-brand img {
  width: 2.4rem;
  height: 2.4rem;
  flex-shrink: 0;
  margin-right: 0.5rem;
  object-fit: contain;
}

#sidebar .sidebar-body {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

#sidebar .navbar-collapse {
  display: block !important;
}

#sidebar .iq-main-menu {
  padding: 0.75rem 0;
}

#sidebar .sidebar-footer {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

#sidebar .nav-link {
  min-height: 44px;
}

#sidebar .nav-link.active,
#sidebar .nav-link[aria-current="page"] {
  background: rgba(139, 92, 246, 0.14);
  color: #c4b5fd !important;
}

#sidebar .nav-link.active::before {
  background: #a78bfa;
  box-shadow: none;
}

#sidebarToggle,
#sidebarToggleMobile,
#backArrow {
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

#sidebarToggle {
  display: none;
}

#sidebarToggleMobile {
  display: inline-flex !important;
  position: static;
  flex-shrink: 0;
  margin-right: 0.5rem;
}

#backArrow {
  display: inline-flex;
  position: absolute;
  top: 50%;
  right: 0.35rem;
  left: auto;
  transform: translateY(-50%);
  font-size: 1.5rem;
  line-height: 1;
}

#sidebarToggleMobile .hamburger-menu {
  display: flex;
  width: 22px;
  height: 20px;
}

.hamburger-menu span {
  background-color: currentColor;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 990;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(5, 3, 18, 0.65);
}

.iq-navbar .navbar-inner {
  flex-wrap: nowrap;
  min-height: 4.5rem;
  gap: 0.25rem;
}

.iq-navbar .navbar-inner > .navbar-brand:empty {
  display: none;
}

.iq-navbar .title {
  margin-bottom: 0;
}

.iq-navbar #navbarSupportedContent {
  display: flex !important;
  position: static;
  top: auto;
  width: auto;
  flex: 1;
  justify-content: flex-end;
  background: transparent;
  box-shadow: none;
}

.iq-navbar #navbarSupportedContent .navbar-list {
  flex-direction: row;
  margin-bottom: 0 !important;
}

.iq-navbar #navbarSupportedContent .nav-item.dropdown {
  position: relative;
  padding: 0 !important;
}

.iq-navbar .dropdown-menu {
  top: calc(100% + 0.75rem);
  right: 0;
  left: auto;
  max-width: min(22rem, calc(100vw - 2rem));
}

.iq-navbar .dropdown-menu .dropdown-item {
  white-space: normal;
  overflow-wrap: anywhere;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  min-width: 0;
  max-width: 100%;
}

.form-control,
.form-select {
  min-height: 44px;
}

input[type="file"].form-control {
  height: auto;
}

input[readonly] {
  cursor: default;
}

input::placeholder,
textarea::placeholder {
  opacity: 0.8;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--preview-focus) !important;
  outline-offset: 3px;
}

.table {
  font-variant-numeric: tabular-nums;
}

.table-responsive {
  max-width: 100%;
  overflow-x: auto;
}

.badge-signal,
.eyebrow {
  letter-spacing: 0.06em;
}

.badge:empty {
  display: none;
}

.auth-form {
  line-height: 1.4;
}

.auth-form .form-floating > label {
  max-width: 100%;
}

/* Let tall authentication forms grow instead of clipping in landscape. */
body:has(.auth-form) .vh-100 {
  display: flex;
  align-items: center;
  height: auto !important;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1.5rem 0;
}

body:has(.auth-form) .h-100 {
  height: auto !important;
}

body:has(.auth-form) .row > .col-md-6.mt-5 {
  width: 100%;
  max-width: 36rem;
  margin-top: 0 !important;
}

/* Keep floating panels inside both narrow and short viewports. */
.live-support-trigger {
  right: 1rem;
  bottom: 1rem;
  border: 0;
}

.support-chat-window {
  right: 1rem;
  bottom: 5.5rem;
  width: min(360px, calc(100vw - 2rem));
  height: min(460px, calc(100vh - 7rem));
  height: min(460px, calc(100dvh - 7rem));
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.support-chat-window.active {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.support-chat-header,
.support-chat-footer {
  flex-shrink: 0;
}

.support-chat-body {
  flex: 1 1 auto;
  min-height: 0;
}

.support-chat-header .agent-info,
.support-chat-input,
.support-chat-msg,
.chat-msg-body {
  min-width: 0;
  overflow-wrap: anywhere;
}

.support-chat-header .agent-info {
  flex: 1;
}

.support-chat-header button,
.support-chat-send {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
}

.custom-modal {
  padding: 1rem;
  overflow-y: auto;
}

.custom-modal-content,
.message-box {
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

[data-page="withdraw"] .tradingview-widget-container {
  width: 100%;
  max-width: 100%;
}

.preview-status {
  margin: 1rem 0 0;
  padding: 0.875rem 1rem;
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.1);
  color: #e9e3ff;
  font-size: 0.875rem;
  line-height: 1.4;
}

.preview-notification {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20000;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: max-content;
  max-width: min(28rem, calc(100vw - 2rem));
  padding: 1rem;
  border: 1px solid rgba(167, 139, 250, 0.35);
  border-radius: 12px;
  background: #1a153a;
  color: #f5f2ff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
}

.preview-notification-text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.4;
}

.preview-notification-dismiss {
  flex-shrink: 0;
  padding: 0;
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
}

.preview-copy-buffer {
  position: fixed;
  top: -10000px;
  left: -10000px;
}

@media (min-width: 768px) {
  aside#sidebar {
    transform: translateX(0);
  }

  aside#sidebar + .main-content {
    margin-left: var(--preview-sidebar-width) !important;
  }

  body.sidebar-collapsed aside#sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-collapsed aside#sidebar + .main-content {
    margin-left: 0 !important;
  }
}

@media (max-width: 767.98px) {
  [data-page="deposit"] #qrCodeBox {
    flex-direction: column;
    align-items: flex-start;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  aside#sidebar {
    transform: translateX(-100%);
  }

  aside#sidebar.active {
    transform: translateX(0);
  }

  aside#sidebar + .main-content {
    margin-left: 0 !important;
  }

  .main-content .content-inner {
    padding: 1rem !important;
  }

  .iq-navbar .navbar-inner {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .iq-navbar .caption {
    display: none;
  }

  .iq-navbar .avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .iq-navbar .title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .main-content .card-header.d-flex {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .main-content .card-body {
    padding: 1rem;
  }

  .auth-form input,
  .auth-form select {
    font-size: 16px;
  }

}

@media (max-width: 575.98px) {
  [data-page="index"] .table th,
  [data-page="index"] .table td {
    padding: 0.75rem 0.5rem;
  }

  [data-page="index"] .table td:first-child {
    display: table-cell !important;
    white-space: normal;
  }

  [data-page="index"] .table td:first-child .btn {
    margin-left: 0.25rem !important;
  }

  [data-page="index"] .table td:first-child img {
    width: 20px;
    height: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
