/* ========================================
   RoofRunner Global Styles
   ======================================== */

/* ---------- Base ---------- */

html, body {
    height: 100%;
    margin: 0;
    background-color: var(--rr-bg);
    font-family: var(--rr-font);
    color: var(--rr-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

#app {
    min-height: 100%;
    background-color: var(--rr-bg);
}

.mud-layout {
    min-height: 100%;
    background-color: var(--rr-bg);
}

/* Single source of truth for horizontal/bottom page padding — consistent, spacious,
   responsive. NEVER set padding-top here: MudBlazor uses padding-top:var(--mud-appbar-height)
   on .mud-main-content to offset the fixed AppBar. Overriding it pushes content under the bar. */
.mud-main-content {
    background-color: var(--rr-bg);
    padding-left: var(--rr-space-md);
    padding-right: var(--rr-space-md);
    padding-bottom: var(--rr-space-xl);
}

@media (min-width: 960px) {
    .mud-main-content {
        padding-left: var(--rr-space-xl);
        padding-right: var(--rr-space-xl);
        padding-bottom: calc(var(--rr-space-xl) * 1.5);
    }
}

/* ---------- MudBlazor Global Overrides ---------- */

/* Cards */
.mud-card {
    border-radius: var(--rr-radius-lg) !important;
    box-shadow: var(--rr-shadow-sm) !important;
    border: 1px solid var(--rr-border);
    background: var(--rr-surface);
}

/* Buttons */
.mud-button-root {
    border-radius: var(--rr-radius-md) !important;
    font-weight: 600;
    text-transform: none !important;
    letter-spacing: 0.2px;
    box-shadow: none !important;
    transition: all var(--rr-transition);
}

.mud-button-filled.mud-button-filled-primary {
    background-color: var(--rr-primary) !important;
    color: var(--rr-on-primary) !important;
}

.mud-button-filled.mud-button-filled-primary:hover {
    background-color: var(--rr-primary-hover) !important;
}

/* Inputs */
.mud-input-root {
    border-radius: var(--rr-radius-md) !important;
}

.mud-input-outlined .mud-input-outlined-border {
    border-radius: var(--rr-radius-md) !important;
}

/* Chips */
.mud-chip {
    border-radius: var(--rr-radius-sm) !important;
    font-weight: 600;
    transition: all var(--rr-transition);
}

.violet-chip {
    color: var(--rr-text) !important;
    border-color: var(--rr-border) !important;
}

/* Consistent action-row layout (replaces ad-hoc per-page button rows). */
.rr-actions {
    display: flex;
    align-items: center;
    gap: var(--rr-space-sm);
    flex-wrap: wrap;
}

.rr-actions.rr-actions-end {
    justify-content: flex-end;
}

/* Tabs */
.mud-tab {
    text-transform: none !important;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: color var(--rr-transition);
}

/* Alerts */
.mud-alert {
    border-radius: var(--rr-radius-md) !important;
}

/* Dialogs */
.mud-dialog {
    border-radius: var(--rr-radius-lg) !important;
}

/* Tables */
.mud-table {
    border-radius: var(--rr-radius-lg) !important;
    overflow: hidden;
}

.mud-table-head th {
    font-weight: 700;
    color: var(--rr-text-strong);
}

.border-right-divider {
    border-right: 1px solid var(--mud-palette-divider) !important;
}

/* AppBar */
.mud-appbar {
    background: var(--rr-surface) !important;
    border-bottom: 1px solid var(--rr-border);
    color: var(--rr-text) !important;
}

/* ---------- Common Reusable Classes ---------- */

/* Card */
.rr-card {
    border: 1px solid var(--rr-border);
    border-radius: var(--rr-radius-lg);
    background: var(--rr-surface);
    transition: box-shadow var(--rr-transition), transform var(--rr-transition);
    overflow: hidden;
}

.rr-card:hover {
    box-shadow: var(--rr-shadow-hover);
    transform: translateY(-1px);
}

.rr-card-content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Typography */
.rr-title {
    font-weight: 800;
    letter-spacing: 0.4px;
    color: var(--rr-text-strong);
    margin-bottom: 2px;
}

.rr-subtitle {
    color: var(--rr-text-secondary);
    margin-bottom: 10px;
}

.rr-muted {
    color: var(--rr-text-secondary);
    line-height: 1.4;
}

.rr-section-title {
    font-weight: 800;
    color: var(--rr-text-strong);
    letter-spacing: 0.25px;
}

.rr-value {
    font-weight: 800;
    color: var(--rr-text-strong);
}

/* Tabs */
.rr-tabs {
    border-radius: var(--rr-radius-lg);
}

.rr-tabs .mud-tabs-toolbar {
    border-radius: var(--rr-radius-lg);
}

.rr-tabs .mud-tab {
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--rr-text-secondary);
}

.rr-tabs .mud-tab.mud-tab-active {
    font-weight: 800;
    color: var(--rr-text-strong);
}

.rr-tabs .mud-tab:hover {
    color: var(--rr-text-strong);
}

/* FAB */
.rr-fab {
    position: fixed;
    right: 28px;
    bottom: 28px;
    width: 56px;
    height: 56px;
    border-radius: var(--rr-radius-pill);
    border: none;
    background: var(--rr-primary);
    color: var(--rr-on-primary);
    font-size: 30px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--rr-shadow-lg);
    cursor: pointer;
    z-index: 3000;
    transition: background var(--rr-transition), box-shadow var(--rr-transition);
}

.rr-fab:hover {
    background: var(--rr-primary-hover);
    box-shadow: var(--rr-shadow-hover);
}

.rr-fab span {
    transform: translateY(-1px);
}

/* Clickable */
.clickable {
    cursor: pointer;
}

/* Fade-in animation */
.rr-fade-in {
    animation: rrFadeIn 250ms ease-out;
}

@keyframes rrFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- 404 Not Found ---------- */

.rr-notfound {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: var(--rr-space-xl);
}

.rr-notfound-code {
    font-size: 8rem;
    font-weight: 800;
    line-height: 1;
    color: var(--rr-text-strong);
    margin-bottom: var(--rr-space-md);
}

.rr-notfound-title {
    font-weight: 700;
    color: var(--rr-text-strong);
    margin-bottom: var(--rr-space-sm);
}

.rr-notfound-text {
    color: var(--rr-text-secondary);
    max-width: 480px;
    margin-bottom: var(--rr-space-lg);
    line-height: 1.6;
}

/* ---------- Scrollbar ---------- */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--rr-radius-pill);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ---------- Blazor Error UI ---------- */

#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;
}
