:root {
  --primary-color: #5C61F2;
  --secondary-color: #e5bdff;
  --sidebar-width: 280px;
  --topbar-height: 80px;
  --card-shadow: 0px 9px 20px rgba(0, 0, 0, 0.07);
}

html, body {
    font-family: 'Inter', 'Roboto', sans-serif;
    background-color: var(--mud-palette-background, #f5f6f9);
    color: var(--mud-palette-text-primary, #2F2F3B);
    margin: 0;
    padding: 0;
    height: 100%;
}

a, .btn-link {
    color: var(--primary-color);
}

.btn-primary {
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Layout Wrapper */
.page-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Topbar */
.page-header {
    background-color: var(--mud-palette-appbar-background, #ffffff);
    height: var(--topbar-height);
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    z-index: 99;
    padding: 0 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

/* Sidebar */
.sidebar-wrapper {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--mud-palette-surface, #ffffff);
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.03);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.sidebar-wrapper .logo-wrapper {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 30px;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
    border-bottom: 1px solid var(--mud-palette-lines-default, rgba(0,0,0,0.05));
}

.sidebar-main {
    flex: 1;
    overflow-y: auto;
    padding: 20px 15px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--mud-palette-text-primary, #5867dd);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.sidebar-link:hover, .sidebar-link.active {
    background-color: var(--mud-palette-action-default-hover, rgba(92, 97, 242, 0.1));
    color: var(--primary-color);
}
.sidebar-link.active {
    background-color: var(--primary-color);
    color: #ffffff;
}
.sidebar-link:hover.active {
    background-color: var(--primary-color);
    color: #ffffff;
}

.sidebar-link i {
    margin-right: 12px;
    font-size: 1.2rem;
}

/* Page Body */
.page-body-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-body {
    margin-top: var(--topbar-height);
    margin-left: var(--sidebar-width);
    padding: 30px;
    flex: 1;
    transition: all 0.3s ease;
}

/* Cards */
.card {
    border: 1px solid var(--mud-palette-lines-default, rgba(0,0,0,0.05));
    border-radius: 15px;
    background-color: var(--mud-palette-surface, #ffffff);
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--mud-palette-lines-default, rgba(0,0,0,0.05));
    padding: 20px 30px;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.card-body {
    padding: 30px;
    color: var(--mud-palette-text-primary);
}

/* Media Queries for responsive */
@media (max-width: 991px) {
    .sidebar-wrapper {
        transform: translateX(-100%);
    }
    .page-header {
        left: 0;
    }
    .page-body {
        margin-left: 0;
    }
    .sidebar-wrapper.open {
        transform: translateX(0);
    }
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

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

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

.loading-progress circle:last-child {
    stroke: var(--primary-color, #5C61F2);
    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: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

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

/* Topbar user dropdown menu items */
.topbar-menu-item {
    color: var(--mud-palette-text-primary, #2F2F3B);
    transition: background-color 0.15s ease;
}
.topbar-menu-item:hover {
    background-color: var(--mud-palette-action-default-hover, rgba(0,0,0,0.06));
    color: var(--mud-palette-text-primary, #2F2F3B);
    text-decoration: none;
}