/* Blazor error boundary - displays when an unhandled exception occurs in a component */
.blazor-error-boundary {
    background: #f44336;
    padding: 1rem;
    color: white;
    border-radius: 4px;
    margin: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.blazor-error-boundary::before {
    content: "\26A0";
    font-size: 1.5rem;
}

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

/* Blazor error UI - the bottom error bar for circuit disconnection */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #d32f2f;
    color: white;
    padding: 0.75rem 1rem;
    font-family: 'Roboto', sans-serif;
    font-size: 0.875rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

#blazor-error-ui.show {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#blazor-error-ui .error-icon {
    font-size: 1.25rem;
}

#blazor-error-ui .error-message {
    flex: 1;
}

#blazor-error-ui .reload {
    color: white;
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
    font-size: inherit;
    padding: 0.25rem 0.5rem;
}

#blazor-error-ui .reload:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#blazor-error-ui .dismiss {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    opacity: 0.8;
}

#blazor-error-ui .dismiss:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Focus outline for accessibility - ensure visible focus indicators */
h1:focus {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

/* Native checkbox styling improvement for SSR compatibility */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--mud-palette-primary);
}

/* Utility class for clickable elements */
.cursor-pointer {
    cursor: pointer;
}

/* MudBlazor input field styling */
.mud-input-slot {
    font-size: 0.935rem !important;
}

.mud-input-slot::placeholder {
    font-size: 0.875rem !important;
    color: var(--mud-palette-text-secondary) !important;
}

/* Also style the label to match */
.mud-input-label {
    font-size: 0.875rem !important;
}

/* MudStepper - center the step numbers and increase size */
.mud-stepper .mud-step-label-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mud-stepper .mud-step-label-icon .mud-typography {
    line-height: 1 !important;
    font-size: 0.875rem !important;
    margin: 0 !important;
    padding: 0 !important;
}

.mud-stepper .mud-step-label-icon .mud-avatar {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mud-stepper .mud-step-label-icon svg {
    margin: auto !important;
}

/* Align grid items to bottom */
.align-end {
    align-items: flex-end !important;
}

.align-end .mud-button-root {
    height: 40px !important;
}

/* Preview table cell styling for onboarding wizard */
.preview-cell {
    text-align: center;
    padding: 1rem;
    border: 1px solid var(--mud-palette-table-lines);
}

/* (Legacy top-nav logo hack removed — logo now lives in the dark sidebar.) */

/* ============================================================
   Apontatu reskin — navy shell, teal accent, "ponto" card system
   ============================================================ */
:root {
    --ap-navy-900: #16233a;
    --ap-navy-800: #1e3050;
    --ap-navy-700: #294066;
    --ap-teal: #0e7490;
    --ap-teal-dark: #0a5a70;
    --ap-red: #d64545;
    --ap-canvas: #eef1f4;
    --ap-surface: #ffffff;
    --ap-line: #e2e8ee;
    --ap-ink: #1c2b3a;
    --ap-ink-2: #5b6b7b;
    --ap-sidebar-fg: #c4ceda;
    --ap-sidebar-muted: #8a99ac;
}

/* ---- Top bar (slim, white) ---- */
.ap-appbar.mud-appbar {
    border-bottom: 1px solid var(--ap-line);
}
.ap-appbar .mud-toolbar {
    padding-left: 16px;
    padding-right: 16px;
}
.ap-user-chip {
    border-radius: 8px !important;
    padding: 4px 10px !important;
}
.ap-user-avatar.mud-avatar {
    background-color: var(--ap-teal);
    color: #fff;
    font-weight: 600;
}
.ap-appbar-logo-mobile { display: block; }

/* Top-bar account context (name + "Trocar de Conta") — condense on mobile so it doesn't crowd the bar */
@media (max-width: 640px) {
    .ap-context { margin-right: 6px !important; }
    .ap-context .mud-typography {
        font-size: 0.72rem;
        max-width: 100px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .ap-context .mud-button {
        font-size: 0.66rem;
        padding: 2px 8px;
        min-width: 0;
    }
    .ap-context .mud-chip { font-size: 0.62rem; }
}

/* ---- Content canvas ---- */
.ap-content {
    background-color: var(--ap-canvas);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 60px);
}
.ap-content-container {
    flex: 1 1 auto;
    padding-top: 24px;
    padding-bottom: 24px;
}

/* ---- Sidebar (dark navy) ---- */
.ap-sidebar.mud-drawer {
    border-right: none;
}
.ap-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.ap-sidebar-brand {
    padding: 20px 20px 12px;
}
.ap-sidebar-logo {
    width: 152px;
    max-width: 82%;
    height: auto;
    display: block;
}
.ap-sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 16px 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}
.ap-profile-avatar.mud-avatar {
    background-color: var(--ap-teal);
    color: #fff;
    font-weight: 700;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
}
.ap-profile-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.ap-profile-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ap-profile-role {
    color: var(--ap-teal);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* nav area scrolls; footer link pinned at bottom */
.ap-sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px 10px 12px;
}
.ap-sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding: 8px 10px;
}

