/* ==========================================================================
   Nocturne design system (GorzowTraveler redesign)
   Tokens come from the Claude Design export (Nocturne theme). Everything is
   prefixed with `nx` so it can live next to the legacy styles until every
   page has been migrated to NocturneLayout.
   ========================================================================== */

:root {
    /* colour */
    --nx-bg: #161826;
    --nx-side: #1c1e2d;
    --nx-surface: #232532;
    --nx-card: #232532;
    --nx-text: #e9e9ed;
    --nx-muted: #9397ab;
    --nx-accent: #9184d9;
    --nx-accent-text: #d2cefd;
    --nx-divider: rgba(233, 233, 237, .16);
    --nx-line: #595d6c;
    --nx-tint: #2b2741;
    --nx-tint-text: #d2cefd;
    --nx-error: #f0a0a0;
    --nx-ok-bg: #4ade80;
    --nx-ok-text: #0b2a17;
    --nx-warn-bg: #fbbf24;
    --nx-warn-text: #3a2600;
    --nx-full-bg: #f87171;
    --nx-full-text: #3b0b0b;

    /* shape */
    --nx-radius: 8px;
    --nx-radius-sm: 4px;
    --nx-radius-btn: 8px;
    --nx-shadow: 0 0 0 1px #3f424d;
    --nx-shadow-lg: 0 0 0 1px #595d6c, 0 16px 40px rgba(0, 0, 0, .65);

    /* type */
    --nx-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --nx-font-serif: 'Playfair Display', Georgia, serif;
    --nx-font-hero: 'Unbounded', 'Inter', system-ui, sans-serif;
    /* Congenial Black (paid) is not licensed yet: Nunito 800 is the stand-in.
       When the webfont is bought, put it first in this stack. */
    --nx-font-display: 'Nunito', 'Inter', system-ui, sans-serif;
    --nx-gradient-text: linear-gradient(95deg, #ffe29a 0%, #ffb86b 30%, #ff8fa3 60%, #c9b8ff 100%);

    /* fluid sizes: desktop values, overridden below */
    --nx-pad: 40px;
    --nx-h1: 44px;
    --nx-h2: 28px;
    --nx-lead: 22px;
    --nx-hero-fs: 54px;
    --nx-hero-h: 300px;
    --nx-sidebar-w: 248px;
    --nx-gap: 28px;
}

@media (max-width: 1023.98px) {
    :root {
        --nx-pad: 28px;
        --nx-h1: 36px;
        --nx-h2: 24px;
        --nx-lead: 20px;
        --nx-hero-fs: 44px;
        --nx-hero-h: 300px;
    }
}

@media (max-width: 640.98px) {
    :root {
        --nx-pad: 16px;
        --nx-h1: 29px;
        --nx-h2: 21px;
        --nx-lead: 18px;
        --nx-hero-fs: 29px;
        --nx-hero-h: 270px;
    }
}

/* The page background must also cover overscroll areas. */
body:has(.nx-app) {
    background: var(--nx-bg);
}

.nx-app {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--nx-bg);
    color: var(--nx-text);
    font-family: var(--nx-font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

.nx-app *, .nx-app *::before, .nx-app *::after {
    box-sizing: border-box;
}

.nx-app a {
    color: var(--nx-accent-text);
}

.nx-app img {
    max-width: 100%;
}

/* ---- shared building blocks ------------------------------------------- */

.nx-sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.nx-app :focus-visible {
    outline: 2px solid var(--nx-accent-text);
    outline-offset: 2px;
}

/* Gradient headings (Congenial Black in the design, Nunito 800 for now). */
.nx-grad-text {
    font-family: var(--nx-font-display);
    font-weight: 800;
    line-height: 1.3;
    margin: 0;
    padding: .2em .35em .3em .15em;
    background: var(--nx-gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .7));
}

/* Round prev/next buttons used by carousels. */
.nx-arrow {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(145, 132, 217, .7);
    background: rgba(22, 24, 38, .72);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--nx-text);
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
    transition: opacity .2s, transform .2s, background .2s;
}

.nx-arrow:hover {
    background: rgba(66, 58, 106, .9);
    transform: scale(1.08);
}

.nx-arrow[disabled] {
    opacity: 0;
    pointer-events: none;
}

