@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
@import './themes.css';
@import 'themes.css';
@import 'react-toastify/dist/ReactToastify.css';

.button-base {
  @apply border-2 rounded-md font-bold;
}

:root {
  --toastify-color-light: var(--background-color);
  --toastify-text-color-light: var(--primary-color);
  --toastify-color-info: var(--primary-color);
  --toastify-color-progress-light: var(--primary-color);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
    'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html,
body {
  margin: 0;
  background-color: var(--background-color);
  color: var(--primary-color);
}

.button-primary {
  @apply button-base border-primary text-primary bg-background;
}

.button-primary:active {
  @apply button-base text-secondary border-secondary;
}

.button-primary-filled {
  @apply button-base border-primary bg-primary text-background;
}

.button-primary-filled:active {
  @apply button-base border-secondary bg-secondary;
}

.button-secondary {
  @apply button-base border-secondary text-secondary bg-background;
}

.button-secondary-filled {
  @apply button-base border-secondary bg-secondary text-background;
}

.button-neutral {
  @apply button-base border-neutral bg-background text-neutral;
}

.button-neutral-filled {
  @apply button-base border-neutral bg-neutral text-background;
}

.button-danger {
  @apply button-base border-danger text-danger;
}

.button-danger-filled {
  @apply button-base border-danger bg-danger text-background;
}

.disabled {
  filter: grayscale(70%);
}

.select-base {
  @apply bg-background border border-primary text-primary font-bold rounded-lg text-center p-1 w-full;
}

.select-base:focus {
  @apply border-secondary;
  outline: 1px solid var(--secondary-color);
}

.input-base {
  @apply text-primary border-primary rounded-lg bg-background border text-center p-1 w-full;
}

.input-base-large {
  @apply text-primary border-primary rounded-lg bg-background border text-center p-2 w-full;
}

.input-base[type='number'],
.input-base-large[type='number'] {
  @apply pr-0; /* Add padding to the left */
}

.input-base:focus,
.input-base-large:focus {
  @apply border-secondary;
  outline: 2px solid var(--secondary-color);
}

input[type='checkbox'] {
  @apply w-6 h-6 border-primary border rounded-sm bg-background text-primary appearance-none checked:border-secondary;
  position: relative;
}

input[type='checkbox']:checked::after {
  content: '';
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.5em;
  height: 1em;
  border: solid var(--secondary-color);
  border-width: 0 0.2em 0.2em 0;
  transform: translate(-50%, -60%) rotate(45deg);
}

input[type='file']::file-selector-button {
  @apply button-primary px-2 mr-2 border;
}

input[type='file']::-webkit-file-upload-button {
  @apply button-primary px-2 mr-2 border;
}

input[type='file']::-ms-browse {
  @apply button-primary px-2 mr-2 border;
}

input[type='color'] {
  @apply rounded-md h-10;
  border: 1px solid var(--primary-color);
  background-color: var(--background-color);
  color: var(--primary-color);
  appearance: none;
  padding: 0;
  cursor: pointer;
  outline: none;
}

input[type='color']::-webkit-color-swatch {
  border: none;
}

input[type='color']::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type='color']::-moz-focus-inner {
  border: 0;
}

/* Override the picker dropdown itself (requires experimental flags in some browsers) */
input[type='color']::file-selector-button {
  background: var(--background-color);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

input[type='date']::-webkit-calendar-picker-indicator,
input[type='time']::-webkit-calendar-picker-indicator {
  color: var(--primary-color);
  background-color: var(--primary-color);
}

.sticky-bottom {
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.sticky-top {
  position: sticky;
  top: 2.5rem;
  z-index: 10;
}

.modal {
  position: absolute;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  color: var(--primary-color);
  background: var(--background-color);
  padding: 10px;
  border-radius: 8px;
  outline: none;
  height: 99%;
  max-height: 600px;
  width: 99%;
  max-width: 1000px;
  overflow-x: auto;
}

@media (max-width: 640px) {
  .modal {
    max-height: 800px;
  }
}

.modal.slim {
  max-height: 300px;
  max-width: 600px;
}

@media (max-width: 640px) {
  .modal.slim.h-fit {
    max-height: 600px;
  }
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  overflow: hidden;
}

/* Class added to body when modal is open */
.ReactModal__Body--open {
  overflow: hidden;
  padding-right: var(--scrollbar-width, 15px); /* Prevent layout shift when scrollbar disappears */
}

/* Custom Scrollbar Styling */
/* Chrome, Edge, Safari */
::-webkit-scrollbar {
  background: var(--background-color);
}
::-webkit-scrollbar-thumb {
  background: var(--primary-color);
}
::-webkit-scrollbar-track {
  background: var(--background-color);
}

/* Firefox */
* {
  scrollbar-color: var(--primary-color) var(--background-color);
}
