@import 'tailwindcss' source(none);

/* Ensure dialog appears above chat widget backdrop (z-[9998]) */
[data-slot="dialog-overlay"] {
    z-index: 10000 !important;
}

[data-slot="dialog-content"] {
    z-index: 10001 !important;
}

@plugin 'tailwindcss-animate';

@source '../js';
@source '../views';
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';

@custom-variant dark (&:is(.dark *));

@theme {
    --font-sans:
        'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';

    --font-poppins:
        'Poppins', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';

    --radius-lg: var(--radius);
    --radius-md: calc(var(--radius) - 2px);
    --radius-sm: calc(var(--radius) - 4px);

    --color-background: var(--background);
    --color-foreground: var(--foreground);

    --color-card: var(--card);
    --color-card-foreground: var(--card-foreground);

    --color-popover: var(--popover);
    --color-popover-foreground: var(--popover-foreground);

    --color-primary: var(--primary);
    --color-primary-foreground: var(--primary-foreground);

    --color-secondary: var(--secondary);
    --color-secondary-foreground: var(--secondary-foreground);

    --color-muted: var(--muted);
    --color-muted-foreground: var(--muted-foreground);

    --color-accent: var(--accent);
    --color-accent-foreground: var(--accent-foreground);

    --color-destructive: var(--destructive);
    --color-destructive-foreground: var(--destructive-foreground);

    --color-border: var(--border);
    --color-input: var(--input);
    --color-ring: var(--ring);

    --color-chart-1: var(--chart-1);
    --color-chart-2: var(--chart-2);
    --color-chart-3: var(--chart-3);
    --color-chart-4: var(--chart-4);
    --color-chart-5: var(--chart-5);

    --color-sidebar: var(--sidebar);
    --color-sidebar-foreground: var(--sidebar-foreground);
    --color-sidebar-primary: var(--sidebar-primary);
    --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
    --color-sidebar-accent: var(--sidebar-accent);
    --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
    --color-sidebar-border: var(--sidebar-border);
    --color-sidebar-ring: var(--sidebar-ring);
}

:root {
    --background: oklch(1 0 0);
    --foreground: oklch(0.145 0 0);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.145 0 0);
    --popover: oklch(1 0 0);
    --popover-foreground: oklch(0.145 0 0);
    --primary: #09409B;
    --primary-foreground: oklch(0.985 0 0);
    --secondary: oklch(0.97 0 0);
    --secondary-foreground: oklch(0.205 0 0);
    --muted: oklch(0.97 0 0);
    --muted-foreground: oklch(0.556 0 0);
    --accent: oklch(0.97 0 0);
    --accent-foreground: oklch(0.205 0 0);
    --destructive: oklch(0.577 0.245 27.325);
    --destructive-foreground: oklch(0.577 0.245 27.325);
    --border: oklch(0.922 0 0);
    --input: oklch(0.922 0 0);
    --ring: oklch(0.87 0 0);
    --chart-1: oklch(0.646 0.222 41.116);
    --chart-2: oklch(0.6 0.118 184.704);
    --chart-3: oklch(0.398 0.07 227.392);
    --chart-4: oklch(0.828 0.189 84.429);
    --chart-5: oklch(0.769 0.188 70.08);
    --radius: 0.625rem;
    --sidebar: #09409B;
    --sidebar-foreground: rgba(255, 255, 255, 0.92);
    --sidebar-primary: #ffffff;
    --sidebar-primary-foreground: #09409B;
    --sidebar-accent: rgba(255, 255, 255, 0.15);
    --sidebar-accent-foreground: #ffffff;
    --sidebar-border: rgba(255, 255, 255, 0.18);
    --sidebar-ring: rgba(255, 255, 255, 0.25);
}

