/* ============================================================
 * Stable Chat Page — Individual Stable View
 * A single conversational stream with activity feed.
 * Cinematic, minimal chrome, breathing space.
 * ============================================================ */

/* --- Layout: full-height column ----------------------------- */

.stable-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--nav-height, 64px));
    height: calc(100dvh - var(--nav-height, 64px));
    overflow: hidden;
    background: var(--theme-bg-primary);
    color: var(--theme-text-primary);
}

/* --- Header (sticky course context) ------------------------ */

.stable-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: var(--theme-surface-1);
    border-bottom: 1px solid var(--theme-border-color);
    position: relative;
    z-index: 10;
}

/* Subtle bottom glow to separate header from feed */
.stable-header::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.05),
        transparent
    );
    pointer-events: none;
}

[data-bs-theme="dark"] .stable-header::after {
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.25),
        transparent
    );
}

.stable-header__course {
    flex: 1;
    min-width: 0;
}

.stable-header__course-name {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--theme-text-primary);
}

.stable-header__location {
    display: block;
    font-size: 0.8rem;
    color: var(--theme-text-muted);
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stable-header__info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
}

/* Period badge — colored pill */
.stable-header__period-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: linear-gradient(
        135deg,
        var(--theme-primary),
        var(--theme-info)
    );
    color: #fff;
}

.stable-header__member-count {
    font-size: 0.8rem;
    color: var(--theme-text-secondary);
    white-space: nowrap;
}

.stable-header__member-count i {
    margin-right: 0.25rem;
    opacity: 0.7;
}

.stable-header__active-pulse {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--theme-success);
    white-space: nowrap;
}

/* --- Pulse dot (online/active indicator) -------------------- */

.pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--theme-success);
    position: relative;
    flex-shrink: 0;
}

.pulse-dot::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--theme-success);
    animation: pulse-ring 2s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pulse-dot::after {
        animation: none;
        opacity: 0;
    }
}

/* --- Header actions (join/leave/notification) --------------- */

.stable-header__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.stable-header__notification-pref {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: auto;
}

.stable-header__notif-icon {
    font-size: 0.8rem;
    color: var(--theme-text-muted);
}

.stable-header__notification-pref .form-select {
    font-size: 0.8rem;
    padding: 0.2rem 1.8rem 0.2rem 0.5rem;
    border-radius: 8px;
    background-color: var(--theme-surface-2);
    color: var(--theme-text-secondary);
    border-color: var(--theme-border-color);
}

/* --- Course link in header ---------------------------------- */

