/* Import Inter font for better typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Enhanced Global Styles */
html, body {
    font-family: 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-feature-settings: 'liga' 1, 'kern' 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

/* Micro-animations and interactions */
* {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced focus states with better accessibility */
*:focus-visible {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Smooth hover animations for interactive elements */
button, .mud-button, .mud-icon-button, .mud-chip, .mud-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover, .mud-button:hover, .mud-icon-button:hover {
    transform: translateY(-1px);
}

/* Page transition animations */
.page-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.page-exit {
    opacity: 1;
    transform: translateY(0);
}

.page-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease-in, transform 0.3s ease-in;
}

/* Enhanced button styles */
.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    box-shadow: 0 4px 16px rgba(25, 118, 210, 0.4);
    transform: translateY(-1px);
}

/* Enhanced focus styles */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(25, 118, 210, 0.4);
}

/* Content spacing */
.content {
    padding-top: 1.1rem;
}

/* Enhanced form validation */
.valid.modified:not([type=checkbox]) {
    outline: 2px solid #4caf50;
    outline-offset: 2px;
    border-radius: 4px;
}

.invalid {
    outline: 2px solid #f44336;
    outline-offset: 2px;
    border-radius: 4px;
}

.validation-message {
    color: #f44336;
    font-size: 0.875rem;
    margin-top: 4px;
    display: flex;
    align-items: center;
}

.validation-message::before {
    content: '⚠';
    margin-right: 4px;
}

/* Enhanced card components */
.mud-card {
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.mud-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* Enhanced paper components */
.mud-paper {
    border-radius: 8px;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Enhanced buttons */
.mud-button-root {
    border-radius: 8px;
    font-weight: 500;
    text-transform: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mud-button-filled-primary {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
}

.mud-button-filled-primary:hover {
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    box-shadow: 0 4px 16px rgba(25, 118, 210, 0.4);
    transform: translateY(-1px);
}

/* Enhanced table styles */
.mud-table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.mud-table-head {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.mud-table-row:hover {
    background: rgba(25, 118, 210, 0.04);
}

/* Enhanced chip styles */
.mud-chip {
    border-radius: 16px;
    font-weight: 500;
    font-size: 0.75rem;
}

/* Loading animations */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* Enhanced loading animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Apply animations to elements */
.mud-card {
    animation: scaleIn 0.3s ease-out;
}

.mud-navigation .mud-nav-item {
    animation: slideInFromLeft 0.3s ease-out;
}

.mud-appbar {
    animation: slideInFromTop 0.3s ease-out;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
}

/* Error UI Enhancement */
#blazor-error-ui {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    bottom: 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    display: none;
    left: 0;
    padding: 1rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    border-top: 3px solid #ffc107;
    border-radius: 8px 8px 0 0;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 1rem;
        top: 1rem;
        background: #ffc107;
        border: none;
        border-radius: 50%;
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #000;
        font-weight: bold;
    }

.blazor-error-boundary {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    padding: 1rem 1rem 1rem 3.7rem;
    color: #c62828;
    border-radius: 8px;
    border-left: 4px solid #f44336;
    position: relative;
}

    .blazor-error-boundary::before {
        content: "⚠";
        position: absolute;
        left: 1rem;
        top: 1rem;
        font-size: 1.5rem;
        color: #f44336;
    }

    .blazor-error-boundary::after {
        content: "An error has occurred. Please try refreshing the page.";
        font-weight: 500;
    }

/* Enhanced loading progress */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e3f2fd;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: url(#progressGradient);
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 600;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
    color: #1976d2;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

/* Code styling */
code {
    background: rgba(25, 118, 210, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.875em;
    color: #1976d2;
}

/* Responsive utilities */
@media (max-width: 768px) {
    .mud-card {
        border-radius: 8px;
        margin: 8px 0;
    }
    
    .mud-button-root {
        border-radius: 6px;
    }
}

/* Print styles */
@media print {
    .mud-appbar, .mud-drawer, .app-footer {
        display: none !important;
    }
    
    .enhanced-main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Pagination Horizontal Layout Fix */
.mud-pagination {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
}

.mud-pagination .mud-pagination-item {
    display: inline-flex !important;
    margin: 0 2px !important;
}

.horizontal-pagination,
.mud-table-pagination {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
}

.horizontal-pagination .mud-pagination-item,
.mud-table-pagination .mud-pagination-item {
    display: inline-flex !important;
    margin: 0 2px !important;
}
