/* Mentions Popup Styling */
.ql-mention-list-container {
    background: var(--bs-body-bg);
    border-radius: var(--bs-border-radius);
    overflow: hidden;
    z-index: 9999;
    border: 1px solid var(--bs-border-color);
}

.ql-mention-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ql-mention-list-item {
    padding: 0.35rem 1rem;
    cursor: pointer;
    color: var(--bs-body-color);
    font-size: 0.875rem;
    line-height: 1.5;
}

.ql-mention-list-item.selected {
    background-color: var(--bs-primary);
    color: #fff;
}

.ql-mention-list-item:hover:not(.selected) {
    background-color: var(--bs-tertiary-bg);
}

/* Mention Badge styling in editor */
.mention {
    height: auto;
    width: auto;
    display: inline-block;
    background-color: var(--bs-primary-subtle);
    color: var(--bs-primary-emphasis);
    padding: 0 4px;
    border-radius: 4px;
    user-select: all;
}

[data-bs-theme="dark"] .mention {
    background-color: rgba(13, 110, 253, 0.25);
    color: #71b1ff;
}

.comment-reaction-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;

    /* Make all pills (including icon-only "add") the same height */
    height: 26px;
    padding: 0 0.55rem;

    border-radius: 999px;
    font-size: 0.875rem;
    line-height: 1;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}

.comment-reaction-pill:hover {
    background: var(--bs-secondary-bg);
}

.comment-reaction-pill.is-active {
    border-color: rgba(13, 110, 253, 0.45);
    background: rgba(13, 110, 253, 0.12);
}

.comment-reaction-add {
    color: var(--bs-secondary-color);
    background: transparent;

    /* Icon-only pill: keep same height, slightly tighter width */
    padding: 0 0.45rem;
}

.comment-reaction-add:hover {
    color: var(--bs-body-color);
}

/* Comment Design Tweaks */
.comment-bubble {
    border-color: var(--bs-border-color-translucent) !important;
    width: 100%; /* Stretch to fill available width */
    padding-bottom: 0.5rem !important; /* Fixed padding at the bottom of the bubble */
}

.comment-text {
    line-height: 1.4;
    color: var(--bs-body-color);
    padding: 0.15rem 0; /* Reduced vertical padding */
}

.hover-opacity-100:hover {
    opacity: 1 !important;
}

.comment-row .btn-link:focus {
    box-shadow: none;
}

/* Emoji Picker Dark Mode Support */
emoji-picker {
    --background: var(--bs-body-bg);
    --border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] emoji-picker {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
}

/* Dark theme tweaks (Bootstrap 5.3 uses data-bs-theme="dark") */
[data-bs-theme="dark"] .comment-reaction-pill {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.14);
}

[data-bs-theme="dark"] .comment-reaction-pill:hover {
    background: rgba(255, 255, 255, 0.07);
}

[data-bs-theme="dark"] .comment-reaction-pill.is-active {
    border-color: rgba(13, 110, 253, 0.60);
    background: rgba(13, 110, 253, 0.20);
}

/* Reset Quill Snow defaults to match bootstrap-quill behavior */
.comment-editor-toolbar .ql-toolbar.ql-snow,
.ql-toolbar.ql-snow {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
}

.ql-container.ql-snow {
    border: none !important;
    font-family: var(--bs-body-font-family) !important;
}

/* Make the editor feel like a textarea */
.ql-editor {
    min-height: 100px;
    padding: 1rem !important;
    font-size: 0.95rem;
    color: var(--bs-body-color);
}

.ql-editor.ql-blank::before {
    left: 1rem !important;
    color: var(--bs-secondary-color);
    font-style: normal;
}
/* Mentions Popup Styling */
.ql-mention-list-container {
    background: var(--bs-body-bg);
    border-radius: var(--bs-border-radius);
    overflow: hidden;
    z-index: 9999;
}

.ql-mention-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ql-mention-list-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--bs-body-color);
    font-size: 0.875rem;
}

.ql-mention-list-item.selected {
    background-color: var(--bs-primary);
    color: #fff;
}

.ql-mention-list-item:hover:not(.selected) {
    background-color: var(--bs-tertiary-bg);
}

/* Clean up toolbar button visuals */
.btn-link.text-secondary:hover {
    background: var(--bs-secondary-bg);
}
.switch-btn {
    position: relative;
    height: 38px;
    padding: 0 !important;
    overflow: hidden;
    user-select: none;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.2);
    display: inline-flex;
}

.switch-btn-label {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    color: white;
    transition: opacity 0.15s;
    pointer-events: none;
}

