@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --background: #ffffff;
  --foreground: #171717;
  border-radius: 10px;
  scrollbar-gutter: auto !important;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #222222;
    --foreground: #e0e0e0;
  }
}

html[data-page='default'] {
  background: #ffffff;
}

html[data-page='library'] {
  background: theme('colors.base-200');
}

html[data-page='reader'] {
  background: theme('colors.base-100');
}

body {
  color: var(--foreground);
  background: var(--background);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
  border-radius: 10px;
  background-color: transparent;
}

@layer utilities {
  .text-balance {
    text-wrap: balance;
  }
}

foliate-view {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
}

@keyframes scaleUpAndDown {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

.hover-bar-anim:hover ~ .foliate-viewer {
  animation: scaleUpAndDown 0.3s ease forwards;
}

.window-button {
  @apply inline-flex h-6 w-6 items-center justify-center rounded-full;
  @apply transform transition duration-200 ease-in-out hover:scale-105;
  @apply bg-base-200/85 hover:bg-base-200;
}

.rounded-window {
  border-radius: 10px;
}
.rounded-window-top-left {
  border-top-left-radius: 10px;
}
.rounded-window-bottom-left {
  border-bottom-left-radius: 10px;
}
.rounded-window-top-right {
  border-top-right-radius: 10px;
}
.rounded-window-bottom-right {
  border-bottom-right-radius: 10px;
}

.dropdown-content {
  position: relative;
  @apply bg-base-100;
  padding: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  border-radius: 14px;
}

.dropdown-content::before,
.dropdown-content::after {
  content: '';
  position: absolute;
  top: -12px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
}

.dropdown-content::before {
  border-bottom: 12px solid theme('colors.base-100');
  z-index: 1;
}

.dropdown-content::after {
  top: -14px;
  border-bottom: 13px solid rgba(0, 0, 0, 0.02);
  z-index: 0;
}

.dropdown-content.bgcolor-base-200 {
  background-color: theme('colors.base-200');
}
.dropdown-content.bgcolor-base-200::before {
  border-bottom: 12px solid theme('colors.base-200');
  z-index: 1;
}

.dropdown-left::before,
.dropdown-left::after {
  left: 20px;
  transform: translateX(0);
}

.dropdown-center::before,
.dropdown-center::after {
  left: 50%;
  transform: translateX(-50%);
}

.dropdown-right::before,
.dropdown-right::after {
  right: 20px;
  transform: translateX(0);
}

.dropdown-content.no-triangle::before,
.dropdown-content.no-triangle::after {
  display: none;
}

.tooltip.no-triangle::before,
.tooltip.no-triangle::after,
.tooltip-top.no-triangle::before,
.tooltip-top.no-triangle::after,
.tooltip-bottom.no-triangle::before,
.tooltip-bottom.no-triangle::after {
  display: none;
}

.dropdown-content,
.settings-content {
  font-size: 14px;
  font-weight: 400;
}

@media (max-width: 768px) {
  .dropdown-content,
  .settings-content {
    font-size: 16px;
  }
}

.config-item {
  @apply flex h-14 items-center justify-between p-4;
  @apply hover:bg-base-100/50;
}

.config-item-top {
  @apply rounded-t-2xl;
}

.config-item-bottom {
  @apply rounded-b-2xl;
}

.collapse-arrow > .collapse-title:after {
  top: var(--top-override, default-value);
  inset-inline-end: var(--end-override, default-value);
}

.search-bar {
  max-height: 0;
  visibility: hidden;
  overflow: visible;
  transition: max-height 0.3s ease-out;
}

.search-bar-visible {
  max-height: 48px;
  visibility: visible;
}

.scroll-container {
  overflow-y: scroll;
  scrollbar-width: thin;
}

.scroll-container.hidden-scrollbar {
  scrollbar-width: none;
}

.pull-indicator {
  position: fixed;
  top: 64px;
  width: 100%;
  background-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-lighter);
  transition: transform 0.2s ease-in-out;
  z-index: 10;
}

.pull-indicator svg {
  transition: transform 0.2s ease-in-out;
}

.pull-indicator.flip svg {
  transform: rotate(180deg);
}
