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

:root {
    font-size: var(--rz-root-font-size);
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Safe area handling for status bar/notch - MAUI only */
:root {
    --safe-area-top: 0px;
}

/* MAUI: fixed status bar padding (env() doesn't work on Android WebView) */
/* Windows app will have wide viewport, Android will be narrow - detected via media query later */
.platform-maui {
    --safe-area-top: 28px;
}

/* On wide screens (Windows desktop), remove the safe-area */
@media (min-width: 769px) {
    .platform-maui {
        --safe-area-top: 0px;
    }
}

/* Radzen dialog safe area - push dialogs down on MAUI */
.platform-maui .rz-dialog-wrapper {
    padding-top: var(--safe-area-top) !important;
}

.platform-maui .rz-dialog {
    max-height: calc(100vh - var(--safe-area-top) - 2rem) !important;
}

/* Center small dialogs vertically on mobile (exclude fullscreen dialogs) */
@media (max-width: 768px) {
    .rz-dialog:not(.fullscreen-dialog) {
        margin-top: 50vh !important;
        transform: translateY(-50%) !important;
    }
}

body {
    font-family: var(--rz-text-font-family);
    color: var(--rz-text-color);
    font-size: var(--rz-body-font-size);
    line-height: var(--rz-body-line-height);
    background-color: var(--rz-body-background-color);
}

.rz-body {
    --rz-body-padding: 0;
}

a {
    color: var(--rz-link-color);
}

a:hover,
a:focus {
    color: var(--rz-link-hover-color);
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4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jY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

.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: #1b6ec2;
    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, "Loading");
}

/* ===== Custom Action Button Styles ===== */
/* Apply these classes explicitly to buttons that need custom styling */

/* Base action button - use on buttons we want styled */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-action:active {
    transform: translateY(0);
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Icon-only variant */
.btn-action.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
}

.btn-action.btn-icon-sm {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
}

/* Color variants */
.btn-action.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.btn-action.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.btn-action.btn-secondary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

.btn-action.btn-secondary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

.btn-action.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-action.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-action.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.btn-action.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.btn-action.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-action.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.btn-action.btn-info {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
}

.btn-action.btn-info:hover {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
}

.btn-action.btn-light {
    background: var(--rz-base-600);
    color: var(--rz-text-color);
    border: 1px solid var(--rz-border-color);
}

.btn-action.btn-light:hover {
    background: var(--rz-base-800);
    border-color: var(--rz-primary);
    color: var(--rz-primary);
}

/* Dark mode for light buttons */
:root[data-rz-scheme="dark"] .btn-action.btn-light {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

:root[data-rz-scheme="dark"] .btn-action.btn-light:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--rz-primary);
}

/* SVG icon sizing inside buttons */
.btn-action svg {
    width: 18px;
    height: 18px;
}

.btn-action.btn-icon-sm svg {
    width: 16px;
    height: 16px;
}

