@import "tailwindcss";

@import "tw-animate-css";

@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";

    --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(0.985 0.006 240);
    --foreground: oklch(0.23 0.035 250);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.23 0.035 250);
    --popover: oklch(1 0 0);
    --popover-foreground: oklch(0.23 0.035 250);
    --primary: oklch(0.58 0.22 255);
    --primary-foreground: oklch(1 0 0);
    --secondary: oklch(0.965 0.008 240);
    --secondary-foreground: oklch(0.25 0.03 250);
    --muted: oklch(0.965 0.008 240);
    --muted-foreground: oklch(0.52 0.025 250);
    --accent: oklch(0.95 0.025 240);
    --accent-foreground: oklch(0.26 0.04 250);
    --destructive: oklch(0.577 0.245 27.325);
    --destructive-foreground: oklch(0.577 0.245 27.325);
    --border: oklch(0.91 0.012 240);
    --input: oklch(0.91 0.012 240);
    --ring: oklch(0.72 0.12 255);
    --radius: 0.625rem;
    --sidebar: oklch(0.24 0.055 245);
    --sidebar-foreground: oklch(0.96 0.01 240);
    --sidebar-primary: oklch(0.58 0.22 255);
    --sidebar-primary-foreground: oklch(1 0 0);
    --sidebar-accent: oklch(0.3 0.055 245);
    --sidebar-accent-foreground: oklch(1 0 0);
    --sidebar-border: oklch(0.33 0.04 245);
    --sidebar-ring: oklch(0.58 0.22 255);
}

.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);
    --primary: oklch(0.985 0 0);
    --primary-foreground: oklch(0.205 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);
    --sidebar: oklch(0.205 0 0);
    --sidebar-foreground: oklch(0.985 0 0);
    --sidebar-primary: oklch(0.985 0 0);
    --sidebar-primary-foreground: oklch(0.985 0 0);
    --sidebar-accent: oklch(0.269 0 0);
    --sidebar-accent-foreground: oklch(0.985 0 0);
    --sidebar-border: oklch(0.269 0 0);
    --sidebar-ring: oklch(0.439 0 0);
}

@layer base {
    * {
        @apply border-border;
    }
    html {
        scroll-behavior: smooth;
    }
    body {
        @apply antialiased bg-[#f6f8fb] text-foreground;
    }
    ::selection {
        @apply bg-primary/15;
    }
    button,
    [role="button"],
    a,
    input,
    textarea,
    select {
        -webkit-tap-highlight-color: transparent;
    }
}

@layer utilities {
    .crm-page {
        @apply mx-auto w-full max-w-[1680px] space-y-6 p-4 md:p-6 lg:p-7;
    }
    .crm-section-title {
        @apply text-[15px] font-bold tracking-tight;
    }
    .crm-section-description {
        @apply text-xs text-muted-foreground;
    }
    .crm-surface {
        @apply rounded-2xl border border-border/70 bg-card shadow-[0_1px_2px_rgba(15,23,42,.03),0_8px_30px_rgba(15,23,42,.04)];
    }
    .crm-page-header {
        @apply flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between;
    }
    .crm-eyebrow {
        @apply text-[11px] font-bold uppercase tracking-[.16em] text-primary;
    }
    .crm-page-title {
        @apply text-2xl font-bold tracking-tight md:text-3xl;
    }
    .crm-page-description {
        @apply mt-1.5 max-w-2xl text-sm leading-6 text-muted-foreground;
    }

    /* Utility No Scrollbar Universal */
    .no-scrollbar,
    .salespro-sidebar-scroll {
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;
    }
    .no-scrollbar::-webkit-scrollbar,
    .salespro-sidebar-scroll::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
}

/* --------------------------------------------------------------------------
 * Global Sleek Scrollbar System
 * -------------------------------------------------------------------------- */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    border-radius: 9999px;
    background: rgba(148, 163, 184, 0.4);
    transition: background-color 0.2s ease;
}

*:hover::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.6);
}

