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

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

html.subsidebar-closed #sub-sidebar-panel {
    width: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    border-right-width: 0px !important;
}

/* Admin Sidebar Active & Inactive Nav Styles */
.admin-active-nav {
    background-color: #ffffff !important;
    color: theme('colors.primary.600') !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -4px rgba(0, 0, 0, 0.1) !important;
}

.admin-active-nav svg {
    color: theme('colors.primary.600') !important;
    stroke: theme('colors.primary.600') !important;
}

.admin-inactive-nav {
    color: rgba(255, 255, 255, 0.75) !important;
    background-color: transparent !important;
}

.admin-inactive-nav svg {
    color: rgba(255, 255, 255, 0.75) !important;
    stroke: currentColor !important;
}

.admin-inactive-nav:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.12) !important;
}

.admin-inactive-nav:hover svg {
    color: #ffffff !important;
}

/* Sub-Sidebar Active Item */
.admin-sub-active {
    background-color: theme('colors.primary.50') !important;
    color: theme('colors.primary.600') !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}

.admin-sub-active svg {
    color: theme('colors.primary.600') !important;
    stroke: theme('colors.primary.600') !important;
}

.dark .admin-sub-active {
    background-color: theme('colors.primary.950') !important;
    color: theme('colors.primary.400') !important;
}

.dark .admin-sub-active svg {
    color: theme('colors.primary.400') !important;
    stroke: theme('colors.primary.400') !important;
}

/* ========================================================= */
/* DaisyUI & Standalone Tooltip Engine                       */
/* Works seamlessly with class="d-tooltip d-tooltip-right"   */
/* and data-tip="..." attribute                             */
/* ========================================================= */
.d-tooltip {
    position: relative !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

/* Tooltip Body (:before) */
.d-tooltip:before {
    content: attr(data-tip) !important;
    position: absolute !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: 99999 !important;
    background-color: #0f172a !important;
    color: #ffffff !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    line-height: 1rem !important;
    padding: 0.4rem 0.7rem !important;
    border-radius: 0.375rem !important;
    white-space: nowrap !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.2) !important;
    letter-spacing: 0.025em !important;
    transition: opacity 0.15s ease-in-out, visibility 0.15s ease-in-out !important;
}

/* Tooltip Arrow (:after) */
.d-tooltip:after {
    content: "" !important;
    position: absolute !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: 99999 !important;
    border-style: solid !important;
    border-width: 5px !important;
    width: 0 !important;
    height: 0 !important;
    transition: opacity 0.15s ease-in-out, visibility 0.15s ease-in-out !important;
}

/* Hover & Focus Visible Activation */
.d-tooltip:hover:before,
.d-tooltip:hover:after,
.d-tooltip:focus-visible:before,
.d-tooltip:focus-visible:after,
.d-tooltip.d-tooltip-open:before,
.d-tooltip.d-tooltip-open:after {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Tooltip Right (for slim sidebar buttons) */
.d-tooltip-right:before {
    top: 50% !important;
    left: calc(100% + 10px) !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
}

.d-tooltip-right:after {
    top: 50% !important;
    left: calc(100% + 2px) !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    border-color: transparent #0f172a transparent transparent !important;
}

/* Tooltip Bottom (for drawer toggles / topbar icons) */
.d-tooltip-bottom:before {
    top: calc(100% + 10px) !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
}

.d-tooltip-bottom:after {
    top: calc(100% + 2px) !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
    border-color: transparent transparent #0f172a transparent !important;
}

/* Tooltip Bottom End (aligns right edge with button, expands left so it never clips) */
.d-tooltip-bottom-end:before {
    top: calc(100% + 10px) !important;
    right: 0 !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
}

.d-tooltip-bottom-end:after {
    top: calc(100% + 2px) !important;
    right: 11px !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    border-color: transparent transparent #0f172a transparent !important;
}

/* Tooltip Bottom Start (aligns left edge with button, expands right cleanly) */
.d-tooltip-bottom-start:before {
    top: calc(100% + 10px) !important;
    left: 0 !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
}

.d-tooltip-bottom-start:after {
    top: calc(100% + 2px) !important;
    left: 14px !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    border-color: transparent transparent #0f172a transparent !important;
}

/* Tooltip Left */
.d-tooltip-left:before {
    top: 50% !important;
    right: calc(100% + 10px) !important;
    left: auto !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
}

.d-tooltip-left:after {
    top: 50% !important;
    right: calc(100% + 2px) !important;
    left: auto !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    border-color: transparent transparent transparent #0f172a !important;
}

/* Tooltip Top */
.d-tooltip-top:before {
    bottom: calc(100% + 10px) !important;
    left: 50% !important;
    top: auto !important;
    right: auto !important;
    transform: translateX(-50%) !important;
}

.d-tooltip-top:after {
    bottom: calc(100% + 2px) !important;
    left: 50% !important;
    top: auto !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    border-color: #0f172a transparent transparent transparent !important;
}

/* Tooltip Top End (Top direction, right-edge aligned to avoid clipping on right boundaries) */
.d-tooltip-top-end:before {
    bottom: calc(100% + 10px) !important;
    right: 0 !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
}

.d-tooltip-top-end:after {
    bottom: calc(100% + 2px) !important;
    right: 10px !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    border-color: #0f172a transparent transparent transparent !important;
}

/* Tooltip Top Start (Top direction, left-edge aligned) */
.d-tooltip-top-start:before {
    bottom: calc(100% + 10px) !important;
    left: 0 !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
}

.d-tooltip-top-start:after {
    bottom: calc(100% + 2px) !important;
    left: 10px !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    border-color: #0f172a transparent transparent transparent !important;
}

.d-tooltip:hover,
.d-tooltip:focus-visible,
.d-tooltip.d-tooltip-open {
    z-index: 99999 !important;
}

/* ========================================================= */
/* Livewire 3 wire:navigate Progress Bar (Brand Crimson Red) */
/* ========================================================= */
.livewire-progress-bar,
#nprogress .bar {
    background-color: theme('colors.primary.600') !important;
    height: 3px !important;
    box-shadow: 0 0 10px theme('colors.primary.600') !important;
}