.stable-header__course-link {
    color: var(--theme-text-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.stable-header__course-link:hover {
    color: var(--theme-primary);
    text-decoration: none;
}

/* --- Signup alert setting ----------------------------------- */

.stable-alert-settings {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(
        180deg,
        rgba(var(--flipt-primary-rgb, 0, 166, 156), 0.06),
        transparent
    );
    border-bottom: 1px solid var(--theme-border-color);
}

.stable-alert-settings__toggle {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    color: var(--theme-text-primary);
}

.stable-alert-settings__toggle input[type="checkbox"] {
    margin-top: 0.15rem;
    width: 1rem;
    height: 1rem;
    accent-color: var(--theme-primary);
    flex-shrink: 0;
}

.stable-alert-settings__toggle--disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

.stable-alert-settings__copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.stable-alert-settings__title {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.3;
}

.stable-alert-settings__description,
.stable-alert-settings__note {
    margin: 0;
    font-size: 0.82rem;
    color: var(--theme-text-muted);
    line-height: 1.4;
}

.stable-alert-settings__note {
    padding-left: 1.75rem;
}

/* --- Upcoming events strip ---------------------------------- */

.stable-events-strip {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0.35rem 1.25rem;
    border-bottom: 1px solid var(--theme-border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.stable-events-strip::-webkit-scrollbar {
    display: none;
}

.stable-events-strip__list {
    display: flex;
    gap: 0.375rem;
    flex: 1;
    min-width: 0;
}

.stable-event-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    background: var(--theme-surface-2);
    border: 1px solid var(--theme-border-color);
    border-radius: 999px;
    text-decoration: none;
    color: var(--theme-text-primary);
    flex-shrink: 0;
    font-size: 0.75rem;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.stable-event-pill:hover {
    border-color: var(--theme-primary);
    background: rgba(var(--flipt-primary-rgb, 0, 166, 156), 0.06);
    text-decoration: none;
    color: var(--theme-text-primary);
}

.stable-event-pill:focus-visible {
    outline: 2px solid var(--theme-info);
    outline-offset: 2px;
}

.stable-event-pill__day {
    font-weight: 700;
    white-space: nowrap;
}

.stable-event-pill__league {
    color: var(--theme-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

@media (max-width: 767px) {
    .stable-events-strip {
        padding: 0.25rem 0.75rem;
    }
}

/* --- Member avatar strip ------------------------------------ */

.stable-members-strip {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--theme-surface-1);
    border-bottom: 1px solid var(--theme-border-color);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.stable-members-strip::-webkit-scrollbar {
    display: none;
}

.stable-members-strip__avatar {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--theme-surface-3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: default;
    transition: transform 0.15s ease;
}

.stable-members-strip__avatar:hover {
    transform: scale(1.12);
}

.avatar-initials {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--theme-text-secondary);
    text-transform: uppercase;
    user-select: none;
    line-height: 1;
}

.avatar-online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--theme-success);
    border: 2px solid var(--theme-surface-1);
}

.stable-members-strip__more {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--theme-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--theme-text-muted);
    flex-shrink: 0;
}

/* --- Pinned message banner ---------------------------------- */

.stable-pinned {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: rgba(var(--flipt-primary-rgb, 0, 166, 156), 0.08);
    border-bottom: 1px solid rgba(var(--flipt-primary-rgb, 0, 166, 156), 0.15);
    font-size: 0.85rem;
    color: var(--theme-text-secondary);
}

.stable-pinned > i {
    color: var(--theme-primary);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.stable-pinned__body {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stable-pinned__author {
    color: var(--theme-text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* --- Feed (scrollable center) ------------------------------- */

.stable-feed {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column-reverse;
    padding: 0;
    scroll-behavior: smooth;
    /* For browsers that support it, anchor to bottom */
    overflow-anchor: auto;
}

.stable-feed__items {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
    gap: 2px;
}

/* Loader for older messages (sits at top of natural scroll) */
.stable-feed__loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    font-size: 0.85rem;
    color: var(--theme-text-muted);
}

/* --- Feed message ------------------------------------------- */

.feed-message {
    display: flex;
    gap: 0.625rem;
    padding: 0.375rem 1.25rem;
    position: relative;
    transition: background-color 0.15s ease;
}

.feed-message:hover {
    background: var(--theme-surface-1);
}

/* Show actions on hover */
.feed-message__actions {
    position: absolute;
    top: 0.25rem;
    right: 1rem;
    display: flex;
    gap: 0.125rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    background: var(--theme-surface-2);
    border: 1px solid var(--theme-border-color);
    border-radius: 8px;
    padding: 0.125rem;
    box-shadow: var(--theme-shadow-sm);
}

.feed-message:hover .feed-message__actions,
.feed-message:focus-within .feed-message__actions {
    opacity: 1;
    visibility: visible;
}

.feed-message__avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--theme-surface-3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.125rem;
}

.feed-message__avatar .avatar-initials {
    font-size: 0.8rem;
}

.feed-message__content {
    flex: 1;
    min-width: 0;
}

.feed-message__header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    line-height: 1.3;
}

.feed-message__author {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--theme-text-primary);
}

.feed-message__time {
    font-size: 0.75rem;
    color: var(--theme-text-muted);
    white-space: nowrap;
}

.feed-message__edited {
    font-size: 0.7rem;
    color: var(--theme-text-muted);
    font-style: italic;
}

.feed-message__body {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--theme-text-primary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin-top: 0.1rem;
}

.feed-message__body--deleted {
    opacity: 0.55;
    font-style: italic;
}

/* Deleted message entire row */
.feed-message--deleted {
    opacity: 0.5;
}

.feed-message--deleted .feed-message__avatar {
    opacity: 0.4;
}

/* Message attachments */
.feed-message__attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.375rem;
}

.feed-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.625rem;
    border-radius: 8px;
    border: 1px solid var(--theme-border-color);
    background: var(--theme-surface-2);
    font-size: 0.8rem;
    color: var(--theme-text-secondary);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.feed-attachment:hover {
    background: var(--theme-surface-3);
    border-color: var(--theme-primary);
}

.feed-attachment i {
    color: var(--theme-primary);
    font-size: 0.75rem;
}

.feed-attachment__name {
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feed-attachment__size {
    color: var(--theme-text-muted);
    font-size: 0.7rem;
}

/* Hover action buttons (edit / delete / pin) */
.feed-action {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--theme-text-muted);
    padding: 0.25rem 0.375rem;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    line-height: 1;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.feed-action:hover {
    background: var(--theme-surface-3);
    color: var(--theme-text-primary);
}

.feed-action[data-action="delete"]:hover {
    color: var(--theme-danger);
}

/* --- Inline edit mode --------------------------------------- */

.feed-message--editing .feed-message__body {
    display: none;
}

.feed-message__edit-area {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-top: 0.25rem;
}

.feed-message__edit-input {
    width: 100%;
    min-height: 2.5rem;
    padding: 0.5rem 0.625rem;
    border-radius: 8px;
    border: 1px solid var(--theme-border-color);
    background: var(--theme-surface-2);
    color: var(--theme-text-primary);
    font-size: 0.875rem;
    line-height: 1.45;
    resize: vertical;
    font-family: inherit;
}

.feed-message__edit-input:focus {
    outline: none;
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 2px rgba(var(--flipt-primary-rgb, 0, 166, 156), 0.2);
}

.feed-message__edit-buttons {
    display: flex;
    gap: 0.375rem;
    align-items: center;
}

.feed-message__edit-save,
.feed-message__edit-cancel {
    appearance: none;
    border: none;
    padding: 0.3rem 0.625rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.feed-message__edit-save {
    background: var(--theme-primary);
    color: #fff;
}

.feed-message__edit-save:hover {
    filter: brightness(1.1);
}

.feed-message__edit-cancel {
    background: var(--theme-surface-3);
    color: var(--theme-text-secondary);
}

.feed-message__edit-cancel:hover {
    background: var(--theme-surface-2);
}

/* --- Feed activity items ------------------------------------ */

.feed-activity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 1.25rem 0.3rem 4.375rem; /* aligned with message body text */
    font-size: 0.8rem;
    color: var(--theme-text-muted);
}

.feed-activity__icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.625rem;
    flex-shrink: 0;
}

/* Activity type colors */
.feed-activity--registered .feed-activity__icon {
    background: rgba(var(--flipt-primary-rgb, 0, 166, 156), 0.12);
    color: var(--theme-success);
}

.feed-activity--moved .feed-activity__icon {
    background: rgba(var(--flipt-secondary-rgb, 0, 104, 186), 0.12);
    color: var(--theme-info);
}

.feed-activity--cancelled .feed-activity__icon {
    background: rgba(239, 68, 68, 0.12);
    color: var(--theme-danger);
}

.feed-activity__text {
    flex: 1;
    min-width: 0;
    line-height: 1.35;
}

.feed-activity__text strong {
    font-weight: 700;
    color: var(--theme-text-secondary);
}

.feed-activity__time {
    font-size: 0.7rem;
    color: var(--theme-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.feed-activity__tee-time {
    font-weight: 600;
    color: var(--theme-text-secondary);
}

.feed-activity__join-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--theme-primary);
    background: rgba(var(--flipt-primary-rgb, 0, 166, 156), 0.08);
    border: 1px solid rgba(var(--flipt-primary-rgb, 0, 166, 156), 0.2);
    white-space: nowrap;
    flex-shrink: 0;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.feed-activity__join-link:hover {
    background: rgba(var(--flipt-primary-rgb, 0, 166, 156), 0.15);
    border-color: var(--theme-primary);
    text-decoration: none;
    color: var(--theme-primary);
}

.feed-activity__join-link i {
    font-size: 0.6rem;
}

/* Flippy-voiced activity announcement */
.feed-activity__flippy {
    font-style: italic;
    color: var(--theme-text-primary);
}

/* --- New-item entrance animation ---------------------------- */

@keyframes feed-item-enter {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feed-message--new,
.feed-activity--new {
    animation: feed-item-enter 0.2s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .feed-message--new,
    .feed-activity--new {
        animation: none;
    }
}

/* --- Compose area (fixed bottom) ---------------------------- */

.stable-compose {
    flex-shrink: 0;
    padding: 0.625rem 1.25rem;
    background: var(--theme-surface-1);
    border-top: 1px solid var(--theme-border-color);
    position: relative;
    z-index: 10;
}

/* Subtle top shadow to lift compose above feed */
.stable-compose::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.05),
        transparent
    );
    pointer-events: none;
}