/* nav links on dark */
.ap-sidebar .mud-nav-link {
    color: var(--ap-sidebar-fg);
    border-radius: 8px;
    margin: 2px 0;
    font-weight: 500;
    transition: background-color .15s ease, color .15s ease;
}
.ap-sidebar .mud-nav-link .mud-nav-link-icon {
    color: var(--ap-sidebar-muted);
}
.ap-sidebar .mud-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
}
.ap-sidebar .mud-nav-link:hover .mud-nav-link-icon {
    color: #fff;
}
.ap-sidebar .mud-nav-link.active,
.ap-sidebar .mud-nav-link.mud-nav-link-active {
    background-color: rgba(14, 116, 144, 0.18);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--ap-teal);
}
.ap-sidebar .mud-nav-link.active .mud-nav-link-icon,
.ap-sidebar .mud-nav-link.mud-nav-link-active .mud-nav-link-icon {
    color: var(--ap-teal);
}

/* nav group header + sub-items */
.ap-sidebar .mud-nav-group > .mud-nav-link {
    color: var(--ap-sidebar-fg);
    font-weight: 600;
}
.ap-sidebar .mud-nav-group .mud-nav-group-content {
    padding-left: 8px;
}
.ap-nav-grouphdr {
    color: var(--ap-sidebar-muted);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 12px 12px 4px;
}

/* Always-open management/admin section: lighter panel + section title, no collapse */
.ap-nav-group-open {
    background: rgba(255, 255, 255, 0.045);
    border-radius: 10px;
    margin: 8px 2px;
    padding: 4px 6px 8px;
}
/* Non-clickable section label: uppercase + underline + default cursor make it clearly not a link */
.ap-nav-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9fb0c2;
    font-weight: 700;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 6px 8px 7px;
    margin: 2px 4px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    cursor: default;
    user-select: none;
}
.ap-nav-section-icon.mud-icon-root {
    color: var(--ap-sidebar-muted);
    font-size: 0.95rem;
}
.ap-nav-group-open .mud-nav-link {
    padding-left: 12px;
}
.ap-nav-divider.mud-divider {
    border-color: rgba(255, 255, 255, 0.08);
    margin: 6px 8px;
}
.ap-footer-link.mud-nav-link {
    color: var(--ap-sidebar-muted);
    font-weight: 500;
}

/* ---- Page footer ---- */
.ap-footer {
    margin-top: auto;
    padding: 16px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--ap-line);
}
.ap-footer-links {
    display: flex;
    gap: 12px;
}

/* ---- Card system (reusable for ponto screens) ---- */
.ap-card {
    background: var(--ap-surface);
    border: 1px solid var(--ap-line);
    border-radius: 8px;
    overflow: hidden;
}

/* Signature element: day-card with a dark navy header bar + teal rule */
.ap-daycard {
    background: var(--ap-surface);
    border: 1px solid var(--ap-line);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}
