@import 'tailwindcss';

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

/* Theme is toggled by a class on <html>, not by the OS alone, so the in-app
   switch can override the system preference. */
@custom-variant dark (&:where(.dark, .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-mono: ui-monospace, 'JetBrains Mono', 'SFMono-Regular', 'Menlo', monospace;

    --color-brand-50: #eef2ff;
    --color-brand-100: #e0e7ff;
    --color-brand-200: #c7d2fe;
    --color-brand-300: #a5b4fc;
    --color-brand-400: #818cf8;
    --color-brand-500: #6366f1;
    --color-brand-600: #4f46e5;
    --color-brand-700: #4338ca;
    --color-brand-800: #3730a3;
    --color-brand-900: #312e81;
}

/* --------------------------------------------------------------------------
   Custom utilities
   Declared with @utility rather than inside @layer components, because in
   Tailwind 4 only real utilities can be composed with @apply by other rules.
   -------------------------------------------------------------------------- */

@utility tf-card {
    @apply rounded-xl border border-slate-200 bg-white shadow-sm dark:border-slate-800 dark:bg-slate-900;
}

@utility tf-input {
    @apply w-full rounded-lg border border-slate-300 bg-white px-3 py-2 text-sm text-slate-900 placeholder-slate-400
           outline-none transition focus:border-brand-500 focus:ring-2 focus:ring-brand-500/30
           disabled:cursor-not-allowed disabled:opacity-60
           dark:border-slate-700 dark:bg-slate-950 dark:text-slate-100 dark:placeholder-slate-500;
}

@utility tf-label {
    @apply mb-1.5 block text-sm font-medium text-slate-700 dark:text-slate-300;
}

@utility tf-btn {
    @apply inline-flex items-center justify-center gap-2 rounded-lg px-3.5 py-2 text-sm font-medium
           transition active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-60;
}

@utility tf-btn-primary {
    @apply tf-btn bg-brand-600 text-white shadow-sm hover:bg-brand-700;
}

@utility tf-btn-secondary {
    @apply tf-btn border border-slate-300 bg-white text-slate-700 hover:bg-slate-50
           dark:border-slate-700 dark:bg-slate-900 dark:text-slate-200 dark:hover:bg-slate-800;
}

@utility tf-btn-ghost {
    @apply tf-btn text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800;
}

@utility tf-btn-danger {
    @apply tf-btn bg-rose-600 text-white shadow-sm hover:bg-rose-700;
}

@utility tf-badge {
    @apply inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium;
}

@utility tf-th {
    @apply px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400;
}

@utility tf-td {
    @apply px-4 py-3 text-sm text-slate-700 dark:text-slate-300;
}

@utility tf-nav-link {
    @apply flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-slate-600 transition
           hover:bg-slate-100 hover:text-slate-900
           dark:text-slate-400 dark:hover:bg-slate-800 dark:hover:text-slate-100;
}

@utility tf-nav-link-active {
    @apply bg-brand-50 text-brand-700 hover:bg-brand-50 hover:text-brand-700
           dark:bg-brand-500/10 dark:text-brand-300 dark:hover:bg-brand-500/10 dark:hover:text-brand-300;
}

@layer base {
    html {
        -webkit-text-size-adjust: 100%;
    }

    body {
        @apply bg-slate-50 text-slate-900 antialiased dark:bg-slate-950 dark:text-slate-100;
    }

    /* Keep focus rings visible for keyboard users without ringing on every click. */
    :focus-visible {
        @apply outline-none ring-2 ring-brand-500 ring-offset-2 ring-offset-white dark:ring-offset-slate-950;
    }

    ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

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

    ::-webkit-scrollbar-thumb {
        @apply rounded-full bg-slate-300 dark:bg-slate-700;
    }

    ::-webkit-scrollbar-thumb:hover {
        @apply bg-slate-400 dark:bg-slate-600;
    }
}

/* Livewire swaps content in place; this keeps a pending request from looking frozen. */
[wire\:loading],
[wire\:loading\.delay] {
    display: none;
}

@keyframes tf-pop {
    0% {
        transform: scale(0.96);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.tf-pop {
    animation: tf-pop 0.15s ease-out;
}

@keyframes tf-flash {
    0% {
        background-color: color-mix(in oklab, var(--color-brand-500) 25%, transparent);
    }
    100% {
        background-color: transparent;
    }
}

/* Applied to a grid cell when a live scan updates it. */
.tf-flash {
    animation: tf-flash 1.2s ease-out;
}

/* --------------------------------------------------------------------------
   Print
   The designer works in millimetres and the print sheet must match it exactly,
   so page boxes and slot positions are both expressed in mm and every browser
   colour adjustment is switched off.
   -------------------------------------------------------------------------- */
@media print {
    .no-print {
        display: none !important;
    }

    html,
    body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .tf-sheet {
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
        page-break-after: always;
        break-after: page;
    }

    .tf-sheet:last-child {
        page-break-after: auto;
        break-after: auto;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}
