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

/* ── CSS Variables ─────────────────────────────────────────────────────── */
:root {
    --primary-gradient: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --secondary-gradient: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 100%);
    --surface-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --elevated-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* ── Base ──────────────────────────────────────────────────────────────── */
html,
body {
    font-family: 'Inter', 'system-ui', '-apple-system', 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1:focus {
    outline: none;
}

a,
.btn-link {
    color: #6366F1;
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover,
.btn-link:hover {
    color: #4F46E5;
    text-decoration: none;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    border: none;
    border-radius: 10px;
    padding: 10px 24px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* ── MudBlazor Component Overrides ────────────────────────────────────── */

.mud-dialog {
    border-radius: 16px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    overflow: hidden;
}

.mud-dialog-title {
    font-weight: 600 !important;
    font-size: 1.1rem !important;
    padding: 18px 24px 14px !important;
    border-bottom: 1px solid var(--mud-palette-divider, rgba(0, 0, 0, 0.08));
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.04) 100%);
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.mud-dialog-content {
    padding: 20px 24px 8px !important;
}

.mud-dialog-actions {
    padding: 14px 24px 18px !important;
    gap: 10px;
    border-top: 1px solid var(--mud-palette-divider, rgba(0, 0, 0, 0.08));
    background: var(--mud-palette-background-gray, #F3F4F6);
    justify-content: flex-end !important;
}

/* sm-edit-dialog: primary accent stripe on the title */
.sm-edit-dialog .mud-dialog-title {
    padding-left: 20px !important;
    border-left: 4px solid #6366F1;
}

.mud-theme-dark .mud-dialog-actions {
    background: rgba(31, 41, 55, 0.6);
}

.mud-theme-dark .mud-dialog-title {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(139, 92, 246, 0.08) 100%);
}

.mud-button-root:not(.mud-fab) {
    border-radius: 10px !important;
    text-transform: none !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    padding: 8px 20px !important;
}

/* Preserve FAB circular shape */
.mud-fab {
    border-radius: 50% !important;
    padding: 0 !important;
}

/* FAB add button — fixed to viewport, immune to overflow:hidden ancestors */
.sm-add-fab {
    position: fixed !important;
    right: 24px !important;
    bottom: 24px !important;
    z-index: 1000 !important;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.38) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.sm-add-fab:hover {
    transform: scale(1.08) translateY(-2px) !important;
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.52) !important;
}

.mud-button-filled-primary {
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%) !important;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3) !important;
}

.mud-button-filled-primary:not(.mud-fab):hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 12px rgba(99, 102, 241, 0.4) !important;
}

.mud-button-filled-secondary {
    background: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 100%) !important;
}

.mud-input {
    border-radius: 10px !important;
}

.mud-input-outlined {
    border-radius: 10px !important;
}

.mud-select {
    border-radius: 10px !important;
}

.mud-card {
    border-radius: 16px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    transition: all 0.3s ease !important;
}

.mud-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
}

.mud-chip {
    border-radius: 8px !important;
    font-weight: 500 !important;
}

.mud-table {
    border-radius: 12px !important;
}

.mud-table-root {
    border-radius: 12px !important;
}

.mud-badge-dot {
    border-radius: 50% !important;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.mud-snackbar {
    border-radius: 12px !important;
    backdrop-filter: blur(10px);
}

.mud-snackbar-content-message {
    font-weight: 500 !important;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ── Form validation ───────────────────────────────────────────────────── */
.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 2px solid #10B981;
    border-radius: 8px;
}

.invalid {
    outline: 2px solid #EF4444;
    border-radius: 8px;
}

.validation-message {
    color: #EF4444;
    font-size: 0.875rem;
    margin-top: 4px;
}

/* ── Blazor error UI ───────────────────────────────────────────────────── */
#blazor-error-ui {
    background: #FEF2F2;
    bottom: 0;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    display: none;
    left: 0;
    padding: 1rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    border-top: 2px solid #EF4444;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #EF4444;
    font-weight: 600;
}

.blazor-error-boundary {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.3);
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}