/* ========================================================= */
/* Google Sans Typography (Admin Exclusive)                  */
/* ========================================================= */
body.admin-layout,
.admin-layout,
.admin-layout button,
.admin-layout input,
.admin-layout select,
.admin-layout textarea {
    font-family: "Google Sans", sans-serif !important;
    font-optical-sizing: auto;
}

/* ========================================================= */
/* Google Material Symbols Font Rendering                    */
/* ========================================================= */
.material-symbols-outlined,
.material-symbols-rounded,
.material-symbols-sharp {
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    vertical-align: middle;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'liga';
}

/* ========================================================= */
/* Hide Scrollbars (Keep Smooth Scroll Functionality Active)  */
/* ========================================================= */
html, body, * {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

::-webkit-scrollbar,
*::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

@layer utilities {
    .no-scrollbar::-webkit-scrollbar,
    .hide-scrollbar::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    .no-scrollbar,
    .hide-scrollbar {
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;
    }
}

/* ========================================================= */
/* TipTap Simple Editor Template 1:1 Design System           */
/* ========================================================= */
.simple-editor-wrapper {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dark .simple-editor-wrapper {
    background-color: #0f172a;
    border-color: #1e293b;
}

.simple-editor-wrapper:focus-within {
    border-color: #cbd5e1;
    box-shadow: 0 0 0 3px rgba(226, 232, 240, 0.6);
}

.dark .simple-editor-wrapper:focus-within {
    border-color: #334155;
    box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.6);
}

.tiptap-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.6rem;
    background-color: #fafafa;
    border-bottom: 1px solid #e5e7eb;
}

.dark .tiptap-toolbar {
    background-color: #1e293b;
    border-bottom-color: #334155;
}

.tiptap-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.tiptap-separator {
    width: 1px;
    height: 1.25rem;
    background-color: #e5e7eb;
    margin: 0 0.35rem;
    flex-shrink: 0;
}

.dark .tiptap-separator {
    background-color: #334155;
}

.tiptap-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2rem;
    min-width: 2rem;
    padding: 0 0.45rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #4b5563;
    background-color: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
    user-select: none;
}

.dark .tiptap-button {
    color: #9ca3af;
}

.tiptap-button:hover:not(:disabled) {
    background-color: #f3f4f6;
    color: #111827;
}

.dark .tiptap-button:hover:not(:disabled) {
    background-color: #374151;
    color: #f9fafb;
}

.tiptap-button.is-active,
.tiptap-button[data-active-state="on"] {
    background-color: #e5e7eb !important;
    color: #111827 !important;
    font-weight: 700;
}

