@import url("https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400;500;600;700&display=swap");

@tailwind base;

/* Components e utilities do Tailwind depois */
@tailwind components;
@tailwind utilities;

@layer base {
  html {
    font-family: "Work Sans", sans-serif;
  }
}

@layer components {
  /* Estilos globais para inputs */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="tel"],
  select,
  textarea {
    @apply w-full p-3 border border-gray-300 rounded-md focus:ring-0 focus:border-primary hover:border-primary selection:bg-primary transition duration-200;
  }

  /* Estilos básicos do tooltip */
  .required label::after {
    content: " *";
    @apply text-red-500;
  }

  [title] {
    @apply relative;
  }

  [title]:hover::after {
    content: attr(title);
    @apply absolute bottom-full left-1/2 -translate-x-1/2 
           p-1 bg-gray-800 text-white rounded text-xs whitespace-nowrap z-10;
  }

  /* === CKEDITOR STYLES === */
  .ck-editor {
    @apply mt-2;

    &__editable {
      @apply min-h-[200px] bg-white p-4;
    }
  }

  .ck-toolbar {
    @apply border border-gray-300 bg-gray-50;

    &-container {
      @apply p-2 bg-gray-50 border border-gray-300 border-b-0 rounded-t-lg;
    }
  }

  .ck-content {
    @apply border border-gray-300 min-h-[200px] p-4 bg-white rounded-b-lg;

    /* Headings */
    h1,
    h2,
    h3,
    h4 {
      @apply font-bold mb-4;
    }

    h1 {
      @apply text-4xl;
    }
    h2 {
      @apply text-3xl;
    }
    h3 {
      @apply text-2xl;
    }
    h4 {
      @apply text-xl;
    }

    /* Text sizes */
    .text-tiny {
      @apply text-xs;
    }
    .text-small {
      @apply text-sm;
    }
    .text-big {
      @apply text-lg;
    }
    .text-huge {
      @apply text-xl;
    }

    /* Text alignment */
    .text-align-left {
      @apply text-left;
    }
    .text-align-center {
      @apply text-center;
    }
    .text-align-right {
      @apply text-right;
    }
    .text-align-justify {
      @apply text-justify;
    }

    /* Tables */
    table {
      @apply w-full border-collapse my-4;

      td,
      th {
        @apply border border-gray-300 p-2 min-w-[2em];
      }
    }

    /* Images */
    .image {
      @apply my-4 max-w-full;

      img {
        @apply block mx-auto max-w-full h-auto;
      }

      &-style-side {
        @apply float-right ml-6 max-w-[50%];
      }
      &-style-align-left {
        @apply float-left mr-6 max-w-[40%];
      }
      &-style-align-right {
        @apply float-right ml-6 max-w-[40%];
      }
      &-style-align-center {
        @apply mx-auto text-center;
      }
    }

    /* Other elements */
    blockquote {
      @apply border-l-4 border-gray-300 italic my-6 p-4 bg-gray-50;
    }
    ul,
    ol {
      @apply ml-6 pl-4;
    }
    code {
      @apply bg-gray-100 px-2 py-0.5 rounded font-mono;
    }
    hr {
      @apply border-0 border-t-2 border-gray-200 my-4;
    }
    a {
      @apply text-blue-600 underline hover:text-blue-800;
    }
    p {
      @apply mb-4;
    }
  }

  /* UI Elements */
  .ck-button {
    @apply p-2 text-gray-700 hover:bg-gray-200;

    &.ck-on {
      @apply bg-gray-200 text-gray-800;
    }
  }

  /* Z-index fixes */
  .ck-dropdown__panel {
    @apply z-50;
  }

  .ck-dialog-visible {
    @apply z-[60];
  }

  /* Formatação específica do campo CKEditor */
  .ck-editor__editable {
    min-height: 200px !important;
  }

  .ck.ck-editor__main > .ck-editor__editable {
    background-color: white !important;
    padding: 1rem !important;
  }

  .ck.ck-toolbar {
    border: 1px solid #d1d5db !important;
    background-color: #f9fafb !important;
  }

  /* Estilos específicos para o DecoupledEditor */
  .ck-toolbar-container {
    padding: 0.5rem !important;
    background-color: #f9fafb !important;
    border: 1px solid #d1d5db !important;
    border-bottom: none !important;
    border-top-left-radius: 0.5rem !important;
    border-top-right-radius: 0.5rem !important;
  }

  .ck-toolbar-container .ck-toolbar {
    border: none !important;
    background: transparent !important;
  }

  /* Área editável do CKEditor */
  .ck-content {
    border: 1px solid #d1d5db !important;
    min-height: 200px !important;
    padding: 1rem !important;
    background-color: white !important;
    border-bottom-left-radius: 0.5rem !important;
    border-bottom-right-radius: 0.5rem !important;
    border-top: none !important; /* Remove borda superior para conectar com toolbar */
  }

  /* Espaçamento específico para o container do CKEditor */
  .ck-editor-container {
    margin-top: 0.55rem !important;
  }

  /* Se você estiver usando labels do Tailwind/Rails */
  label + .ck-toolbar-container {
    margin-top: 0.55rem !important;
  }

  /* Ícones de ação */
  .action-icon {
    @apply w-5 h-5 transition;
  }

  .action-view {
    @apply text-[#009EFF] hover:text-[#0086CC];
  }

  .action-edit {
    @apply text-green-500 hover:text-green-700;
  }

  .action-delete {
    @apply text-red-500 hover:text-red-700;
  }

  .btn-primary {
    @apply inline-flex items-center rounded-md bg-primary px-4 py-2 text-sm font-semibold text-white shadow hover:bg-primary-dark focus:outline-none transition;
  }

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

@keyframes fade-out-right {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

html,
body {
  height: 100%;
}
body {
  display: flex;
  flex-direction: column;
}
main {
  flex: 1;
}

@layer utilities {
  .text-current-green-400 {
    --tw-text-opacity: 1;
    color: rgb(74 222 128 / var(--tw-text-opacity));
  }
  .text-current-red-400 {
    --tw-text-opacity: 1;
    color: rgb(248 113 113 / var(--tw-text-opacity));
  }
  .text-current-yellow-400 {
    --tw-text-opacity: 1;
    color: rgb(250 204 21 / var(--tw-text-opacity));
  }
  .text-current-blue-400 {
    --tw-text-opacity: 1;
    color: rgb(96 165 250 / var(--tw-text-opacity));
  }
  .text-current-gray-400 {
    --tw-text-opacity: 1;
    color: rgb(156 163 175 / var(--tw-text-opacity));
  }
}

.cropper-view-box,
.cropper-face {
  border-radius: 50%;
}

.cropper-view-box {
  outline: 0;
  box-shadow: 0 0 0 1px #39f;
}

/* Timeline */
.timeline-container {
  @apply relative;
}

.timeline-container::after {
  content: "";
  @apply absolute left-8 top-0 bottom-0 w-0.5 bg-gray-200;
}

.timeline-item {
  @apply relative pl-20 mb-8;
}

.timeline-info {
  @apply flex flex-col mb-2;
}

.timeline-marker {
  @apply absolute left-8 top-[0.875rem] w-3 h-3 rounded-full -translate-x-1/2 z-10;
}

.timeline-content {
  @apply relative;
}

/* Timeline Marker Colors */
.timeline-marker.active {
  @apply bg-primary ring-4 ring-primary/20 animate-pulse;
}

.timeline-marker.soon {
  @apply bg-blue-500 ring-4 ring-blue-100 animate-pulse;
}

.timeline-marker.normal {
  @apply bg-gray-400 ring-4 ring-gray-100;
}

/* Card Styles */
.booking-card {
  @apply bg-white rounded-lg p-4 border-2 transition-all duration-150;
}

.booking-card.active {
  @apply border-primary shadow-lg ring-1 ring-primary/20;
}

.booking-card.soon {
  @apply border-blue-200 shadow-md ring-1 ring-blue-100;
}

.booking-card.normal {
  @apply border-gray-200 hover:border-gray-300 hover:bg-gray-50 hover:shadow-md;
}
