/* Custom Scrollbar */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
}

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

input,
button,
textarea,
select {
  min-width: 0;
}

main {
  min-width: 0;
  max-width: 100vw;
  -webkit-overflow-scrolling: touch;
}

.tab-content,
.tab-content > *,
.tab-content .grid,
.tab-content .flex,
.tab-content .bg-surface {
  min-width: 0;
  max-width: 100%;
}

.safe-area-pb {
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}

#profileMenu {
  width: min(18rem, calc(100vw - 2rem));
}

#toast {
  max-width: calc(100vw - 2rem);
  pointer-events: none;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #09090b;
}
::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3f3f46;
}

/* Feedback Animations */
.feedback {
  @apply mt-4 p-4 rounded-lg text-sm font-medium text-center border animate-fade-in;
}

.feedback.success {
  @apply bg-primary/10 text-primary border-primary/20;
}

.feedback.error {
  @apply bg-red-500/10 text-red-400 border-red-500/20;
}

.feedback.hidden {
  display: none;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

.settings-switch {
  position: relative;
  display: inline-flex;
  width: 3.25rem;
  height: 1.75rem;
  flex: 0 0 auto;
  cursor: pointer;
}

.settings-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.settings-switch span {
  position: absolute;
  inset: 0;
  background: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 999px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-switch span::after {
  content: "";
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  width: 1.15rem;
  height: 1.15rem;
  background: #a1a1aa;
  border-radius: 999px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.settings-switch input:checked + span {
  background: rgba(0, 245, 160, 0.18);
  border-color: rgba(0, 245, 160, 0.65);
  box-shadow: 0 0 16px rgba(0, 245, 160, 0.18);
}

.settings-switch input:checked + span::after {
  background: #00f5a0;
  transform: translateX(1.48rem);
}

.settings-switch input:focus-visible + span {
  outline: 2px solid rgba(0, 245, 160, 0.7);
  outline-offset: 3px;
}

.settings-switch input:disabled + span {
  cursor: wait;
  opacity: 0.55;
}

/* Utilitário para transição suave do modal lateral */
.translate-x-full {
  transform: translateX(100%);
}

/* Calendar Grid Fix */
#calendarGrid {
  min-height: 400px;
}

/* Right tutorial sidebar */
.partner-guide-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.46);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.partner-guide-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.partner-guide-launcher {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 90;
  width: 3.5rem;
  height: 3.5rem;
  transform: translateY(-50%);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.partner-guide-launcher.is-open {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(100%);
}

.partner-guide-toggle {
  position: relative;
  display: flex;
  width: 3.5rem;
  height: 3.5rem;
  align-items: center;
  justify-content: center;
  color: #00f5a0;
  background: rgba(24, 24, 27, 0.96);
  border: 1px solid #27272a;
  border-right: 0;
  border-radius: 999px 0 0 999px;
  box-shadow: 0 0 24px rgba(0, 245, 160, 0.18);
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.partner-guide-toggle:hover {
  color: #09090b;
  background: #00f5a0;
  border-color: #00f5a0;
  transform: translateX(-4px);
}

.partner-guide-bubble {
  position: absolute;
  right: calc(100% + 0.75rem);
  top: 50%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: max-content;
  max-width: 11rem;
  padding: 0.55rem 0.55rem 0.55rem 0.75rem;
  color: #ffffff;
  background: rgba(24, 24, 27, 0.98);
  border: 1px solid rgba(0, 245, 160, 0.34);
  border-radius: 0.75rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.36), 0 0 18px rgba(0, 245, 160, 0.14);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  pointer-events: auto;
  transform: translateY(-50%);
  white-space: normal;
}

.partner-guide-bubble.is-hidden {
  display: none;
}

.partner-guide-bubble::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -0.36rem;
  width: 0.65rem;
  height: 0.65rem;
  background: rgba(24, 24, 27, 0.98);
  border-top: 1px solid rgba(0, 245, 160, 0.34);
  border-right: 1px solid rgba(0, 245, 160, 0.34);
  transform: translateY(-50%) rotate(45deg);
}

.partner-guide-bubble-close {
  position: relative;
  z-index: 1;
  display: flex;
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: #a1a1aa;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.partner-guide-bubble-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(0, 245, 160, 0.32);
}

.partner-guide-toggle.is-open {
  opacity: 0;
  pointer-events: none;
}

.partner-guide {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  display: flex;
  width: min(400px, calc(100vw - 1rem));
  max-width: 100vw;
  flex-direction: column;
  color: #e4e4e7;
  background: rgba(24, 24, 27, 0.97);
  border-left: 1px solid #27272a;
  box-shadow: -28px 0 80px rgba(0, 0, 0, 0.48);
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.partner-guide.is-open {
  transform: translateX(0);
}

.partner-guide-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid #27272a;
  background: linear-gradient(180deg, rgba(0, 245, 160, 0.08), rgba(24, 24, 27, 0));
}

.partner-guide-kicker {
  margin-bottom: 0.35rem;
  color: #00f5a0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.partner-guide-title {
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.15;
}

.partner-guide-subtitle {
  margin-top: 0.45rem;
  color: #a1a1aa;
  font-size: 0.9rem;
  line-height: 1.45;
}

.partner-guide-close {
  display: flex;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: #a1a1aa;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #27272a;
  border-radius: 0.75rem;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.partner-guide-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 245, 160, 0.45);
}