/* ===== Icon System using CSS Masks ===== */
/* Icons inherit color from parent element */
.icon {
    display: inline-block;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.icon-plus {
    -webkit-mask-image: url('/_content/WebTasks.Shared/icons/plus.svg');
    mask-image: url('/_content/WebTasks.Shared/icons/plus.svg');
}

.icon-edit {
    -webkit-mask-image: url('/_content/WebTasks.Shared/icons/edit.svg');
    mask-image: url('/_content/WebTasks.Shared/icons/edit.svg');
}

.icon-trash {
    -webkit-mask-image: url('/_content/WebTasks.Shared/icons/trash.svg');
    mask-image: url('/_content/WebTasks.Shared/icons/trash.svg');
}

.icon-trash-simple {
    -webkit-mask-image: url('/_content/WebTasks.Shared/icons/trash-simple.svg');
    mask-image: url('/_content/WebTasks.Shared/icons/trash-simple.svg');
}

.icon-arrow-up {
    -webkit-mask-image: url('/_content/WebTasks.Shared/icons/arrow-up.svg');
    mask-image: url('/_content/WebTasks.Shared/icons/arrow-up.svg');
}

.icon-arrow-down {
    -webkit-mask-image: url('/_content/WebTasks.Shared/icons/arrow-down.svg');
    mask-image: url('/_content/WebTasks.Shared/icons/arrow-down.svg');
}

.icon-check {
    -webkit-mask-image: url('/_content/WebTasks.Shared/icons/check.svg');
    mask-image: url('/_content/WebTasks.Shared/icons/check.svg');
}

.icon-x {
    -webkit-mask-image: url('/_content/WebTasks.Shared/icons/x.svg');
    mask-image: url('/_content/WebTasks.Shared/icons/x.svg');
}

.icon-flag {
    -webkit-mask-image: url('/_content/WebTasks.Shared/icons/flag.svg');
    mask-image: url('/_content/WebTasks.Shared/icons/flag.svg');
}

.icon-calendar {
    -webkit-mask-image: url('/_content/WebTasks.Shared/icons/calendar.svg');
    mask-image: url('/_content/WebTasks.Shared/icons/calendar.svg');
}

.icon-clock {
    -webkit-mask-image: url('/_content/WebTasks.Shared/icons/clock.svg');
    mask-image: url('/_content/WebTasks.Shared/icons/clock.svg');
}

.icon-checkbox-check {
    -webkit-mask-image: url('/_content/WebTasks.Shared/icons/checkbox-check.svg');
    mask-image: url('/_content/WebTasks.Shared/icons/checkbox-check.svg');
}

.icon-list {
    -webkit-mask-image: url('/_content/WebTasks.Shared/icons/list.svg');
    mask-image: url('/_content/WebTasks.Shared/icons/list.svg');
}

/* Mobile full-screen dialogs */
@media (max-width: 768px) {
    /* Fullscreen dialog wrapper - no extra padding, we handle safe-area in titlebar */
    .rz-dialog-wrapper:has(.fullscreen-dialog) {
        padding-top: 0 !important;
    }

    /* Fullscreen dialog - true fullscreen on mobile */
    .fullscreen-dialog.rz-dialog {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        top: 0 !important;
        left: 0 !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    /* Hide Radzen's close button - we have our own at the bottom */
    .fullscreen-dialog .rz-dialog-titlebar-close {
        display: none !important;
    }

    /* Dialog content fills remaining space */
    .fullscreen-dialog .rz-dialog-content {
        height: calc(100vh - 2.5rem) !important;
        max-height: none !important;
        display: flex;
        flex-direction: column;
        overflow: hidden !important;
        padding: 0.75rem !important;
    }

    /* Hide Radzen's scrollbar on dialog - we use our own */
    .fullscreen-dialog .rz-dialog-content::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
    }

    .fullscreen-dialog .rz-dialog-content .fullscreen-dialog-content {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .fullscreen-dialog .rz-dialog-content .fullscreen-dialog-container {
        flex: 1;
        min-height: 0;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
}

/* Fullscreen dialog - remove focus shadows on form fields */
.fullscreen-dialog .rz-form-field.rz-state-focused .rz-form-field-content {
    box-shadow: none !important;
}

/* Fullscreen dialog scrollbar - applies to both mobile and desktop */
.fullscreen-dialog-container::-webkit-scrollbar {
    width: 6px;
}

.fullscreen-dialog-container::-webkit-scrollbar-track {
    background: transparent;
}

.fullscreen-dialog-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.fullscreen-dialog-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Hide scrollbar on mobile */
@media (max-width: 768px) {
    .fullscreen-dialog-container {
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }

    .fullscreen-dialog-container::-webkit-scrollbar {
        display: none; /* Chrome/Safari/Opera */
    }

    /* Hide card add/refresh buttons on mobile - use top bar buttons instead */
    .card-header-btn,
    .rz-button.card-header-btn,
    button.card-header-btn {
        display: none !important;
        visibility: hidden !important;
    }

    /* Calendar cards full-width on mobile */
    .rz-card {
        border-radius: 0 !important;
    }

    /* Remove main padding on mobile */
    .app-main {
        padding: 0 !important;
    }

    /* Remove row gap between calendar columns on mobile */
    .columns-row {
        row-gap: 0 !important;
    }

    .column-header {
        margin-top: 5px !important;
    }

    /* ===== Sticky Headers in Vertical Layout on Mobile ===== */
    /* Make columns auto-height so container scrolls, not individual cards */
    .vertical-layout .rz-col {
        height: auto !important;
    }

    .vertical-layout .calendar-column,
    .vertical-layout .calendar-column > .rz-card-content {
        height: auto !important;
        overflow: visible !important;
    }

    /* Disable individual scroll areas - let container scroll */
    .vertical-layout .todos-scroll-area {
        overflow: visible !important;
        flex: none !important;
    }

    /* Single sticky header container - contains calendar name, tags, and options */
    .vertical-layout .calendar-sticky-header {
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--rz-card-background-color, #1e1e2e);
        margin: 0 -1rem !important;
        padding: 0.25rem 1rem 0.25rem 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Adjust inner elements - no more individual sticky positioning */
    .vertical-layout .column-header {
        margin: 0 0 0.5rem 0 !important;
        padding: 0 !important;
    }

    .vertical-layout .tag-hint {
        display: none;
    }
    
    .vertical-layout .tag-tabs {
        margin: 0 0 0.25rem 0 !important;
        padding: 0 !important;
    }

    .vertical-layout .list-options {
        margin: 0 !important;
        padding: 0 !important;
        border-bottom: none;
    }
}

/* MAUI-specific safe-area handling for fullscreen dialogs */
.platform-maui .fullscreen-dialog .rz-dialog-titlebar {
    padding-top: calc(var(--safe-area-top) + 0.75rem) !important;
    min-height: calc(var(--safe-area-top) + 2.5rem) !important;
}

.platform-maui .fullscreen-dialog .rz-dialog-content {
    height: calc(100vh - var(--safe-area-top) - 2.5rem) !important;
}

/* Prevent text selection on long press for mobile context menus */
.rz-badge,
.rz-button,
.action-btn,
button,
.rz-card-header,
.rz-icon,
.icon {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Allow text selection in text inputs and content areas */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea,
.rz-textbox,
.rz-textarea,
.todo-description {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}