*::-webkit-scrollbar-thumb:active {
    background: rgba(71, 85, 105, 0.8);
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

/* --------------------------------------------------------------------------
 * Sidebar & Card Customizations
 * -------------------------------------------------------------------------- */
[data-slot="sidebar"] {
    --sidebar-width: 248px;
    --sidebar-width-icon: 68px;
}

/* Menghilangkan scrollbar HANYA pada mode ikon / collapsed */
[data-state="collapsed"] [data-slot="sidebar-content"],
[data-collapsible="icon"][data-state="collapsed"]
    [data-slot="sidebar-content"] {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}

[data-state="collapsed"] [data-slot="sidebar-content"]::-webkit-scrollbar,
[data-collapsible="icon"][data-state="collapsed"]
    [data-slot="sidebar-content"]::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.group\/sidebar-wrapper {
    background: #f4f8fc;
}

[data-slot="sidebar-inner"] {
    background: #0f172a;
}

[data-slot="sidebar-menu-button"] {
    border-radius: 0.75rem;
    transition:
        background-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

[data-slot="sidebar-menu-button"]:hover {
    background: rgba(255, 255, 255, 0.07);
}

[data-slot="sidebar-menu-button"][data-active="true"] {
    background: linear-gradient(
        90deg,
        rgba(59, 130, 246, 0.25),
        rgba(59, 130, 246, 0.08)
    );
    box-shadow:
        inset 2px 0 0 rgb(59 130 246),
        0 0 16px -2px rgba(59, 130, 246, 0.4);
}

[data-slot="sidebar-menu-button"][data-active="true"] svg {
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.8));
    transform: scale(1.05);
    transition:
        transform 0.18s ease,
        filter 0.18s ease;
}

[data-slot="card"] {
    border-color: color-mix(in oklab, var(--border) 72%, transparent);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.025),
        0 8px 28px rgba(15, 23, 42, 0.035);
}

[data-slot="card-header"] {
    @apply gap-1.5;
}

[data-slot="card-title"] {
    @apply tracking-tight;
}

[data-slot="input"],
[data-slot="textarea"],
[data-slot="select-trigger"] {
    border-radius: 0.75rem;
}

[data-slot="input"]:focus-visible,
[data-slot="textarea"]:focus-visible,
[data-slot="select-trigger"]:focus-visible {
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 12%, transparent);
}

[data-slot="button"] {
    font-weight: 600;
}

.crm-dashboard {
    min-height: calc(100vh - 64px);
    background:
        radial-gradient(
            circle at 88% 0%,
            rgba(191, 219, 254, 0.25),
            transparent 26%
        ),
        linear-gradient(180deg, #f8fbff 0%, #f6f8fb 100%);
}

.crm-stat-card {
    border-radius: 1rem;
}

/* --------------------------------------------------------------------------
 * CRM Dark Mode Hardening
 * Keeps legacy CRM utility classes aligned with the shadcn design tokens.
 * -------------------------------------------------------------------------- */
.dark .crm-page .bg-white,
.dark .crm-page .bg-white\/95,
.dark .crm-page .bg-white\/90,
.dark .crm-page .bg-white\/80 {
    background-color: hsl(var(--card));
}

.dark .crm-page .bg-slate-50,
.dark .crm-page .bg-slate-50\/80,
.dark .crm-page .bg-slate-100,
.dark .crm-page .bg-slate-100\/70 {
    background-color: hsl(var(--muted));
}

.dark .crm-page .text-slate-900,
.dark .crm-page .text-slate-800,
.dark .crm-page .text-slate-700 {
    color: hsl(var(--foreground));
}

.dark .crm-page .text-slate-600,
.dark .crm-page .text-slate-500,
.dark .crm-page .text-slate-400 {
    color: hsl(var(--muted-foreground));
}

.dark .crm-page .border-slate-200,
.dark .crm-page .border-slate-200\/60,
.dark .crm-page .border-slate-200\/80,
.dark .crm-page .border-slate-100 {
    border-color: hsl(var(--border));
}

.dark .crm-dashboard {
    background:
        radial-gradient(
            circle at 88% 0%,
            hsl(var(--primary) / 0.08),
            transparent 26%
        ),
        linear-gradient(
            180deg,
            hsl(var(--background)) 0%,
            hsl(var(--background)) 100%
        );
}