.partner-guide-content {
  overflow-y: auto;
  padding: 1.25rem;
}

.partner-guide-section {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.partner-guide-section:first-child {
  padding-top: 0;
}

.partner-guide-section:last-child {
  border-bottom: 0;
}

.partner-guide-section h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
}

.partner-guide-section h3 i {
  color: #00f5a0;
}

.partner-guide-section p,
.partner-guide-section li {
  color: #c4c4cc;
  font-size: 0.875rem;
  line-height: 1.55;
}

.partner-guide-section ul,
.partner-guide-section ol {
  display: grid;
  gap: 0.65rem;
  padding-left: 1.15rem;
}

.partner-guide-note {
  margin-top: 0.9rem;
  padding: 0.85rem;
  color: #d4d4d8;
  font-size: 0.82rem;
  line-height: 1.5;
  background: rgba(0, 245, 160, 0.07);
  border: 1px solid rgba(0, 245, 160, 0.16);
  border-radius: 0.75rem;
}

@media (max-width: 767px) {
  body,
  body.h-screen {
    height: 100dvh;
  }

  main {
    width: 100%;
    padding-bottom: calc(5.75rem + env(safe-area-inset-bottom));
  }

  .tab-content {
    width: 100%;
    padding: 5.25rem 0.875rem calc(7rem + env(safe-area-inset-bottom)) !important;
    gap: 1rem;
  }

  .tab-content header {
    margin-bottom: 1.25rem;
  }

  .tab-content h2 {
    font-size: 1.55rem;
    line-height: 1.15;
  }

  .tab-content h3 {
    line-height: 1.25;
  }

  .tab-content .grid {
    gap: 1rem;
  }

  .tab-content .bg-surface {
    border-radius: 0.75rem;
  }

  #tab-dashboard > .grid > .bg-surface,
  #tab-links .bg-surface,
  #tab-settings .bg-surface {
    padding: 1rem !important;
  }

  #tab-dashboard > .bg-surface {
    padding: 1.25rem !important;
  }

  #tab-dashboard header a {
    width: 100%;
    justify-content: center;
    min-height: 2.75rem;
  }

  #tab-dashboard .lg\:col-span-2 > .flex {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }

  #tab-dashboard .lg\:col-span-2 > .flex > .text-right {
    width: 100%;
    text-align: left;
  }

  #tab-dashboard .lg\:col-span-2 .flex.justify-between.text-xs {
    gap: 0.35rem;
  }

  #tab-dashboard .lg\:col-span-2 .flex.justify-between.text-xs > div {
    min-width: 0;
  }

  #tab-dashboard .lg\:col-span-2 .flex.justify-between.text-xs span {
    overflow-wrap: anywhere;
  }

  #tab-links label,
  #tab-settings label {
    overflow-wrap: anywhere;
  }

  #tab-links input,
  #tab-settings input,
  #loginOverlay input {
    font-size: 16px;
  }

  #partnerPublicLink {
    font-size: 0.78rem;
  }

  #tab-settings .rounded-lg.border.border-border.bg-black\/30 {
    align-items: flex-start;
    flex-direction: column;
  }

  #tab-settings .settings-switch {
    align-self: flex-start;
  }

  .fixed.top-4.right-4 {
    top: calc(0.75rem + env(safe-area-inset-top));
    right: 0.75rem;
  }

  #profileMenu {
    right: -0.25rem;
    width: min(18rem, calc(100vw - 1.5rem));
  }

  nav.safe-area-pb {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  nav.safe-area-pb button {
    min-width: 0;
    flex: 1 1 0;
  }

  nav.safe-area-pb span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #loginOverlay {
    align-items: flex-start;
    padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  #loginOverlay > div {
    margin: auto 0;
    max-height: calc(100dvh - 2rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    padding: 1.25rem !important;
    border-radius: 1rem !important;
  }

  #loginOverlay img {
    max-width: min(13rem, 72vw);
    height: auto;
  }

  #toast {
    right: 0.875rem;
    bottom: calc(5.75rem + env(safe-area-inset-bottom));
    left: 0.875rem;
    width: auto;
    padding: 0.875rem;
  }

  .partner-guide-launcher {
    top: auto;
    right: 0.75rem;
    bottom: calc(5.9rem + env(safe-area-inset-bottom));
    transform: none;
  }

  .partner-guide-toggle {
    width: 3rem;
    height: 3rem;
    border-right: 1px solid #27272a;
    border-radius: 999px;
  }

  .partner-guide-toggle:hover {
    transform: translateY(-2px);
  }

  .partner-guide-bubble {
    right: 0;
    top: auto;
    bottom: calc(100% + 0.65rem);
    max-width: min(10.5rem, calc(100vw - 1.5rem));
    padding: 0.55rem 0.7rem;
    text-align: center;
    transform: none;
  }

  .partner-guide-bubble::after {
    top: auto;
    right: 1.1rem;
    bottom: -0.36rem;
    transform: rotate(135deg);
  }

  .partner-guide-launcher.is-open {
    transform: translateY(1rem);
  }

  .partner-guide {
    width: 100vw;
    border-left: 0;
  }

  .partner-guide-header {
    padding: calc(1rem + env(safe-area-inset-top)) 1rem 1rem;
  }

  .partner-guide-content {
    padding: 1rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  .tab-content {
    padding-left: 0.7rem !important;
    padding-right: 0.7rem !important;
  }

  #tab-dashboard > .grid > .bg-surface,
  #tab-links .bg-surface,
  #tab-settings .bg-surface {
    padding: 0.875rem !important;
  }

  nav.safe-area-pb {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  nav.safe-area-pb span {
    font-size: 0.58rem;
  }

  .partner-guide-bubble {
    max-width: 9.25rem;
  }
}
/* Link personalizado temporariamente bloqueado */
.partner-link-maintenance { cursor: not-allowed; outline: none; }
.partner-link-maintenance__field {
  color: #71717a; filter: blur(2.5px); opacity: 0.72; overflow: hidden;
  pointer-events: none; user-select: none; white-space: nowrap;
}
.partner-link-maintenance__lock { color: #a1a1aa; pointer-events: none; }
.partner-link-maintenance__tooltip {
  position: absolute; right: 0.5rem; bottom: calc(100% + 0.55rem); z-index: 20;
  padding: 0.4rem 0.65rem; border: 1px solid #3f3f46; border-radius: 0.45rem;
  background: #18181b; color: #f4f4f5; font-size: 0.75rem; font-weight: 600;
  line-height: 1; opacity: 0; pointer-events: none; transform: translateY(0.25rem);
  transition: opacity 150ms ease, transform 150ms ease; white-space: nowrap;
}
.partner-link-maintenance__tooltip::after {
  position: absolute; top: 100%; right: 1rem; width: 0.5rem; height: 0.5rem;
  border-right: 1px solid #3f3f46; border-bottom: 1px solid #3f3f46;
  background: #18181b; content: ''; transform: translateY(-0.24rem) rotate(45deg);
}
.partner-link-maintenance:hover .partner-link-maintenance__tooltip,
.partner-link-maintenance:focus-visible .partner-link-maintenance__tooltip {
  opacity: 1; transform: translateY(0);
}
.partner-link-maintenance:focus-visible {
  border-radius: 0.5rem; box-shadow: 0 0 0 2px rgba(0, 245, 160, 0.35);
}