[data-bs-theme="dark"] .stable-compose::before {
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.25),
        transparent
    );
}

/* --- Chat Actions drawer ------------------------------------ */

.chat-actions {
    margin-bottom: 0.5rem;
}

.chat-actions__grid {
    display: flex;
    gap: 0.5rem;
}

.chat-actions__tile {
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--theme-border-color);
    background: var(--theme-surface-2);
    color: var(--theme-text-secondary);
    cursor: pointer;
    min-width: 5.5rem;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chat-actions__tile:hover {
    background: var(--theme-surface-3);
    border-color: var(--theme-primary);
    color: var(--theme-text-primary);
}

.chat-actions__tile-icon {
    font-size: 1.25rem;
    color: var(--theme-primary);
}

.chat-actions__tile-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* --- Tee Time Selector (from Chat Actions) ------------------- */

.tee-time-selector {
    margin-bottom: 0.5rem;
    padding: 0.75rem;
    border-radius: 14px;
    border: 1px solid rgba(var(--theme-primary-rgb, 0, 166, 156), 0.14);
    background: var(--theme-surface-2);
}

.tee-time-selector__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.tee-time-selector__title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--theme-text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tee-time-selector__title i {
    color: var(--theme-primary);
}

.tee-time-selector__close {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--theme-text-muted);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: color 0.12s ease, background-color 0.12s ease;
}