/* THE CENTERING TRICK:
   When ON, the handle is on the right, so we pad the right side.
   When OFF, the handle is on the left, so we pad the left side. */
.on-label { padding-right: 40px; }
.off-label { padding-left: 40px; }

/* Visibility states */
.switch-btn.on .off-label { opacity: 0; }
.switch-btn:not(.on) .on-label { opacity: 0; }

.switch-btn-handle {
    position: absolute;
    top: 2px;
    bottom: 2px;
    width: 36px;
    background: white;
    border-radius: 4px;
    transition: left 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Correct Handle Positions */
.switch-btn.on .switch-btn-handle {
    left: calc(100% - 38px);
}
.switch-btn:not(.on) .switch-btn-handle {
    left: 2px;
}

.switch-btn i { margin-right: 6px; }

/* Mention styling */
.mention-bubble {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    font-size: 0.85em;
    vertical-align: middle;
    margin: 0 1px;
    border: 1px solid transparent;

    &.highlight-me {
        background-color: var(--bs-primary) !important;
        color: white !important;
        box-shadow: 0 0 0 2px var(--bs-primary-bg-subtle);
        border-color: rgba(255, 255, 255, 0.2);
    }
}

.mention-pill {
    display: inline-block;
    padding: 0 0.6rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary);
    transition: all 0.15s ease-in-out;
    border: 1px solid transparent;
  }

  .mention-pill:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.2);
    border-color: rgba(var(--bs-primary-rgb), 0.3);
  }

  /* Warm orange style for when I am mentioned */
  .mention-pill--me {
    background-color: #fff4e5; /* Very light orange background */
    color: #d9480f; /* Deep orange text */
    border-color: #ffd8a8;
  }

  .mention-pill--me:hover {
    background-color: #ffe8cc;
    border-color: #ffc078;
  }

.comment-bubble {
    overflow: visible !important;
}
.comment-text {
    overflow: visible !important;
    position: relative; /* Create stacking context for popups */
}

html, body {
    height: 100%;
}

/* Flatpickr Theme Correction */
.flatpickr-calendar {
    background: var(--bs-body-bg) !important;
    box-shadow: none !important;
    border: none !important;
    color: var(--bs-body-color) !important;
    font-family: inherit;
    /* Ensure it doesn't overflow its container on small screens */
    width: 100% !important;
    max-width: 315px !important;
}

.flatpickr-innerContainer {
    justify-content: center;
}

.flatpickr-day,
.flatpickr-weekday,
.flatpickr-current-month,
.flatpickr-current-month span,
.flatpickr-calendar.inline {
    color: var(--bs-body-color) !important;
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: var(--bs-secondary-color) !important;
    opacity: 0.3;
}

.flatpickr-day:hover {
    background: var(--bs-tertiary-bg) !important;
    color: var(--bs-body-color) !important;
}

.flatpickr-day.selected {
    background: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
    color: #fff !important;
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: var(--bs-secondary-color) !important;
    opacity: 0.3;
}

.flatpickr-day:hover {
    background: var(--bs-tertiary-bg) !important;
}

.flatpickr-day.selected {
    background: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
    color: #fff !important;
}

