@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&display=swap") layer(base);

@import "tailwindcss";

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

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

@theme {
  --font-*: initial;
  --font-outfit: Outfit, sans-serif;

  --breakpoint-*: initial;
  --breakpoint-2xsm: 375px;
  --breakpoint-xsm: 425px;
  --breakpoint-3xl: 2000px;
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;

  --text-title-2xl: 72px;
  --text-title-2xl--line-height: 90px;
  --text-title-xl: 60px;
  --text-title-xl--line-height: 72px;
  --text-title-lg: 48px;
  --text-title-lg--line-height: 60px;
  --text-title-md: 36px;
  --text-title-md--line-height: 44px;
  --text-title-sm: 30px;
  --text-title-sm--line-height: 38px;
  --text-theme-xl: 20px;
  --text-theme-xl--line-height: 30px;
  --text-theme-sm: 14px;
  --text-theme-sm--line-height: 20px;
  --text-theme-xs: 12px;
  --text-theme-xs--line-height: 18px;

  --color-current: currentColor;
  --color-transparent: transparent;
  --color-white: #ffffff;
  --color-black: #101828;

  --color-brand-25: #f2f7ff;
  --color-brand-50: #ecf3ff;
  --color-brand-100: #dde9ff;
  --color-brand-200: #c2d6ff;
  --color-brand-300: #9cb9ff;
  --color-brand-400: #7592ff;
  --color-brand-500: #465fff;
  --color-brand-600: #3641f5;
  --color-brand-700: #2a31d8;
  --color-brand-800: #252dae;
  --color-brand-900: #262e89;
  --color-brand-950: #161950;

  --color-blue-light-25: #f5fbff;
  --color-blue-light-50: #f0f9ff;
  --color-blue-light-100: #e0f2fe;
  --color-blue-light-200: #b9e6fe;
  --color-blue-light-300: #7cd4fd;
  --color-blue-light-400: #36bffa;
  --color-blue-light-500: #0ba5ec;
  --color-blue-light-600: #0086c9;
  --color-blue-light-700: #026aa2;
  --color-blue-light-800: #065986;
  --color-blue-light-900: #0b4a6f;
  --color-blue-light-950: #062c41;

  --color-gray-25: #fcfcfd;
  --color-gray-50: #f9fafb;
  --color-gray-100: #f2f4f7;
  --color-gray-200: #e4e7ec;
  --color-gray-300: #d0d5dd;
  --color-gray-400: #98a2b3;
  --color-gray-500: #667085;
  --color-gray-600: #475467;
  --color-gray-700: #344054;
  --color-gray-800: #1d2939;
  --color-gray-900: #101828;
  --color-gray-950: #0c111d;
  --color-gray-dark: #1a2231;

  --color-orange-25: #fffaf5;
  --color-orange-50: #fff6ed;
  --color-orange-100: #ffead5;
  --color-orange-200: #fddcab;
  --color-orange-300: #feb273;
  --color-orange-400: #fd853a;
  --color-orange-500: #fb6514;
  --color-orange-600: #ec4a0a;
  --color-orange-700: #c4320a;
  --color-orange-800: #9c2a10;
  --color-orange-900: #7e2410;
  --color-orange-950: #511c10;

  --color-success-25: #f6fef9;
  --color-success-50: #ecfdf3;
  --color-success-100: #d1fadf;
  --color-success-200: #a6f4c5;
  --color-success-300: #6ce9a6;
  --color-success-400: #32d583;
  --color-success-500: #12b76a;
  --color-success-600: #039855;
  --color-success-700: #027a48;
  --color-success-800: #05603a;
  --color-success-900: #054f31;
  --color-success-950: #053321;

  --color-error-25: #fffbfa;
  --color-error-50: #fef3f2;
  --color-error-100: #fee4e2;
  --color-error-200: #fecdca;
  --color-error-300: #fda29b;
  --color-error-400: #f97066;
  --color-error-500: #f04438;
  --color-error-600: #d92d20;
  --color-error-700: #b42318;
  --color-error-800: #912018;
  --color-error-900: #7a271a;
  --color-error-950: #55160c;

  --color-warning-25: #fffcf5;
  --color-warning-50: #fffaeb;
  --color-warning-100: #fef0c7;
  --color-warning-200: #fedf89;
  --color-warning-300: #fec84b;
  --color-warning-400: #fdb022;
  --color-warning-500: #f79009;
  --color-warning-600: #dc6803;
  --color-warning-700: #b54708;
  --color-warning-800: #93370d;
  --color-warning-900: #7a2e0e;
  --color-warning-950: #4e1d09;

  --color-theme-pink-500: #ee46bc;
  --color-theme-purple-500: #7a5af8;

  --shadow-theme-md: 0px 4px 8px -2px rgba(16, 24, 40, 0.1), 0px 2px 4px -2px rgba(16, 24, 40, 0.06);
  --shadow-theme-lg: 0px 12px 16px -4px rgba(16, 24, 40, 0.08), 0px 4px 6px -2px rgba(16, 24, 40, 0.03);
  --shadow-theme-sm: 0px 1px 3px 0px rgba(16, 24, 40, 0.1), 0px 1px 2px 0px rgba(16, 24, 40, 0.06);
  --shadow-theme-xs: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
  --shadow-theme-xl: 0px 20px 24px -4px rgba(16, 24, 40, 0.08), 0px 8px 8px -4px rgba(16, 24, 40, 0.03);
  --shadow-focus-ring: 0px 0px 0px 4px rgba(70, 95, 255, 0.12);

  --z-index-1: 1;
  --z-index-9: 9;
  --z-index-99: 99;
  --z-index-999: 999;
  --z-index-9999: 9999;
  --z-index-99999: 99999;
  --z-index-999999: 999999;
}