.dark {
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.145 0 0);
    --card-foreground: oklch(0.985 0 0);
    --popover: oklch(0.145 0 0);
    --popover-foreground: oklch(0.985 0 0);
    --primary: #8CAEFF;
    --primary-foreground: oklch(0.145 0 0);
    --secondary: oklch(0.269 0 0);
    --secondary-foreground: oklch(0.985 0 0);
    --muted: oklch(0.269 0 0);
    --muted-foreground: oklch(0.708 0 0);
    --accent: oklch(0.269 0 0);
    --accent-foreground: oklch(0.985 0 0);
    --destructive: oklch(0.396 0.141 25.723);
    --destructive-foreground: oklch(0.637 0.237 25.331);
    --border: oklch(0.269 0 0);
    --input: oklch(0.269 0 0);
    --ring: oklch(0.439 0 0);
    --chart-1: oklch(0.488 0.243 264.376);
    --chart-2: oklch(0.696 0.17 162.48);
    --chart-3: oklch(0.769 0.188 70.08);
    --chart-4: oklch(0.627 0.265 303.9);
    --chart-5: oklch(0.645 0.246 16.439);
    --sidebar: #071E3D;
    --sidebar-foreground: rgba(255, 255, 255, 0.88);
    --sidebar-primary: #8CAEFF;
    --sidebar-primary-foreground: #071E3D;
    --sidebar-accent: rgba(255, 255, 255, 0.1);
    --sidebar-accent-foreground: #ffffff;
    --sidebar-border: rgba(255, 255, 255, 0.12);
    --sidebar-ring: rgba(255, 255, 255, 0.2);
}

@layer base {
    html {
        scroll-behavior: smooth;
        scroll-padding-top: 7rem;
    }

    * {
        @apply border-border;
    }

    body {
        @apply bg-background text-foreground;
    }
}

