:root {
    /*
    This stylesheet contains structural rules only. All colors/fonts/shapes are
    driven by CSS custom properties (--theme-*) defined per-theme in
    wwwroot/themes/*.css and scoped to the [data-theme="..."] attribute set on
    <html>. This keeps each theme fully isolated and easy to maintain/replace
    without touching this file.
*/

html, body
{
    font-family: var(--theme-font-family);
    color: var(--theme-text-color, #5a3200);
    background-color: var(--theme-body-bg-color, #fff8e1);
    background-image: var(--theme-body-bg-image, none);
    background-size: var(--theme-body-bg-size, auto);
}

a, .btn-link {
    color: var(--theme-link-color, #cc5500);
}

table {
    opacity: var(--theme-table-opacity, .9);
}

h1, h2, h3 {
    font-weight: var(--theme-heading-weight, bold);
    text-shadow: var(--theme-heading-shadow, none);
    letter-spacing: 0.5px;
}

.btn-primary {
    color: var(--theme-btn-primary-color, #fff);
    background-color: var(--theme-btn-primary-bg, #ff9800);
    border: var(--theme-btn-primary-border, 1px solid #e08e00);
    border-radius: var(--theme-btn-primary-radius, 12px);
    box-shadow: var(--theme-btn-primary-shadow, none);
    font-weight: bold;
}

    .btn-primary:hover {
        background-color: var(--theme-btn-primary-hover-bg, #fb8c00);
    }

    .btn-primary:active {
        transform: var(--theme-btn-primary-active-transform, none);
    }

/* ===== Reusable "OS Window" component ===== */
.os-window {
    border: var(--theme-os-window-border, none);
    box-shadow: var(--theme-os-window-shadow, 0 2px 8px rgba(0,0,0,0.15));
    border-radius: var(--theme-os-window-radius, 12px);
    background: var(--theme-os-window-content-bg, #fff);
    margin-bottom: 1rem;
    overflow: hidden;
}

.os-window-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.5rem;
    color: var(--theme-os-window-titlebar-color, #5a3200);
    font-weight: bold;
    font-size: 0.9rem;
    background: var(--theme-os-window-titlebar-bg, #ffb74d);
}

.os-window-titlebar.blue, .os-window-titlebar.pink, .os-window-titlebar.purple {
    background: var(--theme-os-window-titlebar-bg, #ffb74d);
}

.os-window-title {
    text-shadow: var(--theme-os-window-titlebar-shadow, none);
}

.os-window-controls {
    display: var(--theme-os-window-control-display, none);
    gap: 3px;
}

.os-window-controls span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--y2k-grey, #C0C0C0);
    border: 1px solid #000;
    color: #000;
    font-size: 10px;
    line-height: 1;
}

.os-window-content {
    padding: 0.75rem;
    background: var(--theme-os-window-content-bg, #fff);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5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em 3.7rem;
    color: white;
}

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

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ===== Top announcement bar (decorative, only shown by themes that opt in) ===== */
.announcement-bar {
    display: var(--theme-decorative-display, none);
    border-bottom: 1px solid rgba(0,0,0,0.15);
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 1rem;
    font-size: 0.8rem;
    font-weight: bold;
}

/* ===== Fixed bottom taskbar (decorative, only shown by themes that opt in) ===== */
.taskbar {
    display: var(--theme-decorative-display, none);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2.75rem;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.4rem;
    z-index: 1050;
    font-size: 0.85rem;
}

.taskbar-start {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: bold;
    padding: 0.25rem 0.75rem;
}

.taskbar-tab {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
}

/* ===== Theme switcher ===== */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.theme-switcher select {
    font-family: inherit;
    font-size: 0.85rem;
    padding: 0.15rem 0.4rem;
}

/* ===== Wall editor ===== */
.wall-editor {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.wall-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.wall-mode-switch {
    display: flex;
    gap: 0.25rem;
    margin-right: 0.5rem;
}

.wall-canvas-viewport {
    position: relative;
    max-width: 100%;
    height: 70vh;
    border: 1px dashed rgba(0,0,0,0.2);
    border-radius: 8px;
    background-color: rgba(255,255,255,0.35);
    overflow: hidden;
    touch-action: none;
}

.wall-canvas-viewport-panning {
    cursor: grab;
}

.wall-canvas {
    position: absolute;
    top: 0;
    left: 0;
}

/* Only show the wall's boundaries while actively resizing/panning it in
   "Wall setup" mode, not in the widgets/answers view or read-only display. */
.wall-canvas-editing-bounds {
    outline: 2px solid rgba(0,0,0,0.35);
    outline-offset: -1px;
    box-sizing: border-box;
}

.wall-widget {
    position: absolute;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.wall-widget-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.wall-widget-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.05);
    font-size: 0.75rem;
    text-align: center;
    pointer-events: none;
}

.wall-widget-svg {
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.wall-widget-svg svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ===== Wall SVG editor modal ===== */
.wall-svg-editor-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.wall-svg-editor-dialog {
    display: flex;
    flex-direction: column;
    width: min(90vw, 1000px);
    height: min(85vh, 720px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    overflow: hidden;
}

.wall-svg-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.wall-svg-editor-title {
    font-weight: 600;
}

.wall-svg-editor-actions {
    display: flex;
    gap: 0.5rem;
}

.wall-svg-editor-canvas {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
}

.wall-widget-selected {
    outline: 2px solid #ff9800;
}

.wall-widget-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ff9800;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-family: 'Segoe UI Symbol', 'Segoe UI', Arial, sans-serif;
    line-height: 1;
    cursor: pointer;
    touch-action: none;
}

.wall-widget-handle::before {
    content: attr(data-icon);
    display: block;
    transform: translateY(-1px);
}

.wall-widget-rotate-handle {
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
}

.wall-widget-scale-handle {
    bottom: -10px;
    right: -10px;
    cursor: nwse-resize;
}

.wall-group-bounds {
    position: absolute;
    border: 2px dashed #ff9800;
    border-radius: 4px;
    pointer-events: none;
    z-index: 5;
}

.wall-group-rotate-handle {
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: auto;
}

.wall-group-scale-handle {
    bottom: -10px;
    right: -10px;
    cursor: nwse-resize;
    pointer-events: auto;
}

.wall-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ff9800;
    color: #fff;
    font-size: 10px;
    font-family: 'Segoe UI Symbol', 'Segoe UI', Arial, sans-serif;
    line-height: 1;
    border-top-left-radius: 6px;
    cursor: nwse-resize;
    touch-action: none;
    z-index: 10;
}

.wall-resize-handle::before {
    content: attr(data-icon);
    display: block;
    transform: translateY(-1px);
}

/* Background wall behind the profile page content, used when editing the wall. */
.wall-background-page {
    position: relative;
}

.wall-editor-background {
    position: absolute;
    inset: 0;
    /* Positioned relative to the .content article (which establishes its own
       stacking context via position: relative + z-index: 0), so the wall is
       confined to the content area and never hidden behind the sidebar or
       top-row. The negative z-index keeps it painted behind .content's own
       page content (text, buttons, forms, etc.). */
    z-index: -1;
    pointer-events: none;
}

.wall-canvas-viewport-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
    background: transparent;
    pointer-events: none;
    cursor: default;
    overflow: hidden;
}

.wall-canvas-background {
    position: absolute;
    top: 0;
    left: 0;
    border: none;
    border-radius: 0;
    pointer-events: none;
}