@layer base {
  *,
  ::after,
  ::before,
  ::backdrop,
  ::file-selector-button {
    border-color: var(--color-gray-200, currentColor);
  }
  button:not(:disabled),
  [role="button"]:not(:disabled) {
    cursor: pointer;
  }
  body {
    @apply font-outfit relative bg-gray-50 text-base font-normal text-gray-800 dark:bg-gray-900 dark:text-gray-300;
  }
}

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

/* ===== MENU UTILITIES ===== */
@utility menu-item {
  @apply text-theme-sm relative flex items-center gap-3 rounded-lg px-3 py-2 font-medium;
}
@utility menu-item-active {
  @apply bg-brand-50 text-brand-500 dark:bg-brand-500/[0.12] dark:text-brand-400;
}
@utility menu-item-inactive {
  @apply text-gray-700 hover:bg-gray-100 hover:text-gray-700 dark:text-gray-300 dark:hover:bg-white/5 dark:hover:text-gray-300;
}
@utility menu-item-icon-active {
  @apply fill-brand-500 dark:fill-brand-400;
}
@utility menu-item-icon-inactive {
  @apply fill-gray-500 group-hover:fill-gray-700 dark:fill-gray-400 dark:group-hover:fill-gray-300;
}
@utility menu-item-arrow {
  @apply absolute top-1/2 right-2.5 -translate-y-1/2;
}
@utility menu-item-arrow-active {
  @apply stroke-brand-500 dark:stroke-brand-400 rotate-180;
}
@utility menu-item-arrow-inactive {
  @apply stroke-gray-500 group-hover:stroke-gray-700 dark:stroke-gray-400 dark:group-hover:stroke-gray-300;
}
@utility menu-dropdown-item {
  @apply text-theme-sm relative flex items-center gap-3 rounded-lg px-3 py-2.5 font-medium;
}
@utility menu-dropdown-item-active {
  @apply bg-brand-50 text-brand-500 dark:bg-brand-500/[0.12] dark:text-brand-400;
}
@utility menu-dropdown-item-inactive {
  @apply text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-white/5;
}