.nx-arrow svg {
    width: 24px;
    height: 24px;
}

/* Status chips (Відкрито / Мало місць / Заповнено). */
.nx-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--nx-radius-btn);
    font: 700 12px/1.2 var(--nx-font);
    white-space: nowrap;
}

.nx-chip--ok { background: var(--nx-ok-bg); color: var(--nx-ok-text); }
.nx-chip--warn { background: var(--nx-warn-bg); color: var(--nx-warn-text); }
.nx-chip--full { background: var(--nx-full-bg); color: var(--nx-full-text); }
.nx-chip--date { background: linear-gradient(95deg, #ffe29a, #ffb86b); color: #161826; font-size: 13px; padding: 6px 12px; }

@media (prefers-reduced-motion: reduce) {
    .nx-app *, .nx-app *::before, .nx-app *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Lock page scroll while the mobile drawer is open. */
@media (max-width: 1023.98px) {
    html[data-nx-menu="open"] {
        overflow: hidden;
    }
}

/* Favourite (heart) button: used by FavoriteButton.razor and the anonymous login link. */
.nx-fav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--nx-text);
    cursor: pointer;
    text-decoration: none;
}

.nx-fav-disc {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(22, 24, 38, .82);
    transition: transform .15s ease, background .15s ease;
}

.nx-fav:hover .nx-fav-disc {
    transform: scale(1.08);
    background: rgba(43, 39, 65, .95);
}

.nx-fav--on {
    color: var(--nx-error);
}

.nx-fav[disabled] {
    cursor: progress;
    opacity: .7;
}

.nx-arrow[hidden] {
    display: none;
}

/* Standard inner page: gold-map backdrop + padding. Home has its own hero layout. */
.nx-page {
    flex: 1;
    padding: calc(var(--nx-pad) * .8) var(--nx-pad) calc(var(--nx-pad) * 1.4);
    background: linear-gradient(rgba(22, 24, 38, .5), rgba(22, 24, 38, .6)),
                url('/img/home/gold-map.webp') center / cover #161826;
    background-attachment: scroll, fixed;
}

.nx-page-title {
    display: inline-block;
    font-size: calc(var(--nx-h1) * .9);
    line-height: 1.5;
}

/* ---- tooltips ------------------------------------------------------------
   Replaces the browser's native `title` tooltip inside .nx-app (see nocturne.js).
   The element lives in <body> (outside .nx-app) so it is never clipped by a
   card's overflow; font/colours therefore come from :root tokens. */
.nx-tip {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    box-sizing: border-box;
    max-width: 260px;
    padding: 7px 12px;
    border: 1px solid rgba(201, 184, 255, .3);
    border-radius: var(--nx-radius);
    background: linear-gradient(180deg, #332d52, #2b2741);
    color: var(--nx-tint-text);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .55);
    font: 600 13px/1.35 var(--nx-font);
    letter-spacing: .01em;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .14s ease, transform .14s ease;
}

.nx-tip[data-side="bottom"] {
    transform: translateY(-4px);
}

.nx-tip.is-open {
    opacity: 1;
    transform: none;
}

.nx-tip::after {
    content: "";
    position: absolute;
    left: var(--nx-tip-arrow, 50%);
    width: 9px;
    height: 9px;
    margin-left: -5px;
    background: #2b2741;
    transform: rotate(45deg);
}

.nx-tip[data-side="top"]::after {
    bottom: -5px;
    border-right: 1px solid rgba(201, 184, 255, .3);
    border-bottom: 1px solid rgba(201, 184, 255, .3);
}

.nx-tip[data-side="bottom"]::after {
    top: -5px;
    background: #332d52;
    border-left: 1px solid rgba(201, 184, 255, .3);
    border-top: 1px solid rgba(201, 184, 255, .3);
}

@media (prefers-reduced-motion: reduce) {
    .nx-tip {
        transition: none;
    }
}

/* Inner page with a vertical rhythm (title, toolbars, content). */
.nx-page--stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.nx-page--stack > .nx-page-title {
    align-self: center;
    font-size: calc(var(--nx-h1) * 1.05);
    text-align: center;
}

/* Tablet/phone: the title stays centered, but the floating contact button sits at the top-right, so keep clear of it.
   Tablet: the button has a text label (too wide to leave side margins), so the title starts just below it.
   Phone: the button is a round icon, so the title keeps equal side margins and wraps to two lines when long. */
@media (max-width: 1023.98px) {
    .nx-page--stack > .nx-page-title {
        align-self: center;
        margin-top: 52px;
        font-size: calc(var(--nx-h1) * .88);
        text-align: center;
    }
}

@media (max-width: 640.98px) {
    .nx-page--stack > .nx-page-title {
        max-width: calc(100% - 128px);
        margin-top: 0;
        font-size: calc(var(--nx-h1) * .8);
    }
}

/* ==========================================================================
   Dialogs (Radzen DialogService, opened with NxDialog.Comments()/Form()).
   The Radzen dialog is only the frame; the look and the controls are ours.
   Dialogs may live outside .nx-app, so colours/fonts are set on .nx-dialog itself.
   ========================================================================== */

body:has(.nx-dialog) .rz-dialog-mask {
    background: rgba(10, 10, 14, .6);
    opacity: 1;
}

.nx-dialog.rz-dialog,
.nx-dialog.rz-dialog *,
.nx-dialog.rz-dialog *::before,
.nx-dialog.rz-dialog *::after {
    box-sizing: border-box;
}

.nx-dialog.rz-dialog {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    max-width: calc(100vw - 24px);
    max-height: 92vh;
    max-height: 92dvh;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--nx-divider);
    border-radius: var(--nx-radius);
    background: linear-gradient(180deg, rgba(22, 24, 38, .74), rgba(22, 24, 38, .9) 45%, rgba(22, 24, 38, .95)),
                var(--nxd-bg, none) center top / cover #161826;
    box-shadow: var(--nx-shadow-lg);
    color: var(--nx-text);
    font: 400 15px/1.5 var(--nx-font);
}