.flatpickr-day.today {
    border-color: var(--bs-primary) !important;
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    color: var(--bs-secondary-color) !important;
    opacity: 0.15;
    cursor: not-allowed;
    background: transparent !important;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    fill: var(--bs-body-color) !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months:hover {
    background: transparent !important;
}

[data-bs-theme="light"] .flatpickr-day.today:hover {
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .flatpickr-calendar {
    background: #2b3035 !important; /* Match Bootstrap Dark Modal */
}

/* Dashboard specific fixes */
.navbar { height: 3rem; }
.sidebar { position: sticky; top: 3rem; height: calc(100vh - 3rem); z-index: 100; }

/* Sticky Event Header logic */
.sticky-event-header {
    top: 3rem; /* Default offset matching navbar height */
    z-index: 1010;
    transition: top 0.2s ease-in-out;
}

/*
   If your navbar hiding script adds a class (e.g., .navbar-hidden)
   to the body or header when it scrolls out of view:
*/
body.navbar-hidden .sticky-event-header,
header.navbar.hide .sticky-event-header {
    top: 0;
}

/* Form Container */
.form-signin {
    width: 100%;
    max-width: 330px;
    padding: 1rem;
    margin: auto;
}

/* 1. HIDE DUPLICATE LABELS: Hide labels that aren't inside the input field */
.form-signin label:not(.form-floating > label):not(.form-check-label) {
    display: none !important;
}

/* 2. JOINED ROWS: Remove gaps between items */
.form-signin .mb-3 {
    margin-bottom: -1px !important;
    padding: 0 !important;
}

.form-signin h1.h3 {
    margin-bottom: 1rem !important;
}

/* 3. BLOCK SEPARATORS: Restore spacing for block ends */
.form-signin .last-item,
.form-signin .standalone-item {
    margin-bottom: 1.5rem !important;
}

/* 4. JOINED FIELDS: Square corners by default */
.form-signin .form-control,
.form-signin .form-select {
    border-radius: 0 !important;
}

/* 5. SPECIFIC CORNERS */
/* Top corners for block starts */
.form-signin .first-item .form-control,
.form-signin .standalone-item .form-control {
    border-top-left-radius: var(--bs-border-radius) !important;
    border-top-right-radius: var(--bs-border-radius) !important;
}

/* Bottom corners for block ends */
.form-signin .last-item .form-control,
.form-signin .standalone-item .form-control {
    border-bottom-left-radius: var(--bs-border-radius) !important;
    border-bottom-right-radius: var(--bs-border-radius) !important;
}

/* 6. BUTTON JOINING: Absolute last field in form squares bottom */
.form-signin form .mb-3:last-of-type {
    margin-bottom: 0 !important;
}
.form-signin form .mb-3:last-of-type .form-control {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

/* 7. SUBMIT BUTTON */
.form-signin button[type="submit"] {
    width: 100% !important;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    margin-top: -1px !important;
    padding: 0.6rem !important;
    position: relative;
    z-index: 2;
}

/* Asterisk for required fields */
.form-signin label.required::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* Error Bubbles */
.form-signin .form-floating .invalid-feedback,
.form-signin .form-floating ul {
    display: none !important;
    position: absolute !important;
    z-index: 1000 !important;
    background: #dc3545 !important;
    color: #fff !important;
    font-size: 0.7rem !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    top: 0 !important;
    left: 50% !important;
    transform: translate(-50%, -100%) !important;
    white-space: nowrap !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
    pointer-events: none !important;
}

.form-signin .form-floating:focus-within .invalid-feedback,
.form-signin .form-floating:focus-within ul,
.form-signin .form-floating:hover .invalid-feedback,
.form-signin .form-floating:hover ul {
    display: block !important;
}

/* Mobile Adjustments */
@media (max-width: 767.98px) {
    .sidebar { height: auto; position: relative; top: 0; }
    .navbar-brand { padding-top: .75rem; padding-bottom: .75rem; font-size: 1rem; }
    .user-info { display: none; }
}

.avatar-dropdown::after {
    display: none;
}
.avatar-dropdown {
    padding: 0;
    border: none;
    background: transparent;
}

.dropdown-item i {
    width: 1.25rem;
    text-align: center;
}

/* FAB Styling */
.fab-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1050;
}

.fab-container .btn-info {
    transition: transform 0.2s;
    background-color: var(--bs-info-bg-subtle);
    border: 1px solid var(--bs-info-border-subtle);
    color: var(--bs-info-text-emphasis);
}

.fab-container .btn-info:hover {
    transform: scale(1.1);
}

.fab-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--bs-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    border: none;
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.fab-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
    color: white;
}

/* Specific color for the calendar FAB */
.fab-button.bg-info:hover {
    background-color: var(--bs-info-border-subtle) !important;
}

.fab-button i {
    font-size: 24px;
}

/* Kept local to this component for easy reuse without global CSS wiring. */
.avatar-hovercard {
    vertical-align: middle;
}

.avatar-hovercard__popup {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    /* Add --nudge-x variable to the transform */
    transform: translateX(calc(-50% + var(--nudge-x, 0px))) translateY(10px);
    width: 280px;
    max-width: calc(100vw - 20px); /* Ensure it never exceeds screen width */
    z-index: 1080;
    background-color: var(--bs-body-bg) !important; /* Force background visibility */
    border: 1px solid var(--bs-border-color) !important;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition: opacity .12s ease, transform .12s ease, visibility 0s linear .12s;
    transform-origin: bottom center;
}

.avatar-hovercard:hover .avatar-hovercard__popup,
.avatar-hovercard:focus-within .avatar-hovercard__popup {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transition: opacity .12s ease, transform .12s ease;
    transform: translateX(calc(-50% + var(--nudge-x, 0px))) translateY(0);
}

.avatar-hovercard__arrow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    width: 14px;
    height: 14px;
    background: var(--bs-body-bg);
    /* Arrow moves in the opposite direction of the popup nudge to stay centered over the mention */
    transform: translateX(calc(-50% + var(--arrow-nudge-x, 0px))) rotate(45deg);
    border-radius: 2px;
    border-right: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color);
    z-index: -1;
}