/* ===== SCROLLBAR ===== */
@utility no-scrollbar {
  &::-webkit-scrollbar { display: none; }
  -ms-overflow-style: none;
  scrollbar-width: none;
}
@utility custom-scrollbar {
  &::-webkit-scrollbar { @apply size-1.5; }
  &::-webkit-scrollbar-track { @apply rounded-full; }
  &::-webkit-scrollbar-thumb { @apply rounded-full bg-gray-200; }
}

/* ===== SIDEBAR COLLAPSE HOVER ===== */
.sidebar:hover { width: 290px; }
.sidebar:hover .logo { display: block; }
.sidebar:hover .logo-icon { display: none; }
.sidebar:hover .sidebar-header { justify-content: space-between; }
.sidebar:hover .menu-group-title { display: block; }
.sidebar:hover .menu-group-icon { display: none; }
.sidebar:hover .menu-item-text { display: inline; }
.sidebar:hover .menu-item-arrow { display: block; }
.sidebar:hover .menu-dropdown { display: flex; }

/* ===== FORM INPUTS ===== */
.form-input {
  @apply h-11 w-full rounded-lg border border-gray-300 bg-white px-4 py-2.5 text-sm text-gray-800 shadow-theme-xs placeholder:text-gray-400 focus:border-brand-300 focus:outline-none focus:ring-3 focus:ring-brand-500/10 dark:border-gray-700 dark:bg-gray-900 dark:text-white/90 dark:placeholder:text-white/30 dark:focus:border-brand-800;
}
.form-select {
  @apply h-11 w-full rounded-lg border border-gray-300 bg-white px-4 py-2.5 text-sm text-gray-800 shadow-theme-xs focus:border-brand-300 focus:outline-none focus:ring-3 focus:ring-brand-500/10 dark:border-gray-700 dark:bg-gray-900 dark:text-white/90;
}
.form-label {
  @apply mb-1.5 block text-sm font-medium text-gray-700 dark:text-gray-400;
}
.form-textarea {
  @apply w-full rounded-lg border border-gray-300 bg-white px-4 py-2.5 text-sm text-gray-800 shadow-theme-xs placeholder:text-gray-400 focus:border-brand-300 focus:outline-none focus:ring-3 focus:ring-brand-500/10 dark:border-gray-700 dark:bg-gray-900 dark:text-white/90;
}

/* ===== CARDS ===== */
.card {
  @apply rounded-2xl border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900;
}

/* ===== BADGES ===== */
.badge {
  @apply inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium;
}
.badge-success  { @apply bg-success-50 text-success-700 dark:bg-success-500/10 dark:text-success-400; }
.badge-error    { @apply bg-error-50 text-error-700 dark:bg-error-500/10 dark:text-error-400; }
.badge-warning  { @apply bg-warning-50 text-warning-700 dark:bg-warning-500/10 dark:text-warning-400; }
.badge-info     { @apply bg-blue-light-50 text-blue-light-700 dark:bg-blue-light-500/10 dark:text-blue-light-400; }
.badge-brand    { @apply bg-brand-50 text-brand-700 dark:bg-brand-500/10 dark:text-brand-400; }
.badge-gray     { @apply bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400; }
.badge-dark     { @apply bg-gray-800 text-white dark:bg-gray-700; }

/* ===== BUTTONS ===== */
.btn {
  @apply inline-flex items-center justify-center gap-2 rounded-lg px-4 py-2.5 text-sm font-medium transition-colors;
}
.btn-primary  { @apply bg-brand-500 text-white hover:bg-brand-600 shadow-theme-xs; }
.btn-secondary { @apply border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 shadow-theme-xs dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300; }
.btn-danger   { @apply bg-error-500 text-white hover:bg-error-600 shadow-theme-xs; }
.btn-success  { @apply bg-success-500 text-white hover:bg-success-600 shadow-theme-xs; }
.btn-sm       { @apply px-3 py-1.5 text-xs; }
.btn-icon     { @apply flex size-9 items-center justify-center rounded-lg border border-gray-200 bg-white text-gray-500 hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400; }