.dark .tiptap-button.is-active,
.dark .tiptap-button[data-active-state="on"] {
    background-color: #374151 !important;
    color: #ffffff !important;
}

.tiptap-button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.tiptap-button-icon {
    width: 1.05rem;
    height: 1.05rem;
    flex-shrink: 0;
    fill: currentColor;
}

.tiptap-button-dropdown-small {
    width: 0.75rem;
    height: 0.75rem;
    margin-left: 0.125rem;
    fill: currentColor;
    opacity: 0.7;
}

/* ========================================================= */
/* TipTap Rich Text Editor Custom Theme & Table Styling      */
/* ========================================================= */
.tiptap {
    outline: none !important;
    font-family: inherit;
    line-height: 1.75;
}

.tiptap p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    float: left;
    color: #94a3b8;
    pointer-events: none;
    height: 0;
}

.dark .tiptap p.is-editor-empty:first-child::before {
    color: #64748b;
}

/* Headings */
.tiptap h1 {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.25;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    color: #0f172a;
    letter-spacing: -0.025em;
}

.dark .tiptap h1 {
    color: #f8fafc;
}

.tiptap h2 {
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.35;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.dark .tiptap h2 {
    color: #f1f5f9;
}

.tiptap h3 {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    color: #334155;
}

.dark .tiptap h3 {
    color: #e2e8f0;
}

/* Paragraphs & Lists */
.tiptap p {
    margin: 0.75rem 0;
}

.tiptap ul {
    list-style-type: disc !important;
    padding-left: 1.6rem !important;
    margin: 0.75rem 0 !important;
}

.tiptap ol {
    list-style-type: decimal !important;
    padding-left: 1.6rem !important;
    margin: 0.75rem 0 !important;
}

.tiptap li {
    margin: 0.35rem 0;
}

.tiptap li p {
    margin: 0 !important;
}

/* Blockquote */
.tiptap blockquote {
    border-left: 3px solid theme('colors.primary.500');
    padding-left: 1rem;
    margin: 1.25rem 0;
    font-style: italic;
    color: #64748b;
}

.dark .tiptap blockquote {
    color: #94a3b8;
    border-left-color: theme('colors.primary.400');
}

/* Code & Pre */
.tiptap pre {
    background: #0f172a !important;
    color: #f8fafc !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    padding: 0.85rem 1.15rem !important;
    border-radius: 0.75rem !important;
    margin: 1rem 0 !important;
    overflow-x: auto !important;
    font-size: 0.85rem !important;
    line-height: 1.6 !important;
}

.tiptap code {
    background-color: #f1f5f9;
    color: #e11d48;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875em;
    padding: 0.15rem 0.35rem;
    border-radius: 0.35rem;
    font-weight: 500;
}

.dark .tiptap code {
    background-color: #1e293b;
    color: #fb7185;
}

.tiptap pre code {
    background-color: transparent !important;
    color: inherit !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

/* Horizontal Rule */
.tiptap hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 2rem 0;
}

.dark .tiptap hr {
    border-top-color: #334155;
}

/* TipTap Tables */
.tiptap table {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
    margin: 1.25rem 0;
    overflow: hidden;
    border-radius: 0.75rem;
}

.tiptap table td,
.tiptap table th {
    min-width: 1em;
    border: 1px solid #e2e8f0;
    padding: 0.7rem 0.9rem;
    vertical-align: top;
    box-sizing: border-box;
    position: relative;
    font-size: 0.875rem;
}

.dark .tiptap table td,
.dark .tiptap table th {
    border-color: #334155;
}

.tiptap table th {
    font-weight: 700;
    text-align: left;
    background-color: #f8fafc;
    color: #1e293b;
}

.dark .tiptap table th {
    background-color: #1e293b;
    color: #f1f5f9;
}

.tiptap table .selectedCell:after {
    z-index: 2;
    position: absolute;
    content: "";
    left: 0; right: 0; top: 0; bottom: 0;
    background: rgba(225, 29, 72, 0.08);
    pointer-events: none;
}

.tiptap table .column-resize-handle {
    position: absolute;
    right: -2px;
    top: 0;
    bottom: -2px;
    width: 4px;
    background-color: theme('colors.primary.600');
    pointer-events: none;
}

/* TipTap YouTube & Video Containers */
.tiptap iframe {
    max-width: 100%;
    border-radius: 1rem;
    margin: 1.25rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

