@tailwind base;
@tailwind components;
@tailwind utilities;
body {
    @apply leading-[normal] m-0 text-darkslateblue-300;
}

*,
::before,
::after {
    border-width: 0;
}

[x-cloak] {
    display: none !important;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.no-scrollbar {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

:root {
    --header-height: 90px;
}

/* Contraste */
.modo-contraste {
    filter: grayscale(100%) contrast(150%);
}

/* Scrollbar */
.start-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.start-scrollbar::-webkit-scrollbar-track {
    background-color: transparent;
}

.start-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: background-color 0.3s;
}

.start-scrollbar:hover::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.4);
}


.start-scrollbar-2::-webkit-scrollbar {
    width: 3px;
    height: 3px;
}

.start-scrollbar-2::-webkit-scrollbar-track {
    background-color: rgba(0, 0, 0, 0.1);
}

.start-scrollbar-2::-webkit-scrollbar-thumb {
    @apply bg-darkslateblue-300;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.start-scrollbar-2:hover::-webkit-scrollbar-thumb {
    @apply bg-darkslateblue-300;
}


/* ======== Rich Editor======== */
.rich-editor > *:not(:first-child):where(p, div, ul, ol, li) {
    @apply mt-2;
}

.rich-editor b,
.rich-editor strong {
    @apply font-bold;
}

.rich-editor i,
.rich-editor em {
    @apply italic;
}

.rich-editor u {
    @apply underline;
}

.rich-editor a {
    @apply text-blue-500 underline hover:text-blue-700;
}

.rich-editor ul {
    @apply list-disc pl-5;
}

.rich-editor ol {
    @apply list-decimal pl-5;
}

.rich-editor li:not(:first-child) {
    @apply mt-1;
}

/* ======== Conteudo TipTap ======== */
.start-conteudo {
    @apply text-base text-darkslateblue-300;

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        @apply font-bold text-midnightblue-100 font-bricolage;
    }

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

    h1 {
        @apply text-[2.5rem] sm:text-[4rem] leading-tight;
    }

    h2 {
        @apply text-[1.5rem] sm:text-[2rem] leading-tight;
    }

    h3 {
        @apply text-lg leading-snug;
    }

    h4 {
        @apply text-base;
    }

    a {
        @apply underline hover:no-underline;
    }

    p:empty {
        @apply h-10;
    }

    blockquote {
        @apply pl-4 border-l-8 border-midnightblue-100;
    }

    iframe {
        @apply w-full;
    }

    ul,
    ol {
        @apply pl-4 ml-4;
    }

    ul {
        @apply list-disc;
    }

    ol {
        @apply list-decimal;
    }

    ul.checked-list {
        @apply list-none ml-0;

        li {
            @apply flex items-baseline gap-1.5;

            &::before {
                content: '✓';
                @apply w-5 h-5 shrink-0;
            }
        }
    }

    hr {
        @apply my-4 border-gray-400;
    }

    /* Table */
    table {
        @apply min-w-[37.5rem] overflow-auto border border-collapse rounded-[40px] [border-style:hidden] [box-shadow:_0_0_0_1px_rgb(0_60_165)];
    }

    td, th {
        @apply border border-midnightblue-100;
    }
    td {
        @apply py-6 px-2 sm:px-4;
    }
    th {
        @apply p-2;
    }
    th, th p {
        @apply text-midnightblue-100;
    }

    /* margins */
    --stack: clamp(1.25ex, 2.5vmax, 1.75ex);

    :where(.lead, h1, h2, h3, h4, h5, h6, p, ul, ol, li, blockquote, pre, table, dl, img, iframe, .filament-tiptap-grid, .filament-tiptap-grid-builder) + :where(p, ul, ol, li, blockquote, pre, table, dl, img, iframe, .filament-tiptap-grid, .filament-tiptap-grid-builder) {
        margin-block-start: var(--stack);
    }

    :where(h1, h2, h3, h4, h5, h6) {
        margin-block-start: calc(var(--stack) * 1.5);
    }

    :where(h1, h2, h3, h4, h5, h6) + *:not(h1, h2, h3, h4, h5, h6) {
        margin-block-start: calc(var(--stack) / 2);
    }
}

/* Lead text */
/*.lead {*/
/*    @apply text-lg leading-snug;*/
/*}*/

/* GRID Styles */
.filament-tiptap-grid,
.filament-tiptap-grid-builder {
    @apply grid gap-4 box-border;

    .filament-tiptap-grid__column,
    .filament-tiptap-grid-builder__column {
        @apply box-border rounded;
    }

    &.ProseMirror-selectednode {
        @apply rounded outline outline-2 outline-dashed outline-gray-900 outline-offset-2;
    }
}

@media (max-width: theme('screens.md')) {
    .filament-tiptap-grid, .filament-tiptap-grid-builder {
        grid-template-columns: 1fr !important;
    }
}

/* Asymetric Grids */
.filament-tiptap-grid[type^="asymetric"] {
    @apply grid-cols-1 auto-rows-auto;
}

@media (max-width: theme('screens.sm')) {
    .filament-tiptap-grid-builder[data-stack-at="sm"] {
        @apply grid-cols-1 !important;

        .filament-tiptap-grid-builder__column {
            @apply col-span-1 !important;
        }
    }
}

@media (max-width: theme('screens.md')) {
    .filament-tiptap-grid-builder[data-stack-at="md"] {
        @apply grid-cols-1 !important;

        .filament-tiptap-grid-builder__column {
            @apply col-span-1 !important;
        }
    }
}

@media (max-width: theme('screens.lg')) {
    .filament-tiptap-grid-builder[data-stack-at="lg"] {
        @apply grid-cols-1 !important;

        .filament-tiptap-grid-builder__column {
            @apply col-span-1 !important;
        }
    }
}

/* Specific asymetric grid layouts */
.filament-tiptap-grid[type="asymetric-right-thirds"] {
    @screen md {
        @apply grid-cols-[1fr_2fr];
    }
}

.filament-tiptap-grid[type="asymetric-left-thirds"] {
    @screen md {
        @apply grid-cols-[2fr_1fr];
    }
}

.filament-tiptap-grid[type="asymetric-right-fourths"] {
    @screen md {
        @apply grid-cols-[1fr_3fr];
    }
}

.filament-tiptap-grid[type="asymetric-left-fourths"] {
    @screen md {
        @apply grid-cols-[3fr_1fr];
    }
}

/* Responsive Grids */
.filament-tiptap-grid[type="responsive"] {
    @apply grid-cols-1 auto-rows-auto;

    &[cols="2"] {
        @screen md {
            @apply grid-cols-2;
        }
    }

    &[cols="3"] {
        @screen md {
            @apply grid-cols-3;
        }
    }

    &[cols="4"] {
        @screen md {
            @apply grid-cols-2;
        }

        @screen lg {
            @apply grid-cols-4;
        }
    }

    &[cols="5"] {
        @screen md {
            @apply grid-cols-5;
        }
    }
}

.tiptap-content a {
    text-decoration: none;
}

/* Mostra o sublinhado apenas quando o link está dentro de uma tag <u> */
.tiptap-content u a,
.tiptap-content a u {
    text-decoration: underline;
}

.contato p a {
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

/* Fixed Grids */
.filament-tiptap-grid[type="fixed"] {
    &[cols="2"] {
        @apply grid-cols-2;
    }

    &[cols="3"] {
        @apply grid-cols-3;
    }

    &[cols="4"] {
        @apply grid-cols-4;
    }

    &[cols="5"] {
        @apply grid-cols-5;
    }
}