/* ===== TABLE ===== */
.table-wrapper {
  @apply overflow-hidden rounded-2xl border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900;
}

/* ===== ALERT ===== */
.alert-success { @apply rounded-xl border border-success-200 bg-success-50 p-4 text-success-700 dark:border-success-700/30 dark:bg-success-500/10 dark:text-success-400; }
.alert-error   { @apply rounded-xl border border-error-200 bg-error-50 p-4 text-error-700 dark:border-error-700/30 dark:bg-error-500/10 dark:text-error-400; }
.alert-warning { @apply rounded-xl border border-warning-200 bg-warning-50 p-4 text-warning-700 dark:border-warning-700/30 dark:bg-warning-500/10 dark:text-warning-400; }
.alert-info    { @apply rounded-xl border border-blue-light-200 bg-blue-light-50 p-4 text-blue-light-700 dark:border-blue-light-700/30 dark:bg-blue-light-500/10 dark:text-blue-light-400; }

/* ===== PAGINATION ===== */
.pagination { @apply flex flex-wrap items-center gap-2; }
.page-link {
  @apply flex h-9 min-w-9 items-center justify-center rounded-lg border border-gray-200 px-3 text-sm font-medium text-gray-700 hover:bg-gray-50 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800;
}
.page-link-active {
  @apply border-brand-500 bg-brand-500 text-white hover:bg-brand-600 dark:border-brand-500 dark:bg-brand-500;
}

/* ===== REMOVE DATE ICON ===== */
@layer utilities {
  input[type="date"]::-webkit-inner-spin-button,
  input[type="time"]::-webkit-inner-spin-button,
  input[type="date"]::-webkit-calendar-picker-indicator,
  input[type="time"]::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
  }
}

/* ===== PAGINATION OVERRIDE (Laravel) ===== */
nav[aria-label="Pagination Navigation"] {
  @apply flex items-center gap-1;
}
nav[aria-label="Pagination Navigation"] span[aria-current="page"] span,
nav[aria-label="Pagination Navigation"] span[aria-disabled] span {
  @apply flex h-9 min-w-9 items-center justify-center rounded-lg border px-3 text-sm font-medium;
}
nav[aria-label="Pagination Navigation"] span[aria-current="page"] span {
  @apply border-brand-500 bg-brand-500 text-white;
}
nav[aria-label="Pagination Navigation"] span[aria-disabled] span {
  @apply border-gray-200 bg-white text-gray-400 dark:border-gray-700 dark:bg-gray-900;
}
nav[aria-label="Pagination Navigation"] a {
  @apply flex h-9 min-w-9 items-center justify-center rounded-lg border border-gray-200 px-3 text-sm font-medium text-gray-700 hover:bg-gray-50 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800;
}

/* ===== DATATABLE ===== */
.dt-wrapper {
  @apply overflow-hidden rounded-xl border border-gray-200 bg-white dark:border-gray-800 dark:bg-white/[0.03];
}

.dt-header {
  @apply flex flex-col gap-3 px-5 py-4 lg:flex-row lg:items-center lg:justify-between sm:px-6;
}

.dt-title {
  @apply text-base font-medium text-gray-800 dark:text-white/90;
}

/* Root cause fix: was sm:flex-row which caused 4+ elements to fight for space at 640px.
   Now stacks until lg (1024px) where there's enough room for all toolbar items. */
.dt-toolbar {
  @apply flex flex-col gap-2 lg:flex-row lg:items-center lg:flex-wrap;
}

/* Show entries dropdown */
.dt-show {
  @apply flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400;
}
.dt-show select {
  @apply rounded-lg border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-700 shadow-theme-xs focus:border-brand-300 focus:outline-none focus:ring-2 focus:ring-brand-500/10 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300;
}