.ap-daycard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--ap-navy-800);
    color: #fff;
    padding: 10px 16px;
    border-left: 3px solid var(--ap-teal);
}
.ap-daycard-date {
    font-weight: 700;
    font-size: 0.9375rem;
}
.ap-daycard-shift {
    color: #c4ceda;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.ap-daycard-body {
    padding: 14px 16px;
}
.ap-discrepancy {
    color: var(--ap-red);
    font-weight: 600;
}
.ap-label {
    color: var(--ap-ink-2);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Syncfusion RichTextEditor fullscreen fix - ensure it appears above sticky header */
.e-richtexteditor.e-rte-full-screen {
    z-index: 1400 !important;
}


/* PROOF it loads */
/* Drop targets: root + all children-* lists */
#survey-root,
[id^="children-"] {
    min-height: 44px;
    padding: 6px;
    border-radius: 0;
    background: rgba(25,118,210,.04);
}

/* Empty lists are unmistakable drop zones */
    #survey-root:empty,
    [id^="children-"]:empty {
        min-height: 44px;
        background: rgba(25,118,210,.04);
        border-radius: 0;
    }

        #survey-root:empty::before,
        [id^="children-"]:empty::before {
            content: "Deixe aqui";
            display: block;
            padding: 10px 12px;
            color: rgba(0,0,0,.55);
            font-style: italic;
        }

/* Drag visuals (NO transform/scale; keep it stable) */
.sortable-drag,
.sortable-drag .tree-node-card {
    box-shadow: 0 10px 22px rgba(0,0,0,.20) !important;
    background: var(--mud-palette-surface) !important;
}

.sortable-ghost,
.sortable-ghost .tree-node-card {
    opacity: 0.25 !important;
    background: rgba(25,118,210,.04) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.survey-builder-ui .drag-handle {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
}

.survey-builder-ui .drag-handle:active {
    cursor: grabbing;
}

.survey-builder-ui .drag-handle:hover {
    background: rgba(0,0,0,.05);
}

/* Floating scroll FAB buttons */
.scroll-fab {
    position: fixed;
    bottom: 24px;
    z-index: 2000;
}

.scroll-fab--up {
    right: 24px;
}

.scroll-fab--down {
    right: 72px;
}

/* Notification bell badge positioning */
.notification-bell .mud-badge.mud-badge-top.right.mud-badge-overlap {
    inset: auto auto calc(100% - 22px) calc(100% - 18px);
}

/* ── Reconnect Modal ── */

/* Visibility toggles — hide all state-specific elements by default */
#components-reconnect-modal .components-reconnect-first-attempt-visible,
#components-reconnect-modal .components-reconnect-repeated-attempt-visible,
#components-reconnect-modal .components-reconnect-failed-visible,
#components-reconnect-modal .components-pause-visible,
#components-reconnect-modal .components-resume-failed-visible,
#components-reconnect-modal .components-rejoining-animation {
    display: none;
}

/* Show elements based on reconnect state */
#components-reconnect-modal.components-reconnect-show .components-reconnect-first-attempt-visible,
#components-reconnect-modal.components-reconnect-show .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-paused .components-pause-visible,
#components-reconnect-modal.components-reconnect-resume-failed .components-resume-failed-visible,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-repeated-attempt-visible,
#components-reconnect-modal.components-reconnect-retrying .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed-visible {
    display: block;
}

#components-reconnect-modal {
    background-color: var(--mud-palette-surface, #fff);
    width: 22rem;
    margin: 20vh auto;
    padding: 2.5rem 2rem;
    border: none;
    outline: none;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    opacity: 0;
    font-family: var(--mud-typography-default-family, 'Roboto', sans-serif);
    transition: display 0.5s allow-discrete, overlay 0.5s allow-discrete;
    animation: reconnect-fadeOut 0.5s both;
}

#components-reconnect-modal[open] {
    animation: reconnect-slideUp 1.5s cubic-bezier(.05, .89, .25, 1.02) 0.3s,
               reconnect-fadeIn 0.5s ease-in-out 0.3s;
    animation-fill-mode: both;
}

#components-reconnect-modal::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    animation: reconnect-fadeIn 0.5s ease-in-out;
    opacity: 1;
}

#components-reconnect-modal .components-reconnect-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

#components-reconnect-modal p {
    margin: 0;
    text-align: center;
    color: var(--mud-palette-text-primary, #424242);
    font-size: 0.925rem;
    line-height: 1.5;
}

#components-reconnect-modal button {
    border: 0;
    background-color: var(--mud-palette-primary, #1976d2);
    color: white;
    padding: 8px 28px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#components-reconnect-modal button:hover {
    background-color: var(--mud-palette-primary-darken, #1565c0);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#components-reconnect-modal button:active {
    background-color: var(--mud-palette-primary, #1976d2);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#components-reconnect-modal .components-rejoining-animation {
    position: relative;
    width: 64px;
    height: 64px;
}

#components-reconnect-modal .components-rejoining-animation div {
    position: absolute;
    border: 2.5px solid var(--mud-palette-primary, #1976d2);
    opacity: 1;
    border-radius: 50%;
    animation: reconnect-ripple 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

#components-reconnect-modal .components-rejoining-animation div:nth-child(2) {
    animation-delay: -0.5s;
}

@keyframes reconnect-slideUp {
    0% { transform: translateY(30px) scale(0.95); }
    100% { transform: translateY(0) scale(1); }
}

@keyframes reconnect-fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes reconnect-fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes reconnect-ripple {
    0% { top: 32px; left: 32px; width: 0; height: 0; opacity: 0; }
    4.9% { top: 32px; left: 32px; width: 0; height: 0; opacity: 0; }
    5% { top: 32px; left: 32px; width: 0; height: 0; opacity: 1; }
    100% { top: 0; left: 0; width: 64px; height: 64px; opacity: 0; }
}