/*
 * Fluent UI v9 Alignment Styles
 * 
 * This file bridges Microsoft.FluentUI.AspNetCore.Components CSS variables
 * to align with React Fluent UI v9 tokens, enabling consistent styling when
 * this Blazor app is embedded within the React host application.
 */

:root {
    /* =================================================================
     * TYPOGRAPHY - Match React host's font stack
     * React uses: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif
     * ================================================================= */
    --fluent-font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
    
    /* =================================================================
     * CSS VARIABLE BRIDGES
     * Map Blazor Fluent UI variables to React Fluent UI v9 equivalents
     * ================================================================= */
    
    /* Brand/Accent Colors */
    --colorBrandBackground: var(--accent-fill-rest, #0078d4);
    --colorBrandBackgroundHover: var(--accent-fill-hover, #106ebe);
    --colorBrandBackgroundPressed: var(--accent-fill-active, #005a9e);
    --colorBrandForeground1: var(--accent-foreground-rest, #0078d4);
    --colorBrandForeground2: var(--accent-foreground-hover, #106ebe);
    --colorBrandBackground2Hover: var(--accent-fill-hover, #106ebe);
    
    /* Neutral Backgrounds */
    --colorNeutralBackground1: var(--neutral-layer-1, #ffffff);
    --colorNeutralBackground2: var(--neutral-layer-2, #f5f5f5);
    --colorNeutralBackground3: var(--neutral-layer-3, #ebebeb);
    --colorNeutralBackground3Hover: var(--neutral-layer-4, #e0e0e0);
    --colorNeutralBackground1Hover: var(--neutral-fill-layer-hover, #f5f5f5);
    
    /* Neutral Foregrounds */
    --colorNeutralForeground1: var(--neutral-foreground-rest, #242424);
    --colorNeutralForeground2: var(--neutral-foreground-hint, #616161);
    --colorNeutralForeground3: var(--neutral-foreground-hint, #707070);
    --colorNeutralForegroundDisabled: var(--neutral-foreground-disabled, #a6a6a6);
    
    /* Strokes/Borders */
    --colorNeutralStroke1: var(--neutral-stroke-rest, #d1d1d1);
    --colorNeutralStroke2: var(--neutral-stroke-hover, #c7c7c7);
    --colorNeutralStroke3: var(--neutral-stroke-divider-rest, #e0e0e0);
    --strokeWidthThin: 1px;
    --strokeWidthThick: 2px;
    
    /* Status Colors - Success */
    --colorStatusSuccessBackground1: rgba(0, 200, 83, 0.15);
    --colorStatusSuccessForeground1: #0e7a0d;
    --colorStatusSuccessForeground2: #107c10;
    
    /* Status Colors - Warning */
    --colorStatusWarningBackground1: rgba(255, 171, 0, 0.15);
    --colorStatusWarningForeground1: #9d5d00;
    --colorStatusWarningForeground2: #ffaa44;
    
    /* Status Colors - Danger/Error */
    --colorStatusDangerBackground1: rgba(209, 52, 56, 0.15);
    --colorStatusDangerForeground1: #c42b1c;
    --colorStatusDangerForeground2: #dc3545;
    
    /* Shadows */
    --shadow2: 0 1px 2px rgba(0, 0, 0, 0.14), 0 0 2px rgba(0, 0, 0, 0.12);
    --shadow4: 0 2px 4px rgba(0, 0, 0, 0.14), 0 0 2px rgba(0, 0, 0, 0.12);
    --shadow8: 0 4px 8px rgba(0, 0, 0, 0.14), 0 0 2px rgba(0, 0, 0, 0.12);
    --shadow16: 0 8px 16px rgba(0, 0, 0, 0.14), 0 0 2px rgba(0, 0, 0, 0.12);
    
    /* Border Radius */
    --borderRadiusSmall: 2px;
    --borderRadiusMedium: 4px;
    --borderRadiusLarge: 6px;
    --borderRadiusXLarge: 8px;
    --borderRadiusCircular: 50%;
    
    /* Spacing (matches Fluent design system) */
    --spacingHorizontalXXS: 2px;
    --spacingHorizontalXS: 4px;
    --spacingHorizontalSNudge: 6px;
    --spacingHorizontalS: 8px;
    --spacingHorizontalMNudge: 10px;
    --spacingHorizontalM: 12px;
    --spacingHorizontalL: 16px;
    --spacingHorizontalXL: 20px;
    --spacingHorizontalXXL: 24px;
    --spacingVerticalXXS: 2px;
    --spacingVerticalXS: 4px;
    --spacingVerticalSNudge: 6px;
    --spacingVerticalS: 8px;
    --spacingVerticalMNudge: 10px;
    --spacingVerticalM: 12px;
    --spacingVerticalL: 16px;
    --spacingVerticalXL: 20px;
    --spacingVerticalXXL: 24px;
}

/* =================================================================
 * EMBEDDED MODE TYPOGRAPHY OVERRIDE
 * When embedded in React host, inherit the host's font family
 * ================================================================= */
.embedded-layout,
.embedded-layout * {
    font-family: var(--fluent-font-family);
}

/* =================================================================
 * UTILITY CLASSES (Tailwind-like, matching React host patterns)
 * ================================================================= */

/* Display */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* Flex Direction */
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-row-reverse { flex-direction: row-reverse; }
.flex-col-reverse { flex-direction: column-reverse; }

/* Flex Wrap */
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

/* Justify Content */
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

/* Align Items */
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.items-stretch { align-items: stretch; }

/* Align Self */
.self-start { align-self: flex-start; }
.self-end { align-self: flex-end; }
.self-center { align-self: center; }

/* Flex Grow/Shrink */
.flex-1 { flex: 1 1 0%; }
.flex-auto { flex: 1 1 auto; }
.flex-initial { flex: 0 1 auto; }
.flex-none { flex: none; }
.grow { flex-grow: 1; }
.grow-0 { flex-grow: 0; }
.shrink { flex-shrink: 1; }
.shrink-0 { flex-shrink: 0; }

/* Gap */
.gap-0 { gap: 0; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }
.gap-12 { gap: 3rem; }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }
.w-screen { width: 100vw; }
.w-fit { width: fit-content; }
.min-w-0 { min-width: 0; }
.max-w-full { max-width: 100%; }

/* Height */
.h-full { height: 100%; }
.h-auto { height: auto; }
.h-screen { height: 100vh; }
.h-fit { height: fit-content; }
.min-h-0 { min-height: 0; }
.min-h-full { min-height: 100%; }
.min-h-screen { min-height: 100vh; }

/* Padding */
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.px-0 { padding-left: 0; padding-right: 0; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }

.py-0 { padding-top: 0; padding-bottom: 0; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }

/* Margin */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }
.m-auto { margin: auto; }

.mx-0 { margin-left: 0; margin-right: 0; }
.mx-1 { margin-left: 0.25rem; margin-right: 0.25rem; }
.mx-2 { margin-left: 0.5rem; margin-right: 0.5rem; }
.mx-4 { margin-left: 1rem; margin-right: 1rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

.my-0 { margin-top: 0; margin-bottom: 0; }
.my-1 { margin-top: 0.25rem; margin-bottom: 0.25rem; }
.my-2 { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.my-4 { margin-top: 1rem; margin-bottom: 1rem; }
.my-auto { margin-top: auto; margin-bottom: auto; }

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Text Overflow */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Border */
.border { border: 1px solid var(--colorNeutralStroke1); }
.border-0 { border: 0; }
.border-t { border-top: 1px solid var(--colorNeutralStroke1); }
.border-b { border-bottom: 1px solid var(--colorNeutralStroke1); }
.border-l { border-left: 1px solid var(--colorNeutralStroke1); }
.border-r { border-right: 1px solid var(--colorNeutralStroke1); }

/* Border Radius */
.rounded { border-radius: var(--borderRadiusMedium); }
.rounded-sm { border-radius: var(--borderRadiusSmall); }
.rounded-lg { border-radius: var(--borderRadiusLarge); }
.rounded-xl { border-radius: var(--borderRadiusXLarge); }
.rounded-full { border-radius: var(--borderRadiusCircular); }
.rounded-none { border-radius: 0; }

/* Shadow */
.shadow-sm { box-shadow: var(--shadow2); }
.shadow { box-shadow: var(--shadow4); }
.shadow-md { box-shadow: var(--shadow8); }
.shadow-lg { box-shadow: var(--shadow16); }
.shadow-none { box-shadow: none; }

/* Opacity */
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* Visibility */
.visible { visibility: visible; }
.invisible { visibility: hidden; }

/* Z-Index */
.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

/* =================================================================
 * RESPONSIVE BREAKPOINTS (matching React host)
 * TINY: 480px, EXTRA_SMALL: 640px, SMALL: 768px, 
 * MEDIUM: 1024px, LARGE: 1280px, EXTRA_LARGE: 1536px
 * ================================================================= */

@media (max-width: 480px) {
    .tiny\:hidden { display: none; }
    .tiny\:flex { display: flex; }
    .tiny\:flex-col { flex-direction: column; }
    .tiny\:w-full { width: 100%; }
}

@media (max-width: 640px) {
    .xs\:hidden { display: none; }
    .xs\:flex { display: flex; }
    .xs\:flex-col { flex-direction: column; }
    .xs\:w-full { width: 100%; }
}

@media (max-width: 768px) {
    .sm\:hidden { display: none; }
    .sm\:flex { display: flex; }
    .sm\:flex-col { flex-direction: column; }
    .sm\:w-full { width: 100%; }
}

@media (max-width: 1024px) {
    .md\:hidden { display: none; }
    .md\:flex { display: flex; }
    .md\:flex-col { flex-direction: column; }
    .md\:w-full { width: 100%; }
}

/* =================================================================
 * FLUENT UI COMPONENT OVERRIDES FOR EMBEDDED MODE
 * Ensure Blazor Fluent UI components match React host styling
 * ================================================================= */

/* Override Fluent button focus styles to match v9 */
.embedded-layout fluent-button:focus-visible,
.embedded-layout .fluent-button:focus-visible {
    outline: 2px solid var(--colorBrandBackground);
    outline-offset: 2px;
}

/* Ensure inputs match the React host styling */
.embedded-layout fluent-text-field,
.embedded-layout fluent-search {
    --neutral-fill-input-rest: var(--colorNeutralBackground1);
    --neutral-stroke-rest: var(--colorNeutralStroke1);
}

/* Data grid/table alignment with Kendo Fluent theme patterns */
.embedded-layout .fluent-data-grid,
.embedded-layout .projects-table {
    border: var(--strokeWidthThin) solid var(--colorNeutralStroke3);
    font-family: var(--fluent-font-family);
}

.embedded-layout .table-header {
    background: var(--colorNeutralBackground2);
    border-bottom: var(--strokeWidthThin) solid var(--colorNeutralStroke1);
}

.embedded-layout .table-row:hover {
    background: var(--colorNeutralBackground2);
}

.embedded-layout .table-row.selected {
    background: var(--colorNeutralBackground3);
}