.tee-time-selector__close:hover {
    color: var(--theme-text-primary);
    background: var(--theme-surface-3);
}

.tee-time-selector__list {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.1rem 0 0.2rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}

.tee-time-selector__list::-webkit-scrollbar {
    display: none;
}

.tee-time-selector__empty {
    font-size: 0.82rem;
    color: var(--theme-text-muted);
    text-align: center;
    padding: 0.5rem 0;
    margin: 0;
}

/* Reuse pill styles for the selector */
.tee-time-pill {
    appearance: none;
    border: 1px solid rgba(var(--theme-primary-rgb, 0, 166, 156), 0.14);
    background: var(--theme-surface-1);
    color: var(--theme-text-primary);
    border-radius: 12px;
    padding: 0.6rem 0.75rem;
    min-width: 8rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    text-align: left;
    cursor: pointer;
    scroll-snap-align: start;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.tee-time-pill:hover,
.tee-time-pill:focus-visible {
    border-color: var(--theme-primary);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
}

.tee-time-pill__day {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--theme-text-muted);
}

.tee-time-pill__time {
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.2;
}

.tee-time-pill__league {
    font-size: 0.7rem;
    color: var(--theme-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.tee-time-pill__spots {
    font-size: 0.7rem;
    color: var(--theme-success);
    font-weight: 700;
}

/* --- Tee Time Share Preview (compose attachment) -------------- */

.tee-time-preview {
    margin-bottom: 0.5rem;
}

.tee-time-preview__card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(var(--theme-primary-rgb, 0, 166, 156), 0.2);
    background: rgba(var(--theme-primary-rgb, 0, 166, 156), 0.06);
}

.tee-time-preview__info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.tee-time-preview__time {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--theme-text-primary);
}

.tee-time-preview__detail {
    font-size: 0.78rem;
    color: var(--theme-text-secondary);
}

.tee-time-preview__spots {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--theme-success);
}

.tee-time-preview__remove {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--theme-text-muted);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.tee-time-preview__remove:hover {
    color: var(--theme-danger);
}

