/* ==========================================================================
   Component Library Base CSS
   Modern CSS reset and foundation styles
   ========================================================================== */

/* ========================================
   BOX SIZING
   ======================================== */

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

/* ========================================
   DOCUMENT
   ======================================== */

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
    scroll-behavior: smooth;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1, "liga" 1;
    hanging-punctuation: first last;
}

/* ========================================
   BODY
   ======================================== */

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family-base, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
    font-size: var(--font-size-base, 0.875rem);
    font-weight: var(--font-weight-normal, 400);
    line-height: var(--line-height-base, 1.5);
    color: var(--color-text, #000);
    background-color: var(--color-background, #fff);
}

/* ========================================
   TYPOGRAPHY RESET
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-family: var(--font-family-display, var(--font-family-base));
    font-weight: var(--font-weight-semibold, 600);
    line-height: var(--line-height-tight, 1.25);
    text-wrap: balance;
    letter-spacing: -0.02em;
}

h1 {
    font-size: var(--font-size-h1, 2rem);
    font-weight: var(--font-weight-bold, 700);
    letter-spacing: -0.025em;
}

h2 {
    font-size: var(--font-size-h2, 1.5rem);
    letter-spacing: -0.02em;
}

h3 {
    font-size: var(--font-size-h3, 1.125rem);
    letter-spacing: -0.015em;
}

h4 {
    font-size: var(--font-size-lg, 1.0625rem);
    letter-spacing: -0.01em;
}

h5 {
    font-size: var(--font-size-md, 0.9375rem);
    font-weight: var(--font-weight-medium, 500);
}

h6 {
    font-size: var(--font-size-base, 0.875rem);
    font-weight: var(--font-weight-medium, 500);
}

p {
    margin: 0;
    text-wrap: pretty;
}

/* Long-form text styling */
.prose p {
    margin-bottom: 1em;
}

    .prose p:last-child {
        margin-bottom: 0;
    }

/* ========================================
   LISTS
   ======================================== */

ol, ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ========================================
   LINKS
   ======================================== */

a {
    background-color: transparent;
    color: inherit;
    text-decoration: none;
    transition: var(--transition-colors, color 0.15s ease-out, background-color 0.15s ease-out);
}

    a:hover {
        text-decoration: underline;
        text-underline-offset: 0.15em;
    }

/* Links within body text */
.prose a,
p a {
    color: var(--color-primary, rgb(92, 67, 244));
    text-decoration: underline;
    text-decoration-color: var(--color-primary-light, rgba(92, 67, 244, 0.3));
    text-underline-offset: 0.15em;
    transition: var(--transition-colors);
}

    .prose a:hover,
    p a:hover {
        text-decoration-color: currentColor;
    }

/* ========================================
   TEXT ELEMENTS
   ======================================== */

b,
strong {
    font-weight: var(--font-weight-bold, 700);
}

small {
    font-size: 80%;
}

sub,
sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

sub {
    bottom: -0.25em;
}

sup {
    top: -0.5em;
}

abbr[title] {
    border-bottom: none;
    text-decoration: underline dotted;
    cursor: help;
}

/* ========================================
   CODE & PREFORMATTED
   ======================================== */

code,
kbd,
samp,
pre {
    font-family: var(--font-family-mono, "Roboto Mono", monospace);
    font-size: 0.9em;
}

code {
    padding: 0.2em 0.4em;
    border-radius: var(--border-radius-sm, 3px);
    background-color: var(--color-surface, #fafafa);
    border: 1px solid var(--color-border, rgba(0, 0, 0, 0.1));
    font-weight: 500;
}

kbd {
    padding: 0.2em 0.4em;
    border-radius: var(--border-radius-sm, 3px);
    background-color: var(--color-surface-darkened, #f0f0f0);
    border: 1px solid var(--color-border-medium, rgba(0, 0, 0, 0.15));
    box-shadow: 0 1px 0 var(--color-border-medium, rgba(0, 0, 0, 0.15));
    font-weight: 500;
}

pre {
    margin: 0;
    overflow-x: auto;
    white-space: pre;
    padding: var(--spacing-lg, 24px);
    border-radius: var(--border-radius-md, 10px);
    background-color: var(--color-surface, #fafafa);
    border: 1px solid var(--color-border, rgba(0, 0, 0, 0.1));
    line-height: 1.6;
}

    pre code {
        padding: 0;
        background-color: transparent;
        border: none;
        font-weight: normal;
    }

/* ========================================
   HORIZONTAL RULE
   ======================================== */

hr {
    box-sizing: content-box;
    height: 0;
    overflow: visible;
    border: 0;
    border-top: 1px solid var(--color-border, rgba(0, 0, 0, 0.1));
    margin: var(--spacing-md, 16px) 0;
}

/* ========================================
   IMAGES & MEDIA
   ======================================== */

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

img {
    border-style: none;
    vertical-align: middle;
}

/* ========================================
   FORMS
   ======================================== */

form {
    margin: 0;
}

input,
optgroup,
select,
textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: 1.15;
    margin: 0;
}

input {
    overflow: visible;
}

select {
    text-transform: none;
}

[type="button"],
[type="reset"],
[type="submit"] {
    -webkit-appearance: button;
    cursor: pointer;
}

    [type="button"]::-moz-focus-inner,
    [type="reset"]::-moz-focus-inner,
    [type="submit"]::-moz-focus-inner {
        border-style: none;
        padding: 0;
    }

fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

legend {
    box-sizing: border-box;
    color: inherit;
    display: table;
    max-width: 100%;
    padding: 0;
    white-space: normal;
}

progress {
    vertical-align: baseline;
}

textarea {
    overflow: auto;
    resize: vertical;
}

[type="checkbox"],
[type="radio"] {
    box-sizing: border-box;
    padding: 0;
}

[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
    height: auto;
}

[type="search"] {
    -webkit-appearance: textfield;
    outline-offset: -2px;
}

    [type="search"]::-webkit-search-decoration {
        -webkit-appearance: none;
    }

::-webkit-file-upload-button {
    -webkit-appearance: button;
    font: inherit;
}

/* ========================================
   INTERACTIVE ELEMENTS
   ======================================== */

details {
    display: block;
}

summary {
    display: list-item;
    cursor: pointer;
}

/* ========================================
   HIDDEN & TEMPLATE
   ======================================== */

template,
[hidden] {
    display: none;
}

/* ========================================
   INTERACTIVE COMMAND ELEMENTS
   ======================================== */

.command {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

    .command::selection {
        background: transparent;
    }

/* ========================================
   FOCUS STATES (Accessibility)
   ======================================== */

:focus-visible {
    outline: 2px solid var(--color-primary, rgb(92, 67, 244));
    outline-offset: 2px;
    border-radius: var(--border-radius-sm, 3px);
}

/* Enhanced focus ring with glow for primary interactions */
[role="button"]:focus-visible,
[tabindex="0"]:focus-visible {
    outline: 2px solid var(--color-primary, rgb(92, 67, 244));
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--color-primary-lighter, rgba(92, 67, 244, 0.15));
}

/* Remove focus for mouse users */
a:focus:not(:focus-visible),
[role="button"]:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

/* Form element focus */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: none;
    border-color: var(--color-primary, rgb(92, 67, 244));
    box-shadow: 0 0 0 3px var(--color-primary-lighter, rgba(92, 67, 244, 0.15));
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========================================
   SELECTION
   ======================================== */

::selection {
    background-color: var(--color-primary-light, rgba(62, 77, 255, 0.2));
    color: var(--color-text, #000);
}

/* ========================================
   SCROLLBAR (WebKit & Firefox)
   ======================================== */

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-medium, rgba(0, 0, 0, 0.15)) transparent;
}

/* WebKit scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border-medium, rgba(0, 0, 0, 0.15));
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: content-box;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--color-border-semi, rgba(0, 0, 0, 0.35));
        border: 2px solid transparent;
        background-clip: content-box;
    }

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

.loading {
    animation: none;
}

/* Notification badge */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--color-accent);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: var(--font-size-sm);
    min-width: 18px;
    text-align: center;
    display: none;
    z-index: var(--z-index-tooltip);
}


