/* Productfy — Custom Styles */

body {
  font-family: system-ui, -apple-system, sans-serif;
}

code, pre {
  font-family: ui-monospace, 'SF Mono', monospace;
}

/* Content body typography */
.content-body {
  line-height: 1.8;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Domine', Georgia, 'Times New Roman', serif;
}

/* Alerts usam fonte do sistema, não a fonte de título */
[role="alert"] h1,
[role="alert"] h2,
[role="alert"] h3,
[role="alert"] h4,
[role="alert"] h5,
[role="alert"] h6,
.alert h1, .alert h2, .alert h3, .alert h4, .alert h5, .alert h6,
.alert-destructive h1, .alert-destructive h2, .alert-destructive h3,
.alert-destructive h4, .alert-destructive h5, .alert-destructive h6 {
  font-family: system-ui, -apple-system, sans-serif;
}

.content-body h1,
.content-body h2,
.content-body h3,
.content-body h4 {
  font-weight: 600;
  margin-top: 0.4em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

.content-body h1 { font-size: 1.875rem; }
.content-body h2 { font-size: 1.5rem; }
.content-body h3 { font-size: 1.25rem; }
.content-body h4 { font-size: 1.125rem; }

.content-body p {
  margin-bottom: 0;
}

.content-body ul,
.content-body ol {
  padding-left: 1.5em;
  margin-bottom: 1em;
}

.content-body ul { list-style-type: disc; }
.content-body ol { list-style-type: decimal; }

.content-body li {
  margin-bottom: 0.25em;
}

/* Quill renders both ordered and bullet lists as <ol>, tagging each <li>. */
.content-body li[data-list='bullet'] {
  list-style-type: none;
  position: relative;
}

.content-body li[data-list='bullet']::marker {
  content: '';
}

.content-body li[data-list='bullet']::before {
  content: '\2022';
  position: absolute;
  left: -1em;
  font-weight: 700;
}

.content-body li.ql-indent-1 { margin-left: 1.5em; }
.content-body li.ql-indent-2 { margin-left: 3em; }
.content-body li.ql-indent-3 { margin-left: 4.5em; }
.content-body li.ql-indent-4 { margin-left: 6em; }
.content-body li.ql-indent-5 { margin-left: 7.5em; }
.content-body li.ql-indent-6 { margin-left: 9em; }
.content-body li.ql-indent-7 { margin-left: 10.5em; }
.content-body li.ql-indent-8 { margin-left: 12em; }

.content-body blockquote {
  border-left: 4px solid hsl(var(--border));
  padding-left: 1em;
  margin: 1.5em 0;
  color: hsl(var(--muted-foreground));
  font-style: italic;
}

.content-body pre {
  background: hsl(var(--muted));
  border-radius: 0.5rem;
  padding: 1em;
  overflow-x: auto;
  margin-bottom: 1em;
}

.content-body code {
  background: hsl(var(--muted));
  border-radius: 0.25rem;
  padding: 0.1em 0.3em;
  font-size: 0.875em;
}

.content-body pre code {
  background: none;
  padding: 0;
}

.content-body a {
  color: hsl(var(--primary));
  text-decoration: underline;
  text-underline-offset: 2px;
}

.content-body a:hover {
  opacity: 0.8;
}

.content-body img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1em auto;
}

/* Cards mais arredondados */
.card {
  border-radius: 1.5rem;
}

.content-cover {
  width: min(100%, 32rem);
  aspect-ratio: 1.91 / 1;
}

.content-body hr {
  border: none;
  border-top: 1px solid hsl(var(--border));
  margin: 2em 0;
}

.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1em;
  font-size: 0.9em;
}

.content-body th,
.content-body td {
  border: 1px solid hsl(var(--border));
  padding: 0.5em 0.75em;
  text-align: left;
}

.content-body th {
  background: hsl(var(--muted));
  font-weight: 600;
}

/* Quill editor overrides */
.ql-toolbar {
  border-top-left-radius: 0.375rem;
  border-top-right-radius: 0.375rem;
  border-color: hsl(var(--border)) !important;
  background: hsl(var(--muted));
}

.ql-container {
  border-bottom-left-radius: 0.375rem;
  border-bottom-right-radius: 0.375rem;
  border-color: hsl(var(--border)) !important;
  font-family: system-ui, sans-serif;
  font-size: 1rem;
}

.ql-editor {
  min-height: 400px;
  line-height: 1.7;
}

#editor {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-bottom-left-radius: 0.375rem;
  border-bottom-right-radius: 0.375rem;
  border-top: none;
}

/* Editor toolbar adjustments */
#editor .ql-toolbar {
  border: none !important;
  border-bottom: 1px solid hsl(var(--border));
  border-radius: 0;
}
#editor .ql-container {
  border-left: none !important;
  border-right: none !important;
  border-bottom: none !important;
}

/* Line clamp utilities */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Transitions */
.transition-opacity {
  transition-property: opacity;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

.duration-500 {
  transition-duration: 500ms;
}

/* ── Mobile: Quill editor height ───────────────────────── */
@media (max-width: 767px) {
  .ql-editor {
    min-height: 200px !important;
  }
}

/* ── Mobile bottom nav: safe-area inset ────── */
.mobile-bottom-nav {
  padding-bottom: env(safe-area-inset-bottom, 0px);
  min-height: calc(3.5rem + env(safe-area-inset-bottom, 0px));
  bottom: var(--bottom-nav-offset, 0px);
}

@media (max-width: 767px) {
  #main-sidebar {
    z-index: 60;
  }

  #main-sidebar nav {
    z-index: 70;
  }
}

/* Disable default sidebar entrance animation */
.sidebar.no-load-transition,
.sidebar.no-load-transition nav {
  transition: none !important;
  animation: none !important;
  transform: none !important;
}

/* Custom header bar */
.header-bar {
  background-color: var(--color-card);
  border-color: var(--color-border);
  border-style: solid;
  border-width: 0 0 1px 0;
  box-shadow: 0 15px 35px -25px rgba(15, 23, 42, 0.75);
  backdrop-filter: saturate(180%) blur(10px);
}

/* Theme toggle icon helpers */
[data-theme-icon="dark"] {
  display: none;
}
.dark [data-theme-icon="dark"] {
  display: inline-flex;
}
.dark [data-theme-icon="light"] {
  display: none;
}

/* Instant sidebar state via critical script class */
html.sidebar-is-collapsed #main-sidebar:not([aria-hidden]) nav,
html.sidebar-is-collapsed #main-sidebar[aria-hidden="false"] nav {
  transform: translateX(-100%);
}

html.sidebar-is-collapsed #main-sidebar:not([aria-hidden]) + *,
html.sidebar-is-collapsed #main-sidebar[aria-hidden="false"] + * {
  margin-left: 0 !important;
}

/* ── Smooth Navigation & View Transitions ──────────────── */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
}

.page-fade-in {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero hand-drawn circle */
.hero-circle {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}

.hero-circle-text {
  position: relative;
  z-index: 1;
}

.hero-circle-svg {
  position: absolute;
  inset: -0.25em -0.45em;
  width: calc(100% + 0.9em);
  height: calc(100% + 0.5em);
  pointer-events: none;
  z-index: 0;
}

.hero-circle-svg ellipse {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: hero-circle-draw 0.9s 0.4s ease-out forwards;
}

@keyframes hero-circle-draw {
  to { stroke-dashoffset: 0; }
}

/* Page Loading Bar */
#page-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--color-primary);
  z-index: 9999;
  transition: width 0.3s ease;
  pointer-events: none;
  box-shadow: 0 0 10px var(--color-primary);
}