/* --- Feed: Tee Time Card (in-feed rich message) -------------- */

.feed-tee-time-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(var(--theme-primary-rgb, 0, 166, 156), 0.16);
    background-color: rgba(var(--theme-primary-rgb, 0, 166, 156), 0.05);
    background-size: auto 100%;
    background-repeat: repeat-x;
    background-position: right center;
    margin-bottom: 0.35rem;
    position: relative;
    overflow: hidden;
}

/* Semi-transparent overlay for text readability when pattern is present */
.feed-tee-time-card[style*="background-image"]::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to right,
        var(--theme-surface-1) 40%,
        rgba(var(--theme-bg-primary-rgb, 255, 255, 255), 0.6) 100%
    );
    pointer-events: none;
}

.feed-tee-time-card[style*="background-image"] > * {
    position: relative;
    z-index: 1;
}

[data-bs-theme="dark"] .feed-tee-time-card {
    background-color: rgba(var(--theme-primary-rgb, 0, 166, 156), 0.08);
    border-color: rgba(var(--theme-primary-rgb, 0, 166, 156), 0.2);
}

[data-bs-theme="dark"] .feed-tee-time-card[style*="background-image"]::before {
    background: linear-gradient(
        to right,
        var(--theme-surface-1) 35%,
        rgba(0, 0, 0, 0.7) 100%
    );
}

.feed-tee-time-card__info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.feed-tee-time-card__time {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--theme-text-primary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.feed-tee-time-card__time i {
    color: var(--theme-primary);
    font-size: 0.8rem;
}

.feed-tee-time-card__league {
    font-size: 0.78rem;
    color: var(--theme-text-secondary);
}

.feed-tee-time-card__spots {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--theme-success);
}

.feed-tee-time-card__join {
    flex-shrink: 0;
    white-space: nowrap;
}

/* --- Actions toggle (+) button ------------------------------- */

.stable-compose__actions-toggle {
    appearance: none;
    border: none;
    background: transparent;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    color: var(--theme-primary);
    flex-shrink: 0;
    transition: background-color 0.15s ease, transform 0.2s ease;
}

.stable-compose__actions-toggle:hover {
    background: rgba(var(--theme-primary-rgb, 0, 166, 156), 0.1);
}

.stable-compose__actions-toggle.is-active {
    transform: rotate(45deg);
    color: var(--theme-text-muted);
}

.stable-compose__actions-toggle.is-active:hover {
    background: var(--theme-surface-3);
}

.stable-compose__input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background: var(--theme-surface-2);
    border: 1px solid var(--theme-border-color);
    border-radius: 12px;
    padding: 0.375rem 0.5rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stable-compose__input-wrapper:focus-within {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 3px rgba(var(--theme-primary-rgb, 0, 166, 156), 0.15);
}

.stable-compose__input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--theme-text-primary);
    font-size: 0.9rem;
    line-height: 1.45;
    padding: 0.375rem 0.25rem;
    resize: none;
    min-height: 1.45em;
    max-height: 8rem;
    overflow-y: auto;
    font-family: inherit;
}

.stable-compose__input::placeholder {
    color: var(--theme-text-muted);
}

.stable-compose__input:focus {
    outline: none;
}

.stable-compose__actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    padding-bottom: 0.125rem;
}

.stable-compose__attach,
.stable-compose__send {
    appearance: none;
    border: none;
    background: transparent;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.12s ease, color 0.12s ease, transform 0.12s ease;
}

.stable-compose__attach {
    color: var(--theme-text-muted);
}

.stable-compose__attach:hover {
    background: var(--theme-surface-3);
    color: var(--theme-text-primary);
}

.stable-compose__attach:focus-visible,
.stable-compose__send:focus-visible {
    outline: none;
    background: var(--theme-surface-3);
    box-shadow: 0 0 0 3px rgba(var(--theme-primary-rgb, 0, 166, 156), 0.2);
    color: var(--theme-text-primary);
}

.stable-compose__send {
    color: var(--theme-primary);
}

.stable-compose__send:disabled {
    opacity: 0.35;
    cursor: default;
}