/* Search input — full width on mobile, fixed on desktop */
.dt-search {
  @apply relative;
}
.dt-search svg {
  @apply absolute left-3 top-1/2 -translate-y-1/2 fill-gray-400 dark:fill-gray-500;
}
.dt-search input {
  @apply h-10 w-full rounded-lg border border-gray-300 bg-white py-2 pl-9 pr-4 text-sm text-gray-700 shadow-theme-xs placeholder:text-gray-400 focus:border-brand-300 focus:outline-none focus:ring-2 focus:ring-brand-500/10 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 dark:placeholder:text-gray-500 lg:w-52;
}

/* Table */
.dt-table {
  @apply min-w-full;
}
.dt-table thead tr {
  @apply border-b border-gray-100 dark:border-gray-800;
}
.dt-table thead th {
  @apply px-5 py-3 sm:px-6;
}
.dt-table thead th .th-inner {
  @apply flex items-center gap-1;
}
.dt-table thead th p {
  @apply font-medium text-gray-500 text-theme-xs dark:text-gray-400;
}
.dt-table tbody {
  @apply divide-y divide-gray-100 dark:divide-gray-800;
}
.dt-table tbody tr {
  @apply transition-colors hover:bg-gray-50 dark:hover:bg-white/[0.02];
}
.dt-table tbody td {
  @apply px-5 py-4 text-sm text-gray-500 sm:px-6 dark:text-gray-400;
}
.dt-table tbody td .td-main {
  @apply font-medium text-gray-800 text-theme-sm dark:text-white/90;
}
.dt-table tbody td .td-sub {
  @apply text-gray-500 text-theme-xs dark:text-gray-400;
}

/* Sort icon */
.sort-icon {
  @apply fill-gray-400 dark:fill-gray-500 shrink-0;
}

/* Action buttons */
.dt-action {
  @apply flex items-center gap-2;
}
.dt-btn-edit {
  @apply flex h-8 w-8 items-center justify-center rounded-lg border border-gray-200 bg-white text-gray-500 shadow-theme-xs hover:bg-gray-50 hover:text-brand-500 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-brand-400;
}
.dt-btn-delete {
  @apply flex h-8 w-8 items-center justify-center rounded-lg border border-gray-200 bg-white text-gray-500 shadow-theme-xs hover:bg-error-50 hover:text-error-500 hover:border-error-200 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-error-500/10 dark:hover:text-error-400;
}
.dt-btn-view {
  @apply flex h-8 w-8 items-center justify-center rounded-lg border border-gray-200 bg-white text-gray-500 shadow-theme-xs hover:bg-brand-50 hover:text-brand-500 hover:border-brand-200 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400;
}

/* Footer / pagination */
.dt-footer {
  @apply flex flex-col gap-3 border-t border-gray-100 px-5 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6 dark:border-gray-800;
}
.dt-info {
  @apply text-sm text-gray-500 dark:text-gray-400;
}
.dt-pagination {
  @apply flex flex-wrap items-center gap-1;
}
.dt-pagination a,
.dt-pagination span {
  @apply flex h-9 min-w-9 items-center justify-center rounded-lg border border-gray-200 bg-white px-3.5 text-sm font-medium text-gray-700 hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700;
}
.dt-pagination span[aria-current="page"] span,
.dt-pagination .page-active {
  @apply border-brand-500 bg-brand-500 text-white hover:bg-brand-600 dark:border-brand-500 dark:bg-brand-500 dark:text-white;
}
.dt-pagination span[aria-disabled] span {
  @apply border-gray-200 bg-white text-gray-400 cursor-not-allowed dark:border-gray-700 dark:bg-gray-800;
}

/* Empty state inside table */
.dt-empty {
  @apply flex flex-col items-center justify-center py-16 text-center;
}
.dt-empty-icon {
  @apply mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800;
}