.nx-dialog--comments {
    --nxd-bg: url('/img/home/dialog-comments.webp');
}

.nx-dialog--form {
    --nxd-bg: url('/img/home/dialog-form.webp');
}

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

/* Phone: bottom sheet. */
@media (max-width: 640.98px) {
    .nx-dialog.rz-dialog {
        top: auto !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: none;
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 16px 16px 0 0;
    }
}

.nxd-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.nxd-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 8px;
}

.nxd-heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.nxd-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--nx-accent);
    font: 600 10px var(--nx-font);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.nxd-title {
    margin: 0;
    font: 600 18px/1.2 var(--nx-font);
    overflow-wrap: anywhere;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .6);
}

.nxd-close {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: -8px -8px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--nx-muted);
    cursor: pointer;
}

.nxd-close:hover {
    color: var(--nx-text);
}

.nxd-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    padding: 4px 16px 16px;
    overflow-y: auto;
}

.nxd-foot {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--nx-divider);
    background: rgba(22, 24, 38, .85);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.nxd-grid {
    display: grid;
    grid-template-columns: repeat(var(--nxd-cols, 2), minmax(0, 1fr));
    gap: 12px;
}

.nxd-grid--3 {
    --nxd-cols: 3;
}

@media (max-width: 640.98px) {
    .nxd-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.nxd-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    color: var(--nx-muted);
    font: 600 12px var(--nx-font);
}

.nxd-input {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--nx-line);
    border-radius: var(--nx-radius-sm);
    background: rgba(22, 24, 38, .7);
    color: var(--nx-text);
    color-scheme: dark;
    font: 400 15px var(--nx-font);
}

.nxd-input::placeholder {
    color: var(--nx-muted);
}

.nxd-input:hover,
.nxd-input:focus-visible {
    border-color: var(--nx-accent);
    outline: none;
}

.nxd-input option {
    background: var(--nx-card);
    color: var(--nx-text);
}

.nxd-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    color: var(--nx-text);
    font: 500 14px var(--nx-font);
    cursor: pointer;
}

.nxd-check input {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--nx-accent);
}

.nxd-fieldset {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    margin: 0;
    padding: 12px 14px 14px;
    border: 1px solid var(--nx-divider);
    border-radius: var(--nx-radius);
    background: rgba(22, 24, 38, .5);
}