/* Footer */
#Ftr_Main {
    background-color: rgb(42, 2, 90);
    color: var(--color-background);
    height: auto;
    display: block;
    position: relative;
    float: left;
    clear: both;
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

    #Ftr_Main a {
        color: rgb(67, 183, 255);
        font-size: var(--font-size-xs);
        line-height: 20px;
    }

    #Ftr_Main #Copyright {
        width: 100%;
        text-align: center;
        margin: 10px 0;
        font-size: var(--font-size-xs);
        font-weight: var(--font-weight-light);
        line-height: 20px;
        display: flex;
        flex-wrap: wrap;
        flex-direction: row;
        column-gap: var(--spacing-sm);
        justify-content: center;
        align-items: center;
    }

/* HUD Status - consolidated duplicate rules */
#Hud_Status {
    background-color: rgb(22, 2, 66);
    text-transform: none;
}

/* Hidden commands */
#Cmd_Favorites,
#Cmd_Calendar {
    display: none;
}

/* Timestamp components */
.timestamp[data-key="timestamp.published"],
.timestamp[data-key="timestamp.draft-saved"] {
    position: relative;
    transition: all var(--transition-fast);
}

    .timestamp[data-key="timestamp.published"]:hover,
    .timestamp[data-key="timestamp.draft-saved"]:hover {
        color: var(--color-text);
        font-weight: var(--font-weight-medium);
    }

    .timestamp[data-key="timestamp.published"][ux-date-format]:hover::after,
    .timestamp[data-key="timestamp.draft-saved"][ux-date-format]:hover::after {
        content: attr(data-relative-time);
        position: absolute;
        bottom: 100%;
        left: 0;
        background: var(--color-text);
        color: white;
        padding: var(--spacing-xs) var(--spacing-sm);
        border-radius: var(--border-radius-sm);
        font-size: var(--font-size-xs);
        white-space: nowrap;
        z-index: var(--z-index-tooltip);
        box-shadow: var(--shadow-sm);
    }

