:root {
    --bg: #08080C;
    --bg-elevated: #0E0E15;
    --surface: #15151D;
    --surface-2: #1C1C26;
    --line: #26262F;
    --line-soft: #1B1B23;
    --text: #F5F5F7;
    --text-dim: #9A9AAE;
    --text-faint: #6B6B7B;
    --accent: #7C5CFF;
    --accent-bright: #9D86FF;
    --accent-soft: rgba(124, 92, 255, 0.12);
    --accent-line: rgba(124, 92, 255, 0.35);
    --accent-glow: rgba(124, 92, 255, 0.30);
    --good: #4ADE80;
    --bad: #F87171;
}

html {
    font-size: 16px;
}

html, body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: #2E2E3A;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #3A3A48;
}

/* Text selection */
::selection {
    background-color: rgba(124, 92, 255, 0.28);
    color: var(--text);
}

/* ── Top app bar: flush with the canvas, no border/shadow ── */
.mud-appbar {
    background: rgba(8, 8, 12, 0.72) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: none !important;
    box-shadow: none !important;
}

.mud-appbar .mud-toolbar {
    gap: 0.5rem;
}

/* ── Horizontal pill navigation (top bar) ── */
.top-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
}

.top-nav .nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1.05rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1;
    color: var(--text-dim);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.top-nav .nav-pill:hover {
    color: var(--text);
}

.top-nav .nav-pill.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.top-nav .nav-pill .mud-icon-root {
    font-size: 1.1rem;
}

.top-nav .nav-pill-live {
    color: #BCA8FF;
}

.top-nav .nav-pill-live.active {
    background: rgba(124, 92, 255, 0.2);
    color: #BCA8FF;
}

/* Mobile nav drawer */
.mud-drawer {
    background: var(--surface) !important;
    border-left: 1px solid var(--line) !important;
    border-right: none !important;
    box-shadow: none !important;
}

/* Cards: rounded panels with a soft purple lift on hover */
.mud-card {
    background-color: var(--surface) !important;
    border: 1px solid var(--line) !important;
    border-radius: 20px !important;
    box-shadow: none !important;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
}
.mud-card:hover {
    border-color: var(--accent-line) !important;
    transform: translateY(-3px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(124, 92, 255, 0.10) !important;
}

.mud-paper {
    background-color: var(--surface);
}

/* Table with border and rounded corners */
.mud-table-container {
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
}
.mud-table {
    background-color: var(--surface) !important;
    box-shadow: none !important;
}

/* Table header — uppercase, muted, compact */
.mud-table-head .mud-table-cell {
    text-transform: uppercase;
    font-size: 0.68rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.07em;
    color: var(--text-faint) !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid var(--line) !important;
}

/* Table body rows */
.mud-table-body .mud-table-row {
    border-bottom: 1px solid var(--line-soft);
}
.mud-table-body .mud-table-row:last-child {
    border-bottom: none;
}
.mud-table-body .mud-table-row:hover {
    background-color: rgba(124, 92, 255, 0.05) !important;
}
.mud-table-body .mud-table-cell {
    padding-top: 14px !important;
    padding-bottom: 14px !important;
    font-size: 0.875rem !important;
}

/* Input focus with accent border */
.mud-input.mud-input-outlined.mud-input-adorned-start.mud-input-focused .mud-input-outlined-border,
.mud-input.mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: var(--accent) !important;
}

/* Dialog with border */
.mud-dialog {
    background-color: var(--surface) !important;
    border: 1px solid var(--line);
    border-radius: 22px !important;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.65) !important;
}

/* Dialog's open animation persists transform:scale(1) (fill-mode: both); a transform on the
   ancestor makes the browser snapshot the whole dialog as the native drag image. */
.mud-dialog:has(.mud-drop-zone) {
    animation-fill-mode: none;
}

/* Chip */
.mud-chip {
    border: 1px solid var(--line) !important;
    border-radius: 999px !important;
}

/* Filled primary buttons get the violet gradient + glow */
.mud-button-filled-primary {
    background: linear-gradient(135deg, #8B6BFF 0%, #6D4DF6 100%) !important;
    color: #FFFFFF !important;
}

/* ── General interactive effects ── */
.mud-button-root {
    border-radius: 12px !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease !important;
}
.mud-button-filled:hover {
    transform: translateY(-1px);
}
.mud-button-filled-primary:hover {
    box-shadow: 0 6px 20px var(--accent-glow) !important;
}
.mud-button-root:active {
    transform: translateY(0);
}

/* Icon buttons: subtle scale on hover */
.mud-icon-button {
    transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease !important;
}
.mud-icon-button:hover {
    transform: scale(1.08);
}

/* Progress + sliders ride the accent */
.mud-progress-linear-bar,
.mud-progress-circular-circle {
    color: var(--accent) !important;
}

/* Form validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--accent);
}
.invalid {
    outline: 1px solid var(--bad);
}
.validation-message {
    color: var(--bad);
}

/* Blazor error UI */
#blazor-error-ui {
    background: var(--surface);
    border-top: 1px solid var(--line);
    bottom: 0;
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: var(--text-dim);
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid var(--bad);
    padding: 1rem;
    color: var(--bad);
    border-radius: 12px;
}
.blazor-error-boundary::after {
    content: "Ha ocurrido un error.";
}

/* ── Responsive layout ── */
.page-container {
    padding-top: 1.75rem;
    padding-bottom: 3rem;
}

/* Page header: title + action on one row, stacks on mobile */
.page-header {
    margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
    .page-container {
        padding-top: 1rem;
        padding-bottom: 1.5rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .page-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
        margin-bottom: 1.25rem;
    }

    .page-header > .mud-button-root {
        width: 100%;
    }

    /* Slightly smaller page titles on phones */
    .page-header .mud-typography-h5 {
        font-size: 1.25rem;
    }

    /* Mobile table: drop outer frame so stacked rows breathe */
    .mud-table-container {
        border: none;
        border-radius: 0;
        overflow: visible;
    }
}
