/* ==========================================================================
   FlexOps Ship Manager - Site Styles
   Core application styles and Radzen overrides
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Blazor Error UI
   -------------------------------------------------------------------------- */
#blazor-error-ui {
    background: #FEF2F2;
    bottom: 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    display: none;
    left: 0;
    padding: 1rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    border-top: 3px solid #DC2626;
    font-family: var(--vs-font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 150ms ease;
}

#blazor-error-ui .dismiss:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* --------------------------------------------------------------------------
   2. Radzen Theme Overrides - Professional Color Palette
   -------------------------------------------------------------------------- */
:root {
    font-size: var(--rz-root-font-size);
    
    /* Base neutrals - Refined slate palette */
    --rz-white: #FFFFFF;
    --rz-black: #0F172A;
    --rz-base: #F1F5F9;
    --rz-base-50: #F8FAFC;
    --rz-base-100: #F1F5F9;
    --rz-base-200: #E2E8F0;
    --rz-base-300: #CBD5E1;
    --rz-base-400: #94A3B8;
    --rz-base-500: #64748B;
    --rz-base-600: #475569;
    --rz-base-700: #334155;
    --rz-base-800: #1E293B;
    --rz-base-900: #0F172A;
    --rz-base-light: #F8FAFC;
    --rz-base-lighter: #FFFFFF;
    --rz-base-dark: #475569;
    --rz-base-darker: #1E293B;
    
    /* Primary - Professional purple */
    --rz-primary: #7C3AED;
    --rz-primary-light: #A78BFA;
    --rz-primary-lighter: rgba(124, 58, 237, 0.12);
    --rz-primary-dark: #6D28D9;
    --rz-primary-darker: #5B21B6;
    
    /* Secondary - Professional blue */
    --rz-secondary: #3B82F6;
    --rz-secondary-light: #60A5FA;
    --rz-secondary-lighter: rgba(59, 130, 246, 0.12);
    --rz-secondary-dark: #2563EB;
    --rz-secondary-darker: #1D4ED8;
    
    /* Info */
    --rz-info: #0284C7;
    --rz-info-light: #38BDF8;
    --rz-info-lighter: rgba(2, 132, 199, 0.12);
    --rz-info-dark: #0369A1;
    --rz-info-darker: #075985;
    
    /* Success */
    --rz-success: #059669;
    --rz-success-light: #34D399;
    --rz-success-lighter: rgba(5, 150, 105, 0.12);
    --rz-success-dark: #047857;
    --rz-success-darker: #065F46;
    
    /* Warning */
    --rz-warning: #D97706;
    --rz-warning-light: #FBBF24;
    --rz-warning-lighter: rgba(217, 119, 6, 0.12);
    --rz-warning-dark: #B45309;
    --rz-warning-darker: #92400E;
    
    /* Danger */
    --rz-danger: #DC2626;
    --rz-danger-light: #F87171;
    --rz-danger-lighter: rgba(220, 38, 38, 0.12);
    --rz-danger-dark: #B91C1C;
    --rz-danger-darker: #991B1B;
    
    /* Text on colors */
    --rz-on-base: #1E293B;
    --rz-on-base-light: #1E293B;
    --rz-on-base-lighter: #1E293B;
    --rz-on-base-dark: #FFFFFF;
    --rz-on-base-darker: #FFFFFF;
    --rz-on-primary: #FFFFFF;
    --rz-on-primary-lighter: #7C3AED;
    --rz-on-primary-light: #FFFFFF;
    --rz-on-primary-dark: #FFFFFF;
    --rz-on-primary-darker: #FFFFFF;
    --rz-on-secondary: #FFFFFF;
    --rz-on-secondary-lighter: #3B82F6;
    --rz-on-secondary-light: #FFFFFF;
    --rz-on-secondary-dark: #FFFFFF;
    --rz-on-secondary-darker: #FFFFFF;
    --rz-on-info: #FFFFFF;
    --rz-on-info-lighter: #0284C7;
    --rz-on-info-light: #1E293B;
    --rz-on-info-dark: #FFFFFF;
    --rz-on-info-darker: #FFFFFF;
    --rz-on-success: #FFFFFF;
    --rz-on-success-lighter: #059669;
    --rz-on-success-light: #1E293B;
    --rz-on-success-dark: #FFFFFF;
    --rz-on-success-darker: #FFFFFF;
    --rz-on-warning: #1E293B;
    --rz-on-warning-lighter: #D97706;
    --rz-on-warning-light: #1E293B;
    --rz-on-warning-dark: #FFFFFF;
    --rz-on-warning-darker: #FFFFFF;
    --rz-on-danger: #FFFFFF;
    --rz-on-danger-lighter: #DC2626;
    --rz-on-danger-light: #FFFFFF;
    --rz-on-danger-dark: #FFFFFF;
    --rz-on-danger-darker: #FFFFFF;
}

/* --------------------------------------------------------------------------
   3. Body & Typography
   -------------------------------------------------------------------------- */
body {
    font-family: var(--rz-text-font-family);
    color: var(--rz-text-color);
    font-size: var(--rz-body-font-size);
    line-height: 1.6;
    background-color: var(--rz-body-background-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.rz-body {
    --rz-body-padding: 0;
}

a {
    color: var(--rz-link-color);
    text-decoration: none;
    transition: color 150ms ease;
}

a:hover,
a:focus {
    color: var(--rz-link-hover-color);
}

/* --------------------------------------------------------------------------
   4. Error Boundaries
   -------------------------------------------------------------------------- */
.blazor-error-boundary {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    padding: 1rem 1rem 1rem 3.5rem;
    color: white;
    border-radius: 8px;
    margin: 1rem 0;
    position: relative;
}

.blazor-error-boundary::before {
    content: "?";
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred. Please refresh the page or contact support if the problem persists.";
}

/* --------------------------------------------------------------------------
   5. Loading Progress
   -------------------------------------------------------------------------- */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #E2E8F0;
    stroke-width: 0.5rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #7C3AED;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.15s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 600;
    color: #475569;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* --------------------------------------------------------------------------
   6. Radzen Component Enhancements
   -------------------------------------------------------------------------- */

/* Improved focus states for accessibility */
.rz-button:focus-visible,
.rz-textbox:focus-visible,
.rz-dropdown:focus-visible {
    outline: 2px solid var(--rz-primary);
    outline-offset: 2px;
}

/* Better scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 #F1F5F9;
}

/* --------------------------------------------------------------------------
   7. Accessibility Improvements
   -------------------------------------------------------------------------- */

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--rz-primary);
    color: white;
    padding: 8px 16px;
    z-index: 1001;
    transition: top 150ms ease;
}

.skip-link:focus {
    top: 0;
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
    :root {
        --rz-primary: #6D28D9;
        --rz-base-200: #CBD5E1;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
