@import 'tailwindcss';
@import '../../vendor/livewire/flux/dist/flux.css';

@source '../views';
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../vendor/livewire/flux-pro/stubs/**/*.blade.php';
@source '../../vendor/livewire/flux/stubs/**/*.blade.php';

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

    --color-zinc-50: #fafafa;
    --color-zinc-100: #f5f5f5;
    --color-zinc-200: #e5e5e5;
    --color-zinc-300: #d4d4d4;
    --color-zinc-400: #a3a3a3;
    --color-zinc-500: #737373;
    --color-zinc-600: #525252;
    --color-zinc-700: #404040;
    --color-zinc-800: #262626;
    --color-zinc-900: #171717;
    --color-zinc-950: #0a0a0a;

    --color-accent: var(--color-neutral-800);
    --color-accent-content: var(--color-neutral-800);
    --color-accent-foreground: var(--color-white);
}

@layer base {

    *,
    ::after,
    ::before,
    ::backdrop,
    ::file-selector-button {
        border-color: var(--color-gray-200, currentColor);
    }

    /* Ensure all text is visible - force dark text on light backgrounds */
    [data-flux-heading],
    [data-flux-subheading],
    [data-flux-text],
    [data-flux-label] {
        color: #1f2937 !important;
    }

    [data-flux-label] {
        font-size: 0.875rem !important;
        /* 14px */
        font-weight: 500 !important;
        color: #374151 !important;
    }

    [data-flux-subheading] {
        color: #6b7280 !important;
    }
}

[data-flux-field]:not(ui-radio, ui-checkbox) {
    @apply grid gap-2;
}

[data-flux-label] {
    @apply !mb-0 !leading-tight;
}

input:focus[data-flux-control],
textarea:focus[data-flux-control],
select:focus[data-flux-control] {
    @apply outline-hidden ring-2 ring-accent ring-offset-2 ring-offset-accent-foreground;
}

/* \[:where(&)\]:size-4 {
    @apply size-4;
} */

/* ============================================
   CUSTOM FORM FIELD IMPROVEMENTS
   ============================================ */

/* Improve select and input field visibility with clear borders */
select[data-flux-control],
input[data-flux-control],
textarea[data-flux-control] {
    @apply border-2 border-zinc-300 bg-white text-zinc-900;
    @apply transition-all duration-200;
    font-size: 0.9375rem !important;
    /* 15px */
    padding: 0.625rem 0.875rem !important;
    /* Better padding */
}

select[data-flux-control]:hover,
input[data-flux-control]:hover,
textarea[data-flux-control]:hover {
    @apply border-zinc-400;
}

select[data-flux-control]:focus,
input[data-flux-control]:focus,
textarea[data-flux-control]:focus {
    @apply border-orange-500 ring-2 ring-orange-200;
}

/* Fix dropdown menu backgrounds - force light theme */
select[data-flux-control] option {
    background-color: white !important;
    color: #18181b !important;
}

/* Ensure dropdown menus have light backgrounds */
[data-flux-menu],
[data-flux-dropdown] {
    background-color: white !important;
    border: 1px solid #e4e4e7 !important;
}

[data-flux-menu-item],
[data-flux-dropdown-item] {
    color: #18181b !important;
}

[data-flux-menu-item]:hover,
[data-flux-dropdown-item]:hover {
    background-color: #f4f4f5 !important;
}

/* Date input improvements - make entire field clickable */
input[type="date"][data-flux-control] {
    @apply cursor-pointer relative;
    min-height: 42px;
    padding-right: 2.5rem;
}

/* Style the calendar icon */
input[type="date"][data-flux-control]::-webkit-calendar-picker-indicator {
    @apply cursor-pointer;
    position: absolute;
    right: 0.75rem;
    width: 1.25rem;
    height: 1.25rem;
    opacity: 0.6;
}

input[type="date"][data-flux-control]:hover::-webkit-calendar-picker-indicator {
    opacity: 1;
}

/* Flux UI Date Picker custom styling */

/* Job status badge improvements */
[data-flux-badge] {
    @apply font-semibold;
    min-width: 80px;
    text-align: center;
}

/* Custom badge colors for better visibility */
.badge-waiting {
    @apply bg-sky-100 text-sky-800 border border-sky-300;
}

.badge-pending {
    @apply bg-yellow-100 text-yellow-800 border border-yellow-300;
}