.stable-compose__send:not(:disabled):hover {
    background: rgba(var(--theme-primary-rgb, 0, 166, 156), 0.12);
    transform: scale(1.08);
}

/* Pending attachment previews */
.stable-compose__attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.375rem;
}

.stable-compose__attachments:empty {
    display: none;
}

.pending-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: var(--theme-surface-2);
    border: 1px solid var(--theme-border-color);
    font-size: 0.75rem;
    color: var(--theme-text-secondary);
}

.pending-attachment__remove {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--theme-text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.pending-attachment__remove:hover {
    color: var(--theme-danger);
}

/* Uploading state */
.pending-attachment--uploading {
    opacity: 0.6;
}

.pending-attachment__progress {
    width: 40px;
    height: 3px;
    background: var(--theme-surface-3);
    border-radius: 2px;
    overflow: hidden;
}

.pending-attachment__progress-bar {
    height: 100%;
    background: var(--theme-primary);
    border-radius: 2px;
    transition: width 0.2s ease;
}

/* --- Join / Sign-in prompt compose variants ----------------- */

.stable-compose--join-prompt,
.stable-compose--signin-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    text-align: center;
}

.stable-compose--join-prompt p,
.stable-compose--signin-prompt p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--theme-text-muted);
}

.stable-compose--signin-prompt a {
    color: var(--theme-primary);
    font-weight: 600;
    text-decoration: none;
}

.stable-compose--signin-prompt a:hover {
    text-decoration: underline;
}

/* --- Settings overflow menu --------------------------------- */

.stable-settings-menu {
    position: relative;
}

.stable-settings-menu__trigger {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--theme-text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.stable-settings-menu__trigger:hover,
.stable-settings-menu__trigger[aria-expanded="true"] {
    background: var(--theme-surface-3);
    color: var(--theme-text-primary);
}

.stable-settings-menu__dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.35rem;
    min-width: 200px;
    background: var(--theme-surface-1);
    border: 1px solid var(--theme-border-color);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    z-index: 50;
}

[data-bs-theme="dark"] .stable-settings-menu__dropdown {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.stable-settings-menu__section {
    padding: 0.25rem 0.5rem;
}

.stable-settings-menu__label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--theme-text-muted);
    margin-bottom: 0.35rem;
}

.stable-settings-menu__divider {
    border: none;
    border-top: 1px solid var(--theme-border-color);
    margin: 0.35rem 0;
}

.stable-settings-menu__item {
    appearance: none;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--theme-text-secondary);
    transition: background-color 0.12s ease;
}

.stable-settings-menu__item:hover {
    background: var(--theme-surface-2);
}

.stable-settings-menu__item--danger {
    color: var(--theme-danger);
}

.stable-settings-menu__item--danger:hover {
    background: rgba(var(--theme-danger-rgb, 239, 68, 68), 0.08);
}

/* --- Welcome state (non-member, empty) ----------------------- */

.stable-feed__welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    gap: 0.75rem;
    flex: 1;
}

.stable-feed__welcome-icon {
    font-size: 2.5rem;
    color: var(--theme-primary);
    opacity: 0.6;
    margin-bottom: 0.25rem;
}

.stable-feed__welcome-title {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--theme-text-primary);
}

.stable-feed__welcome-text {
    font-size: 0.9rem;
    color: var(--theme-text-secondary);
    max-width: 320px;
    line-height: 1.5;
}

.stable-feed__welcome .btn {
    margin-top: 0.5rem;
    padding: 0.625rem 1.5rem;
    font-weight: 700;
}

/* --- Join banner (bottom, non-member with messages) ---------- */

.stable-compose--join-banner {
    border-top: 1px solid var(--theme-border-color);
    background: var(--theme-surface-1);
}

.stable-join-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.stable-join-banner__text {
    font-size: 0.88rem;
    color: var(--theme-text-secondary);
}

.stable-join-banner__text strong {
    color: var(--theme-text-primary);
}

/* --- Empty feed state --------------------------------------- */

.stable-feed__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    gap: 0.5rem;
    color: var(--theme-text-muted);
}

.stable-feed__empty-icon {
    font-size: 2rem;
    opacity: 0.35;
    margin-bottom: 0.25rem;
}