/* Media queries */
@media only screen and (min-width: 1025px) {
    #Mod_Document .documentList .document:nth-child(3n+3) {
        margin-right: 0;
    }

    #Mod_Document .documentList .document:nth-child(3n+1) {
        margin-left: 0;
    }

    #Mod_Document .documentList[document-extra="1"] .document[data-last] {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    #Mod_Document .documentList[document-extra="2"] .document[data-2last] {
        width: calc(50% - 20px);
        margin-right: 20px;
        margin-left: 0;
    }

    #Mod_Document .documentList[document-extra="2"] .document[data-last] {
        width: calc(50% - 20px);
        margin-left: 20px;
        margin-right: 0;
    }
}

@media only screen and (max-width: 1024px) and (min-width: 641px) {
    #Mod_Document .documentList .document {
        width: calc(50% - 20px);
        margin: 0 20px 30px;
    }

        #Mod_Document .documentList .document:nth-child(2n+2) {
            margin-right: 0;
        }

        #Mod_Document .documentList .document:nth-child(2n+1) {
            margin-left: 0;
        }

    #Mod_Document .documentList[document-2extra="1"] .document[data-last] {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

#Content {
    min-height: calc(100dvh - 40px);
}

@media only screen and (max-width: 850px) {
    #Content {
        padding: 0;
        margin: 0;
    }
}

@media only screen and (max-width: 760px) {
    #Mod_Document {
        padding: 0;
    }

    .viewContent #Hero h2 {
        font-size: 42px;
        line-height: 50px;
    }
}

@media only screen and (max-width: 740px) {
    #Cnt_Content #Sidebar {
        width: 0;
        transition: width 0.15s ease-in;
        z-index: 11;
        top: 60px;
    }

    .viewContent #Hero {
        height: 80px;
    }

        .viewContent #Hero h2 {
            font-size: var(--font-size-lg);
            line-height: 22px;
            top: 10px;
        }

        .viewContent #Hero .command {
            width: 17px;
            height: 11px;
            bottom: 10px;
            margin-left: -8px;
        }

            .viewContent #Hero .command:hover {
                bottom: 11px;
            }
}

@media only screen and (max-width: 640px) {
    #Mod_Document .documentList .document {
        width: 100%;
        margin: 0 0 40px;
    }

    #Mod_Information {
        width: 100%;
        margin: 0 auto;
        padding: 20px;
        position: relative;
        top: 0;
        left: 0;
    }
}

@media only screen and (max-width: 600px) {
    #Body[page-name="404"] #Content #Mod_Information {
        max-width: 100%;
        padding-top: 0;
        padding-bottom: 20px;
    }
}

#Hud_Status {
    top: 3px;
    left: 0;
    position: fixed;
    background-color: transparent;
    width: 100%;
    line-height: initial;
    font-size: 13px;
    box-sizing: border-box;
    min-height: 50px;
    z-index: 2000;
    text-transform: none;
    color: rgba(255, 255, 255, 1);
    text-align: center;
    padding-left: 7px;
    padding-right: 7px;
    text-transform: uppercase;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
}

    #Hud_Status .text {
        width: auto;
        display: flex;
        flex: 0 0 auto;
        height: auto;
        width: auto;
        max-width: calc(100vw - 2 * var(--spacing-lg));
        line-height: initial;
        align-items: center;
        align-self: center;
        justify-self: center;
        background: linear-gradient(135deg, rgba(34, 206, 206, 0.7), rgba(105, 105, 255, 0.7));
        position: relative;
        padding: var(--spacing-sm) var(--spacing-lg);
        border-radius: var(--border-radius-full);
        color: #fff;
        text-shadow: 0 0 10px rgba(0,0,0,0.5);
        text-align: center;
        text-transform: none;
    }

#Progress_Indeterminate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000;
}

    #Progress_Indeterminate .bar {
        height: 3px;
        width: 100%;
        position: relative;
        overflow: hidden;
        background-color: rgba(133, 199, 246, 0.5);
    }

@keyframes loader-progress-indeterminate {
    from {
        left: -10px;
    }

    50% {
        width: 100%;
    }

    to {
        left: 100%;
    }
}