.badge-running {
    @apply bg-blue-100 text-blue-800 border border-blue-300;
}

.badge-completed {
    @apply bg-green-100 text-green-800 border border-green-300;
}

.badge-failed {
    @apply bg-red-100 text-red-800 border border-red-300;
}

/* ============================================
   FLUX BUTTON VISIBILITY FIXES
   ============================================ */

/* Primary buttons - Orange theme */
button[data-flux-button][data-variant="primary"],
button[data-flux-button][data-variant="primary"] span,
button[data-flux-button][data-variant="primary"] svg {
    background-color: #f97316 !important;
    color: white !important;
}

button[data-flux-button][data-variant="primary"]:hover {
    background-color: #ea580c !important;
}

/* Ensure ghost buttons are visible - Orange theme */
button[data-flux-button][data-variant="ghost"],
button[data-flux-button][data-variant="ghost"] *,
button[data-flux-button][data-variant="ghost"] span,
button[data-flux-button][data-variant="ghost"] svg {
    color: #f97316 !important;
}

button[data-flux-button][data-variant="ghost"] {
    background-color: transparent !important;
}

button[data-flux-button][data-variant="ghost"]:hover {
    background-color: #ffedd5 !important;
}

button[data-flux-button][data-variant="ghost"]:hover *,
button[data-flux-button][data-variant="ghost"]:hover span,
button[data-flux-button][data-variant="ghost"]:hover svg {
    color: #ea580c !important;
}

/* Ensure danger buttons are visible */
button[data-flux-button][data-variant="danger"],
button[data-flux-button][data-variant="danger"] span {
    background-color: #ef4444 !important;
    color: white !important;
}

button[data-flux-button][data-variant="danger"]:hover {
    background-color: #dc2626 !important;
}

/* ============================================
   SIDEBAR USERNAME VISIBILITY
   ============================================ */

/* Ensure username and email are visible in sidebar */
[data-flux-dropdown] .truncate {
    color: #18181b !important;
}

[data-flux-dropdown] .text-xs {
    color: #71717a !important;
}

/* ============================================
   SELECT2 INTEGRATION STYLING
   ============================================ */

/* Select2 container styling */
.select2-container--default .select2-selection--single {
    @apply border-2 border-zinc-300 bg-white text-zinc-900;
    @apply rounded-lg px-3 py-2 transition-all duration-200;
    min-height: 42px;
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--single:hover {
    @apply border-zinc-400;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    @apply border-orange-500 ring-2 ring-orange-200;
    outline: none;
}

/* Select2 dropdown styling */
.select2-container--default .select2-dropdown {
    background-color: white !important;
    border: 2px solid #e4e4e7 !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

.select2-container--default .select2-results__option {
    color: #18181b !important;
    padding: 0.5rem 1rem !important;
}

.select2-container--default .select2-results__option--highlighted {
    background-color: #f4f4f5 !important;
    color: #18181b !important;
}

.select2-container--default .select2-results__option--selected {
    background-color: #ffedd5 !important;
    color: #ea580c !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    @apply border-2 border-zinc-300 rounded-lg px-3 py-2;
    color: #18181b !important;
}

/* Select2 arrow */
.select2-container--default .select2-selection__arrow {
    height: 100% !important;
    right: 0.75rem !important;
}

.select2-container--default .select2-selection__rendered {
    color: #18181b !important;
    line-height: normal !important;
    padding: 0 !important;
}

/* ============================================
   SIDEBAR LINK VISIBILITY FIXES
   ============================================ */

/* Force sidebar navigation links to be dark */
[data-flux-navlist-item],
[data-flux-navlist-item] button,
[data-flux-navlist-item] a {
    color: #18181b !important;
    /* zinc-900 */
}

[data-flux-navlist-item]:hover,
[data-flux-navlist-item] button:hover,
[data-flux-navlist-item] a:hover {
    background-color: #f4f4f5 !important;
    /* zinc-100 */
    color: #000000 !important;
}

/* Fix icons in sidebar */
[data-flux-navlist-item] [data-flux-icon] {
    color: #52525b !important;
    /* zinc-600 */
}

/* Active state */
[data-flux-navlist-item][data-current="true"] {
    background-color: #f4f4f5 !important;
    color: #18181b !important;
}

/* Ensure subheadings in navlist are visible */
[data-flux-navlist-group-heading] {
    color: #71717a !important;
    /* zinc-500 */
}