.stable-feed__empty-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--theme-text-secondary);
}

.stable-feed__empty-text {
    font-size: 0.875rem;
    max-width: 280px;
}

/* --- Scroll-to-bottom floating button ----------------------- */

.stable-feed__scroll-btn {
    position: absolute;
    bottom: 0.75rem;
    right: 1.25rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--theme-border-color);
    background: var(--theme-surface-2);
    color: var(--theme-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: var(--theme-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 5;
}

.stable-feed__scroll-btn--visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.stable-feed__scroll-btn:hover {
    background: var(--theme-surface-3);
    color: var(--theme-text-primary);
}

/* --- Feed wrapper (relative for scroll button) -------------- */

.stable-feed {
    position: relative;
}

/* --- Responsive --------------------------------------------- */

@media (max-width: 767px) {
    .stable-page {
        height: calc(100vh - var(--nav-height, 56px));
        height: calc(100dvh - var(--nav-height, 56px));
    }

    .stable-header {
        flex-wrap: wrap;
        padding: 0.625rem 0.75rem;
        gap: 0.5rem;
    }

    .stable-header__course {
        flex-basis: 100%;
    }

    .stable-header__course-name {
        font-size: 1rem;
    }

    .stable-header__info {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .stable-header__actions {
        margin-left: auto;
    }

    .stable-members-strip {
        padding: 0.375rem 0.75rem;
    }

    .stable-pinned {
        padding: 0.5rem 0.75rem;
    }

    .feed-message {
        padding: 0.375rem 0.75rem;
    }

    .feed-activity {
        padding-left: 3.375rem;
        padding-right: 0.75rem;
    }

    .stable-compose {
        padding: 0.5rem 0.75rem;
        /* Safe area for phones with home indicator */
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    }

    .tee-time-pill {
        min-width: 7rem;
        padding: 0.5rem 0.6rem;
    }

    .chat-actions__tile {
        padding: 0.6rem 0.75rem;
        min-width: 4.5rem;
    }

    /* On mobile, always show message actions (no hover) */
    .feed-message__actions {
        opacity: 1;
        visibility: visible;
        position: static;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        margin-top: 0.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tee-time-pill,
    .stable-compose__actions-toggle,
    .stable-compose__send,
    .stable-compose__input-wrapper {
        transition: none;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .stable-header__course-name {
        max-width: 280px;
    }
}

/* --- Confirm dialog (delete) -------------------------------- */

.feed-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    animation: fade-in 0.15s ease;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.feed-confirm-dialog {
    background: var(--theme-surface-1);
    border: 1px solid var(--theme-border-color);
    border-radius: 14px;
    padding: 1.25rem;
    max-width: 320px;
    width: 90%;
    box-shadow: var(--theme-shadow-lg);
}

.feed-confirm-dialog__title {
    font-weight: 700;
    font-size: 1rem;
    margin: 0 0 0.5rem;
    color: var(--theme-text-primary);
}

.feed-confirm-dialog__text {
    font-size: 0.875rem;
    color: var(--theme-text-secondary);
    margin: 0 0 1rem;
}

.feed-confirm-dialog__actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.feed-confirm-dialog__cancel,
.feed-confirm-dialog__confirm {
    appearance: none;
    border: none;
    padding: 0.4rem 0.875rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.feed-confirm-dialog__cancel {
    background: var(--theme-surface-3);
    color: var(--theme-text-secondary);
}

.feed-confirm-dialog__cancel:hover {
    background: var(--theme-surface-2);
}

.feed-confirm-dialog__confirm {
    background: var(--theme-danger);
    color: #fff;
}

.feed-confirm-dialog__confirm:hover {
    filter: brightness(1.1);
}

/* --- Network error toast ------------------------------------ */

.stable-toast {
    position: fixed;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--theme-surface-2);
    border: 1px solid var(--theme-border-color);
    border-radius: 10px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--theme-text-secondary);
    box-shadow: var(--theme-shadow);
    z-index: 1060;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.stable-toast--visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.stable-toast--error {
    border-color: var(--theme-danger);
    color: var(--theme-danger);
}
