/* Define cascade layers in order of priority (lowest to highest) */
@layer third-party, tailwind-base, tailwind-components, tailwind-utilities, overrides;

/* Import third-party libraries into their layer */
@layer third-party {
    /* MudBlazor, Radzen, and Syncfusion styles are loaded here via index.html */
}

/* Tailwind layers are handled by the compiled site.css */

/* Critical overrides with highest priority */
@layer overrides {
    /* Force Tailwind utilities to win over third-party libraries */
    
    /* Background colors - specific Tailwind utilities */
    .bg-white { background-color: #ffffff !important; }
    .bg-black { background-color: #000000 !important; }
    .bg-transparent { background-color: transparent !important; }
    
    /* Gray scale */
    .bg-gray-50 { background-color: rgb(249 250 251) !important; }
    .bg-gray-100 { background-color: rgb(243 244 246) !important; }
    .bg-gray-200 { background-color: rgb(229 231 235) !important; }
    .bg-gray-300 { background-color: rgb(209 213 219) !important; }
    .bg-gray-400 { background-color: rgb(156 163 175) !important; }
    .bg-gray-500 { background-color: rgb(107 114 128) !important; }
    .bg-gray-600 { background-color: rgb(75 85 99) !important; }
    .bg-gray-700 { background-color: rgb(55 65 81) !important; }
    .bg-gray-800 { background-color: rgb(31 41 55) !important; }
    .bg-gray-900 { background-color: rgb(17 24 39) !important; }
    
    /* Blue scale */
    .bg-blue-50 { background-color: rgb(239 246 255) !important; }
    .bg-blue-100 { background-color: rgb(219 234 254) !important; }
    .bg-blue-200 { background-color: rgb(191 219 254) !important; }
    .bg-blue-300 { background-color: rgb(147 197 253) !important; }
    .bg-blue-400 { background-color: rgb(96 165 250) !important; }
    .bg-blue-500 { background-color: rgb(59 130 246) !important; }
    .bg-blue-600 { background-color: rgb(37 99 235) !important; }
    .bg-blue-700 { background-color: rgb(29 78 216) !important; }
    .bg-blue-800 { background-color: rgb(30 64 175) !important; }
    .bg-blue-900 { background-color: rgb(30 58 138) !important; }
    
    /* Other colors */
    .bg-green-500 { background-color: rgb(34 197 94) !important; }
    .bg-red-500 { background-color: rgb(239 68 68) !important; }
    .bg-yellow-50 { background-color: rgb(254 252 232) !important; }
    .bg-yellow-100 { background-color: rgb(254 249 195) !important; }
    .bg-yellow-400 { background-color: rgb(250 204 21) !important; }
    
    /* Text colors */
    .text-white { color: #ffffff !important; }
    .text-black { color: #000000 !important; }
    .text-gray-500 { color: rgb(107 114 128) !important; }
    .text-gray-600 { color: rgb(75 85 99) !important; }
    .text-gray-700 { color: rgb(55 65 81) !important; }
    .text-gray-800 { color: rgb(31 41 55) !important; }
    .text-gray-900 { color: rgb(17 24 39) !important; }
    .text-blue-500 { color: rgb(59 130 246) !important; }
    .text-blue-600 { color: rgb(37 99 235) !important; }
    .text-blue-700 { color: rgb(29 78 216) !important; }
    .text-blue-800 { color: rgb(30 64 175) !important; }
    .text-red-500 { color: rgb(239 68 68) !important; }
    .text-red-600 { color: rgb(220 38 38) !important; }
    .text-green-500 { color: rgb(34 197 94) !important; }
    .text-green-600 { color: rgb(22 163 74) !important; }
    .text-yellow-600 { color: rgb(202 138 4) !important; }
    .text-yellow-700 { color: rgb(161 98 7) !important; }
    .text-yellow-800 { color: rgb(133 77 14) !important; }
    
    /* Border colors */
    .border-gray-200 { border-color: rgb(229 231 235) !important; }
    .border-gray-300 { border-color: rgb(209 213 219) !important; }
    .border-gray-400 { border-color: rgb(156 163 175) !important; }
    .border-gray-500 { border-color: rgb(107 114 128) !important; }
    .border-blue-400 { border-color: rgb(96 165 250) !important; }
    .border-blue-500 { border-color: rgb(59 130 246) !important; }
    .border-yellow-400 { border-color: rgb(250 204 21) !important; }
    
    /* Border widths */
    .border { border-width: 1px !important; }
    .border-2 { border-width: 2px !important; }
    .border-4 { border-width: 4px !important; }
    .border-t { border-top-width: 1px !important; }
    .border-b { border-bottom-width: 1px !important; }
    .border-l { border-left-width: 1px !important; }
    .border-r { border-right-width: 1px !important; }
    
    /* Border radius */
    .rounded-none { border-radius: 0 !important; }
    .rounded-sm { border-radius: 0.125rem !important; }
    .rounded { border-radius: 0.25rem !important; }
    .rounded-md { border-radius: 0.375rem !important; }
    .rounded-lg { border-radius: 0.5rem !important; }
    .rounded-xl { border-radius: 0.75rem !important; }
    .rounded-2xl { border-radius: 1rem !important; }
    .rounded-full { border-radius: 9999px !important; }
    
    /* Padding */
    .p-0 { padding: 0 !important; }
    .p-1 { padding: 0.25rem !important; }
    .p-2 { padding: 0.5rem !important; }
    .p-3 { padding: 0.75rem !important; }
    .p-4 { padding: 1rem !important; }
    .p-5 { padding: 1.25rem !important; }
    .p-6 { padding: 1.5rem !important; }
    .p-8 { padding: 2rem !important; }
    .px-0 { padding-left: 0 !important; padding-right: 0 !important; }
    .px-1 { padding-left: 0.25rem !important; padding-right: 0.25rem !important; }
    .px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
    .px-3 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
    .px-4 { padding-left: 1rem !important; padding-right: 1rem !important; }
    .px-6 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
    .py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
    .py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
    .py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
    .py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
    .py-4 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
    .py-6 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
    .py-8 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    
    /* Margin */
    .m-0 { margin: 0 !important; }
    .m-1 { margin: 0.25rem !important; }
    .m-2 { margin: 0.5rem !important; }
    .m-4 { margin: 1rem !important; }
    .mx-auto { margin-left: auto !important; margin-right: auto !important; }
    .my-2 { margin-top: 0.5rem !important; margin-bottom: 0.5rem !important; }
    .my-4 { margin-top: 1rem !important; margin-bottom: 1rem !important; }
    .mb-2 { margin-bottom: 0.5rem !important; }
    .mb-4 { margin-bottom: 1rem !important; }
    .mt-2 { margin-top: 0.5rem !important; }
    .mt-4 { margin-top: 1rem !important; }
    
    /* Text size */
    .text-xs { font-size: 0.75rem !important; line-height: 1rem !important; }
    .text-sm { font-size: 0.875rem !important; line-height: 1.25rem !important; }
    .text-base { font-size: 1rem !important; line-height: 1.5rem !important; }
    .text-lg { font-size: 1.125rem !important; line-height: 1.75rem !important; }
    .text-xl { font-size: 1.25rem !important; line-height: 1.75rem !important; }
    .text-2xl { font-size: 1.5rem !important; line-height: 2rem !important; }
    .text-3xl { font-size: 1.875rem !important; line-height: 2.25rem !important; }
    .text-4xl { font-size: 2.25rem !important; line-height: 2.5rem !important; }
    
    /* Font weight */
    .font-thin { font-weight: 100 !important; }
    .font-light { font-weight: 300 !important; }
    .font-normal { font-weight: 400 !important; }
    .font-medium { font-weight: 500 !important; }
    .font-semibold { font-weight: 600 !important; }
    .font-bold { font-weight: 700 !important; }
    .font-extrabold { font-weight: 800 !important; }
    
    /* Display */
    .block { display: block !important; }
    .inline-block { display: inline-block !important; }
    .inline { display: inline !important; }
    .flex { display: flex !important; }
    .inline-flex { display: inline-flex !important; }
    .grid { display: grid !important; }
    .hidden { display: none !important; }
    
    /* Flexbox */
    .flex-row { flex-direction: row !important; }
    .flex-col { flex-direction: column !important; }
    .items-center { align-items: center !important; }
    .items-start { align-items: flex-start !important; }
    .justify-center { justify-content: center !important; }
    .justify-between { justify-content: space-between !important; }
    .justify-start { justify-content: flex-start !important; }
    .justify-end { justify-content: flex-end !important; }
    .gap-2 { gap: 0.5rem !important; }
    .gap-4 { gap: 1rem !important; }
    
    /* Width and Height */
    .w-full { width: 100% !important; }
    .w-auto { width: auto !important; }
    .w-1\/2 { width: 50% !important; }
    .h-full { height: 100% !important; }
    .h-auto { height: auto !important; }
    .h-screen { height: 100vh !important; }
    .max-w-none { max-width: none !important; }
    .max-w-sm { max-width: 24rem !important; }
    .max-w-md { max-width: 28rem !important; }
    .max-w-lg { max-width: 32rem !important; }
    .max-w-xl { max-width: 36rem !important; }
    .max-w-2xl { max-width: 42rem !important; }
    .max-w-3xl { max-width: 48rem !important; }
    .max-w-4xl { max-width: 56rem !important; }
    .max-w-5xl { max-width: 64rem !important; }
    .max-w-6xl { max-width: 72rem !important; }
    
    /* Overflow */
    .overflow-auto { overflow: auto !important; }
    .overflow-hidden { overflow: hidden !important; }
    .overflow-visible { overflow: visible !important; }
    .overflow-x-auto { overflow-x: auto !important; }
    .overflow-y-auto { overflow-y: auto !important; }
    
    /* Position */
    .static { position: static !important; }
    .fixed { position: fixed !important; }
    .absolute { position: absolute !important; }
    .relative { position: relative !important; }
    .sticky { position: sticky !important; }
    
    /* Z-index */
    .z-0 { z-index: 0 !important; }
    .z-10 { z-index: 10 !important; }
    .z-20 { z-index: 20 !important; }
    .z-30 { z-index: 30 !important; }
    .z-40 { z-index: 40 !important; }
    .z-50 { z-index: 50 !important; }
    
    /* Cursor */
    .cursor-pointer { cursor: pointer !important; }
    .cursor-not-allowed { cursor: not-allowed !important; }
    
    /* Text decoration */
    .underline { text-decoration: underline !important; }
    .no-underline { text-decoration: none !important; }
    .hover\:underline:hover { text-decoration: underline !important; }
    
    /* Hover states */
    .hover\:bg-gray-50:hover { background-color: rgb(249 250 251) !important; }
    .hover\:bg-gray-100:hover { background-color: rgb(243 244 246) !important; }
    .hover\:bg-blue-50:hover { background-color: rgb(239 246 255) !important; }
    .hover\:bg-yellow-100:hover { background-color: rgb(254 249 195) !important; }
    .hover\:text-blue-600:hover { color: rgb(37 99 235) !important; }
    
    /* Shadow */
    .shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05) !important; }
    .shadow { box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1) !important; }
    .shadow-md { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) !important; }
    .shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1) !important; }
    .shadow-none { box-shadow: 0 0 #0000 !important; }
    
    /* Opacity */
    .opacity-0 { opacity: 0 !important; }
    .opacity-50 { opacity: 0.5 !important; }
    .opacity-75 { opacity: 0.75 !important; }
    .opacity-100 { opacity: 1 !important; }
    
    /* MudBlazor specific overrides - when Tailwind classes are present */
    .mud-button.bg-blue-500,
    .mud-button.bg-blue-600 {
        background-color: rgb(59 130 246) !important;
    }
    
    .mud-button.text-white {
        color: #ffffff !important;
    }
    
    .mud-typography.text-gray-700,
    .mud-typography-body1.text-gray-700,
    .mud-typography-body2.text-gray-700 {
        color: rgb(55 65 81) !important;
    }
    
    .mud-paper.bg-white {
        background-color: #ffffff !important;
    }
    
    .mud-paper.shadow-lg {
        box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1) !important;
    }
    
    /* Radzen specific overrides */
    .rz-button.bg-blue-500 {
        background-color: rgb(59 130 246) !important;
    }
    
    .rz-button.text-white {
        color: #ffffff !important;
    }
    
    /* Syncfusion specific overrides */
    .e-btn.bg-blue-500 {
        background-color: rgb(59 130 246) !important;
    }
    
    .e-btn.text-white {
        color: #ffffff !important;
    }
    
    /* File input styling */
    input[type="file"] {
        width: auto !important;
        max-width: 250px !important;
    }
    
    input[type="file"]::file-selector-button {
        padding: 0.375rem 0.75rem !important;
        background-color: rgb(243 244 246) !important;
        color: rgb(31 41 55) !important;
        border: 1px solid rgb(209 213 219) !important;
        border-radius: 0.25rem !important;
        cursor: pointer !important;
        font-size: 0.875rem !important;
        font-weight: 500 !important;
        margin-right: 0.5rem !important;
    }
    
    input[type="file"]::file-selector-button:hover {
        background-color: rgb(229 231 235) !important;
    }
    
    /* Button states */
    button[disabled],
    .disabled {
        opacity: 0.5 !important;
        cursor: not-allowed !important;
    }
    
    button:not([disabled]):hover {
        opacity: 0.9;
    }
}