/* Admin panel: gradient on the very background (top to bottom) */
[data-slot="sidebar-wrapper"] {
    background: linear-gradient(180deg, #1E40AC 0%, #58CEE6 100%) !important;
}

.dark [data-slot="sidebar-wrapper"] {
    background: linear-gradient(180deg, #1E3A8A 0%, #0e7490 100%) !important;
}

/* Customer / e-commerce panel: plain white background */
.customer-layout-main {
    @apply bg-white;
}

.dark .customer-layout-main {
    @apply bg-background;
}

/* Customer layout: solid card container */
.customer-layout-glass {
    @apply rounded-xl border border-border bg-white shadow-sm;
}

.dark .customer-layout-glass {
    @apply border-border bg-card;
}

/* Sidebar: glass-like panel (frosted, semi-transparent) on gradient */
[data-sidebar="sidebar"] {
    background: rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.2),
        0 2px 4px -2px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.dark [data-sidebar="sidebar"] {
    background: rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.3),
        0 2px 4px -2px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Sidebar header: subtle frosted divider */
[data-sidebar="sidebar"] [data-slot="sidebar-header"] {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Sidebar footer: anchored dock effect */
[data-sidebar="sidebar"] [data-slot="sidebar-footer"] {
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0 0 var(--radius-lg, 0.5rem) var(--radius-lg, 0.5rem);
}

.dark [data-sidebar="sidebar"] [data-slot="sidebar-footer"] {
    background: rgba(0, 0, 0, 0.15);
}

/* Sidebar: custom scrollbar for branded gradient background */
[data-sidebar="content"]::-webkit-scrollbar {
    width: 4px;
}

[data-sidebar="content"]::-webkit-scrollbar-track {
    background: transparent;
}

[data-sidebar="content"]::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

[data-sidebar="content"]::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Print: hide sidebar and show only main content (checklist, reports, etc.) */
@media print {
    [data-slot="sidebar-wrapper"] > div:first-of-type {
        display: none !important;
    }
}

/* Training Matrix: ima_ind4 styles */
.training-matrix-container {
    position: relative;
    overflow-x: auto;
}

.training-matrix-table {
    position: relative;
    table-layout: fixed;
    width: 100%;
    min-width: 100%;
}

.training-matrix-table .sticky-column {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
    position: sticky;
    left: 0;
    z-index: 30;
    background: inherit;
}

.training-matrix-table thead .sticky-column {
    background: #2563eb;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

.training-matrix-table tbody .sticky-column {
    background: oklch(1 0 0);
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

.dark .training-matrix-table tbody .sticky-column {
    background: oklch(0.205 0 0);
}

.training-matrix-table th:not(.sticky-column),
.training-matrix-table td:not(.sticky-column) {
    width: auto;
    min-width: 30px;
    max-width: 40px;
}

.training-matrix-table thead th {
    position: sticky;
    top: 0;
    background: #2563eb;
    z-index: 20;
}

.training-matrix-rank-header {
    font-size: 10px;
    line-height: 1.1;
    font-weight: 600;
    height: 100px;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    transform: rotate(180deg);
    white-space: nowrap;
    vertical-align: bottom;
}

.training-matrix-table th,
.training-matrix-table td {
    border: 1px solid oklch(0.922 0 0);
}

.dark .training-matrix-table th,
.dark .training-matrix-table td {
    border-color: oklch(0.269 0 0);
}

.training-matrix-table thead th {
    border-color: #1d4ed8;
}

.training-matrix-table .sticky-column {
    border-right: 2px solid #1d4ed8;
}

.dark .training-matrix-table .sticky-column {
    border-right-color: #3b82f6;
}

.training-matrix-table tbody tr:hover {
    background-color: oklch(0.97 0 0);
}

.dark .training-matrix-table tbody tr:hover {
    background-color: oklch(0.269 0 0);
}

.training-matrix-table tbody tr:hover .sticky-column {
    background-color: oklch(0.96 0 0);
}

.dark .training-matrix-table tbody tr:hover .sticky-column {
    background-color: oklch(0.27 0 0);
}

.training-matrix-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.training-matrix-container::-webkit-scrollbar-track {
    background: oklch(0.97 0 0);
}

.training-matrix-container::-webkit-scrollbar-thumb {
    background: oklch(0.65 0.02 250);
    border-radius: 4px;
}

.training-matrix-container::-webkit-scrollbar-thumb:hover {
    background: oklch(0.5 0.02 250);
}

/* Training Matrix print: landscape, only the matrix table */
@page training-matrix {
    size: landscape;
}

@media print {
    body:has(#training-matrix-print-area) * {
        visibility: hidden;
    }
    body:has(#assessment-matrix-print-area) * {
        visibility: hidden;
    }
    body:has(#training-matrix-print-area) #training-matrix-print-area,
    body:has(#training-matrix-print-area) #training-matrix-print-area * {
        visibility: visible;
    }
    body:has(#assessment-matrix-print-area) #assessment-matrix-print-area,
    body:has(#assessment-matrix-print-area) #assessment-matrix-print-area * {
        visibility: visible;
    }
    body:has(#training-matrix-print-area) #training-matrix-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 0;
        page: training-matrix;
    }
    body:has(#assessment-matrix-print-area) #assessment-matrix-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 0;
        page: training-matrix;
    }
    body:has(#training-matrix-print-area) #training-matrix-print-area .print\:hidden {
        display: none !important;
    }
    body:has(#assessment-matrix-print-area) #assessment-matrix-print-area .print\:hidden {
        display: none !important;
    }
    body:has(#training-matrix-print-area) .training-matrix-required {
        background-color: #22c55e !important;
        color: white !important;
    }
    body:has(#assessment-matrix-print-area) .training-matrix-required {
        background-color: #22c55e !important;
        color: white !important;
    }
    body:has(#training-matrix-print-area) .training-matrix-optional {
        background-color: #ef4444 !important;
        color: white !important;
    }
    body:has(#assessment-matrix-print-area) .training-matrix-optional {
        background-color: #ef4444 !important;
        color: white !important;
    }
    body:has(#training-matrix-print-area) .training-matrix-na {
        background-color: #e5e7eb !important;
        color: #6b7280 !important;
    }
    body:has(#assessment-matrix-print-area) .training-matrix-na {
        background-color: #e5e7eb !important;
        color: #6b7280 !important;
    }
}

/* Exam protection: Disable text selection globally on exam pages */
.exam-protection-active {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* Re-enable selection for form inputs and textareas */
.exam-protection-active input,
.exam-protection-active textarea,
.exam-protection-active [contenteditable="true"],
.exam-protection-active [contenteditable=""] {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}