.nxd-fieldset > legend {
    padding: 0 6px;
    color: var(--nx-accent);
    font: 600 11px var(--nx-font);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.nxd-alert {
    padding: 10px 12px;
    border: 1px solid rgba(248, 113, 113, .5);
    border-radius: var(--nx-radius-sm);
    background: rgba(248, 113, 113, .12);
    color: var(--nx-error);
    font: 500 14px var(--nx-font);
}

.nxd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 44px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--nx-accent);
    border-radius: var(--nx-radius-btn);
    background: transparent;
    color: var(--nx-accent-text);
    font: 600 15px var(--nx-font);
    cursor: pointer;
}

.nxd-btn:hover:not(:disabled) {
    background: var(--nx-tint);
}

.nxd-btn--primary {
    background: var(--nx-accent);
    color: #161826;
}

.nxd-btn--primary:hover:not(:disabled) {
    background: #a89cea;
}

.nxd-btn--ghost {
    border-color: var(--nx-divider);
    color: var(--nx-text);
}

.nxd-btn--sm {
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
}

.nxd-btn:disabled {
    opacity: .5;
    cursor: default;
}

.nxd-icon-btn {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--nx-radius-btn);
    background: transparent;
    color: var(--nx-muted);
    cursor: pointer;
}

.nxd-icon-btn:hover {
    background: var(--nx-tint);
    color: var(--nx-error);
}

.nxd-spin {
    width: 28px;
    height: 28px;
    margin: 24px auto;
    border: 3px solid var(--nx-divider);
    border-top-color: var(--nx-accent);
    border-radius: 50%;
    animation: nxd-spin .8s linear infinite;
}

@keyframes nxd-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .nxd-spin { animation-duration: 2.4s; }
}

/* ---- toasts (Radzen NotificationService) ------------------------------------------------------ */

.rz-notification .rz-notification-item {
    border: 1px solid var(--nx-divider);
    border-left-width: 4px;
    border-radius: var(--nx-radius);
    background: var(--nx-card);
    box-shadow: var(--nx-shadow-lg);
    color: var(--nx-text);
    font-family: var(--nx-font);
}

.rz-notification .rz-notification-item.rz-notification-success { border-left-color: var(--nx-ok-bg); }
.rz-notification .rz-notification-item.rz-notification-error { border-left-color: var(--nx-full-bg); }
.rz-notification .rz-notification-item.rz-notification-info { border-left-color: var(--nx-accent); }
.rz-notification .rz-notification-item.rz-notification-warning { border-left-color: var(--nx-warn-bg); }

/* ---- dialog extras ------------------------------------------------------------------------------ */

.nxd-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.nxd-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border: 1px solid var(--nx-divider);
    border-radius: var(--nx-radius-btn);
    background: rgba(22, 24, 38, .7);
    color: var(--nx-text);
    font: 600 12px var(--nx-font);
}

.nxd-chip svg {
    flex: none;
    color: var(--nx-accent);
}

textarea.nxd-input {
    min-height: 88px;
    padding: 10px 12px;
    line-height: 1.4;
    resize: vertical;
}

.nxd-input--error {
    border-color: var(--nx-error);
}

.nxd-error {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--nx-error);
    font: 400 12px var(--nx-font);
}

.nxd-note {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--nx-divider);
    border-radius: var(--nx-radius-sm);
    background: rgba(22, 24, 38, .5);
    color: var(--nx-muted);
    font-size: 13px;
}

.nxd-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nxd-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font: 600 15px var(--nx-font);
}

.nxd-disc {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(145, 132, 217, .2);
    color: var(--nx-accent);
}

.nxd-spin--sm {
    width: 16px;
    height: 16px;
    margin: 0;
    border-width: 2px;
}

/* Sidebar of staff accounts: the extra "Адміністрування" group makes the menu longer, so rows and logo are
   denser (they follow the window height) and everything still fits without scrolling on ordinary screens. */
.nx-app .nx-sidebar:has([data-nx-fold="admin"]) {
    --nx-nav-h: clamp(28px, 4.3vh, 40px);
    --nx-logo: clamp(64px, 13vh, 150px);
}

.nx-app .nx-sidebar:has([data-nx-fold="admin"]) .nx-sidebar-inner {
    gap: clamp(4px, 1vh, 10px);
}

.nx-app .nx-sidebar:has([data-nx-fold="admin"]) .nx-nav {
    padding-block: 4px;
}
