/* Mobile-first: real device width + slightly larger base text on narrow screens */
html {
    font-size: 106.25%;
}

@media (min-width: 992px) {
    html {
        font-size: 100%;
    }
}

@media (max-width: 575.98px) {
    main .container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Navbar: comfortable tap targets on touch devices */
.app-navbar-toggler {
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    min-width: 44px;
}

.app-navbar-toggler:focus {
    box-shadow: none;
}

@media (max-width: 991.98px) {
    .app-navbar .navbar-collapse {
        padding-top: 0.5rem;
    }

    .app-navbar .nav-link {
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
        min-height: 44px;
    }

    .app-navbar-user {
        font-weight: 600;
        opacity: 0.9;
    }

    .app-navbar-signout {
        margin-top: 0.5rem;
        padding-bottom: 0.25rem;
    }

    .app-navbar-signout .btn {
        width: 100%;
        min-height: 44px;
    }
}

h1:focus {
    outline: none;
}

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

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

/* Microsite: poster centered and scale-to-fit */
.microsite-poster-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 55vh;
    min-height: 280px;
    max-height: 70vh;
    background: #f0f0f0;
    position: relative;
    overflow: hidden;
}

.microsite-poster-img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-position: center;
}

.microsite-poster-caption {
    max-width: 100%;
}

/* Theme Create/Edit: poster preview centered and scale-to-fit */
.theme-poster-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    height: clamp(120px, 24vw, 160px);
    background: #f0f0f0;
    border-radius: 0.25rem;
    overflow: hidden;
}

.theme-poster-preview-contain-frame {
    display: block;
    overflow: hidden;
}

.theme-poster-preview-contain-frame .theme-poster-preview-trigger {
    height: 100%;
}

.theme-poster-preview-contain-full .theme-poster-preview-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.theme-poster-preview-cover {
    height: auto;
    min-height: 0;
    overflow: visible;
}

.theme-poster-preview-cover .theme-poster-preview-trigger {
    height: auto;
}

.theme-poster-preview-trigger {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    cursor: zoom-in;
}

.theme-poster-preview-img {
    object-position: center;
}

.theme-poster-preview-img-contain-frame {
    width: 100%;
    height: 100%;
    min-height: inherit;
    max-height: inherit;
}

.theme-poster-preview-img-contain-full {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.theme-poster-preview-img-cover {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none;
}

.poster-preview-lightbox-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.78);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.poster-preview-lightbox-dialog {
    position: relative;
    width: min(100%, 1080px);
    max-height: 96vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.poster-preview-lightbox-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 1;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 999px;
}

.poster-preview-zoom-hint {
    position: absolute;
    left: 50%;
    top: 0.75rem;
    transform: translateX(-50%);
    z-index: 1;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #f9fafb;
    background: rgba(17, 24, 39, 0.78);
    backdrop-filter: blur(2px);
    pointer-events: none;
    white-space: nowrap;
}

.poster-preview-lightbox-img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    touch-action: none;
    cursor: grab;
    border-radius: 0.5rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    background: #111827;
}

@media (min-width: 769px) {
    .poster-preview-zoom-hint {
        display: none;
    }
}

/* Token list calendar view */
.agenda-token-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.agenda-token-calendar-weekday {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    color: var(--bs-secondary-color);
    padding: 0.25rem 0;
}

.agenda-token-calendar-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 44px;
    padding: 0.25rem 0.15rem 0.15rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    background: transparent;
    color: inherit;
    font-size: 0.875rem;
    line-height: 1.2;
}

.agenda-token-calendar-day:hover:not(:disabled) {
    background: var(--bs-light);
}

.agenda-token-calendar-day-outside {
    opacity: 0.35;
}

.agenda-token-calendar-day-today .agenda-token-calendar-day-num {
    font-weight: 700;
}

.agenda-token-calendar-day-selected {
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.08);
}

.agenda-token-calendar-day-has-activities .agenda-token-calendar-day-num {
    font-weight: 600;
}

.agenda-token-calendar-activity {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0.875rem;
    margin-top: 0.125rem;
}

.agenda-token-calendar-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bs-primary);
}

.agenda-token-calendar-count {
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--bs-primary);
    line-height: 1;
}

/* Rich HTML from RichTextEditor (theme message, announcements, etc.) */
.rich-html-content {
    overflow-wrap: anywhere;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.rich-html-content :where(p, div, span, li, td, th, a) {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.rich-html-content img {
    max-width: 100%;
    height: auto;
}

/* Dashboard theme list: allow flex column to shrink below long unbroken text */
.theme-list-item-content {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}
