/* Legacy theme variables, now bridged onto the neon design tokens in css/neon.css so older
   components that still read them pick up the new palette automatically. */
:root,
[data-theme="dark"],
[data-theme="light"] {
    --primary-color: var(--nx-cyan);
    --secondary-color: var(--nx-green);
    --tertiary-color: var(--nx-lime);
    --success-color: var(--nx-lime);
    --warning-color: var(--nx-amber);
    --error-color: var(--nx-red);
    --info-color: var(--nx-cyan);

    --bg-primary: var(--nx-bg);
    --bg-secondary: var(--nx-surface-solid);
    --bg-tertiary: var(--nx-bg-elevated);

    --text-primary: var(--nx-text);
    --text-secondary: var(--nx-text-dim);
    --text-muted: var(--nx-text-faint);

    --border-color: var(--nx-border-strong);
    --shadow-color: rgba(0, 0, 0, 0.3);
}

/* Base body and html styling */
html, body {
    margin: 0;
    padding: 0;
}

/* Focus styles for accessibility */
.btn:focus, 
.btn:active:focus, 
.btn-link.nav-link:focus, 
.form-control:focus, 
.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

h1:focus {
    outline: none;
}

/* Legacy form styles for non-MudBlazor components */
.form-control::placeholder {
    color: var(--text-muted);
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--success-color);
}

.invalid {
    outline: 1px solid var(--error-color);
}

.validation-message {
    color: var(--error-color);
}

/* Error boundary */
.blazor-error-boundary {
    background: var(--error-color);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: 4px;
    margin: 1rem;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* MudBlazor bridge: pages not yet migrated off MudBlazor get glass surfaces and the neon
   typography so they sit comfortably inside the new layout. Remove with MudBlazor itself. */
.mud-paper,
.mud-card {
    background-color: var(--nx-surface) !important;
    backdrop-filter: blur(12px);
    border: 1px solid var(--nx-border);
    color: var(--nx-text) !important;
}

.mud-paper.mud-elevation-0 {
    border-color: transparent;
}

.mud-typography {
    font-family: var(--nx-font-sans);
}

.mud-typography-h1,
.mud-typography-h2,
.mud-typography-h3,
.mud-typography-h4 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.mud-button-root {
    font-family: var(--nx-font-mono) !important;
    letter-spacing: 0.02em;
}

.mud-button-filled.mud-button-filled-primary:hover {
    box-shadow: var(--nx-glow-soft);
}

.mud-dialog,
.mud-popover {
    background-color: var(--nx-surface-solid) !important;
    border: 1px solid var(--nx-border-strong);
}

.mud-table,
.mud-table-container {
    background-color: transparent !important;
}

.mud-card {
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.mud-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.mud-button-root {
    transition: all 0.2s ease;
}

.mud-button-root:hover {
    transform: translateY(-1px);
}

.mud-button-root:active {
    transform: translateY(0);
}

/* Input field enhancements */
.mud-input-outlined {
    transition: all 0.2s ease;
}

.mud-input-outlined:hover {
    box-shadow: 0 2px 4px var(--shadow-color);
}

.mud-input-outlined.mud-input-focused {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Navigation enhancements */
.mud-nav-link {
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 2px 8px;
}

.mud-nav-link:hover {
    transform: translateX(4px);
}

.mud-nav-link.active {
    font-weight: 600;
    border-left: 3px solid var(--primary-color);
}

/* Alert enhancements */
.mud-alert {
    border-radius: 8px;
    border-left: 4px solid;
}

.mud-alert.mud-alert-info {
    border-left-color: var(--info-color);
}

.mud-alert.mud-alert-success {
    border-left-color: var(--success-color);
}

.mud-alert.mud-alert-warning {
    border-left-color: var(--warning-color);
}

.mud-alert.mud-alert-error {
    border-left-color: var(--error-color);
}

/* Table enhancements */
.mud-table {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow-color);
}

/* Progress indicators */
.mud-progress-circular {
    color: var(--primary-color);
}

.mud-progress-linear {
    background-color: var(--bg-tertiary);
}

.mud-progress-linear .mud-progress-linear-bar {
    background-color: var(--primary-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mud-nav-link:hover {
        transform: none;
    }
    
    .mud-card:hover {
        transform: none;
    }
}

/* Monaco Editor theme integration */
#my-editor-id,
.my-editor-class,
.monaco-editor-container {
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow-color);
}

/* Animation keyframes */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-10px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Apply animations to new components */
.mud-card,
.mud-paper,
.mud-alert {
    animation: fadeIn 0.3s ease-out;
}

.mud-nav-link {
    animation: slideIn 0.2s ease-out;
}

/* Print styles */
@media print {
    .mud-appbar,
    .mud-drawer,
    .theme-toggle-button {
        display: none;
    }
    
    .mud-main-content {
        margin: 0;
        padding: 0;
    }
    
    .mud-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

.e-richtexteditor img {
    max-width: 100%;
    height: auto;
    display: block;
}