#Progress_Indeterminate .bar:before {
    display: block;
    position: absolute;
    content: "";
    left: -10px;
    width: 10px;
    height: 3px;
    background-color: #85C7F6;
    animation: loader-progress-indeterminate 1.5s linear infinite;
}

#AutocompleteBlock {
    position: absolute;
    top: 0;
    left: -9999px;
}


/* Maps */
.mapContainer {
    width: 100%;
    position: fixed;
    padding: 0px;
    float: left;
    top: 0px;
    left: 0px;
    height: 100%;
    box-sizing: border-box;
    z-index: 3;
    margin: 0px;
    max-height: 100%;
}

.mapContainer .map {
    position: absolute;
    height: 100%;
    inset: 0px;
    width: 100%;
}


.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl {
    width: initial;
}

/* ==========================================================================
   Location Map Dialog
   Shows meetup location with conditional address visibility
   ========================================================================== */

/* Dialog body - full height flex container */
.location-map-dialog > .dialog-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Scroll content area - flex column with padding */
.location-map-dialog .location-map-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    flex: 1;
    overflow: hidden;
}

/* Location Header - icon + details */
.location-map-header {
    --icon-size: var(--icon-size-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--gradient-card-base);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    flex-shrink: 0;
}

/* Location Icon - uses component library icon-svg pattern */
.location-map-header .icon-pin {
    background-image: url(/images/icon/pin-primary.svg);
}

.location-map-details {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.location-map-name {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-warm);
    margin: 0 0 var(--spacing-xs) 0;
    text-align: left;
}
#LocationName_Map.location-map-name {
    text-align: left;
}

.location-map-address {
    font-size: var(--font-size-sm);
    color: var(--color-text-warm-body);
    line-height: 1.4;
    text-align: left;
}

.location-map-postal {
    font-size: var(--font-size-sm);
    color: var(--color-text-warm-muted);
    margin-top: var(--spacing-xs);
    text-align: left;
}

/* Hide address elements when empty */
.location-map-address:empty,
.location-map-postal:empty {
    display: none;
}

/* Map Container - fills available space */
.location-map-container {
    flex: 1 1 auto;
    min-height: 250px;
    height: 100%;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.location-map-container .map {
    width: 100%;
    height: 100%;
    min-height: 250px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Privacy Notice - styled per component library */
.location-map-notice {
    flex-shrink: 0;
}

.location-map-notice .notice-banner p {
    margin: var(--spacing-xs) 0 0 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-warm-body);
}

/* Footer Actions */
.location-map-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex: 1;
}

.location-map-actions .command {
    flex: 1;
}

/* ==========================================================================
   Visibility Rules - based on data-has-full-address attribute on dialog
   ========================================================================== */

/* When address IS available (public location): show actions, hide notice */
.location-map-dialog[data-has-full-address="true"] .location-map-notice {
    display: none;
}

.location-map-dialog[data-has-full-address="true"] .location-map-actions {
    display: flex;
}

/* When address is NOT available (private location): show notice, hide actions */
.location-map-dialog[data-has-full-address="false"] .location-map-notice {
    display: block;
}

.location-map-dialog[data-has-full-address="false"] .location-map-actions {
    display: none;
}

#Dlg_MeetupLocationOnboarding .mapContainer {
    margin: var(--spacing-md) 0;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    position: relative;
    top: 0;
    left: 0;
}

.map canvas { height:100%; width: 100%; }

#Dlg_MeetupLocationOnboarding .map {
}

/* ==========================================================================
   Map Loading State (for lazy-loaded Mapbox)
   ========================================================================== */

.map.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface, #f8f9fa);
}

.map-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm, 8px);
    color: var(--color-text-muted, #6c757d);
}

.map-loader-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border, #dee2e6);
    border-top-color: var(--color-primary, #5c43f4);
    border-radius: 50%;
    animation: map-loader-spin 0.8s linear infinite;
}

.map-loader-text {
    font-size: var(--font-size-sm, 14px);
}

.map.map-error {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface, #f8f9fa);
}

.map-error-text {
    color: var(--color-error, #dc3545);
    font-size: var(--font-size-sm, 14px);
}

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

.dialog .mapboxgl-popup-content h3 {
    text-transform: none;
    font-size: var(--font-size-md);
}

.dialog .mapboxgl-popup-content p {
    text-transform: none;
    font-size: var(--font-size-sm);
}

#Dlg_DeliveryLocation .mapboxgl-popup-content .command h3 {
    font-size: var(--time-place-popup-h3-font-size);
    line-height: var(--time-place-popup-h3-line-height);
    text-transform: none;
}

#Dlg_DeliveryLocation[ux-selection] .mapboxgl-popup-content .command p {
    display: none;
}