/* ══════════════════════════════════════════════════════
   Context Menu — modern, Todoist-inspired design.
   Matches the AddNewAgsTaskComponent visual language.
   ══════════════════════════════════════════════════════ */

/* ── Menu shell ── */
.context-menu {
    position: fixed;
    z-index: 9500;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    font-family: inherit;
    font-size: 0.875rem;
    min-width: 165px;
    padding: 6px;
    animation: ctx-menu-appear 0.13s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes ctx-menu-appear {
    from { opacity: 0; transform: scale(0.95) translateY(-4px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* ── Regular menu item row ── */
.menu-item {
    display: flex;
    align-items: center;
    padding: 0;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.1s ease;
}

.menu-item:hover {
    background-color: #f1f5f9;
}

.menu-item button {
    display: flex;
    align-items: center;
    width: 100%;
    border: none;
    background: none;
    color: #1e293b;
    font-size: 0.875rem;
    font-weight: 450;
    text-align: left;
    cursor: pointer;
    padding: 7px 10px;
    border-radius: 8px;
    gap: 2px;
    line-height: 1.4;
    transition: color 0.1s ease;
}

.menu-item button:hover {
    color: #0f172a;
}

/* ── Icon inside menu-item button ── */
.menu-item i {
    font-size: 15px;
    flex-shrink: 0;
    margin-right: 2px;
    opacity: 0.75;
}

/* ── Custom icon wrapper (used for coloured icons) ── */
.custom-menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    margin-right: 4px;
}

.custom-menu-icon i {
    font-size: 15px;
}

/* ── Custom item layout (text + shortcut stacked) ── */
.custom-menu-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}

.custom-menu-text {
    font-size: 0.875rem;
    color: #1e293b;
    line-height: 1.3;
}

.custom-keyboard-shortcut {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 500;
}

/* ── Separator ── */
.mini-hr {
    height: 1px;
    background-color: #f1f5f9;
    border: none;
    margin: 4px 2px;
}

/* ── Section label (above colour pickers, style pickers, etc.) ── */
.menu-section-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    user-select: none;
    margin-bottom: 4px;
}

/* ── Inline colour-swatch section ── */
.menu-color-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px 10px 4px;
}

.color-swatch-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 7px;
    align-items: center;
}

.color-swatch {
    display: block;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    padding: 0;
    flex-shrink: 0;
    flex-grow: 0;
    box-sizing: content-box;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-swatch:hover {
    transform: scale(1.3);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
}

.color-swatch:focus-visible {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

/* ── Inline text-style picker ── */
.menu-text-style-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px 10px 4px;
}

.text-style-btn-row {
    display: flex;
    gap: 4px;
    align-items: flex-end;
}

.text-style-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 6px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    color: #334155;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.text-style-btn:hover {
    background-color: #f1f5f9;
    border-color: #93c5fd;
    color: #1e293b;
}

.text-style-btn--active {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
    color: #1d4ed8;
}

/* Preview sizes so each button visually reflects the heading level */
.text-style-h1     { font-size: 1.2em;  font-weight: 800; line-height: 1; }
.text-style-h2     { font-size: 1.0em;  font-weight: 700; line-height: 1; }
.text-style-h3     { font-size: 0.85em; font-weight: 600; line-height: 1; }
.text-style-normal { font-size: 0.72em; font-weight: 400; line-height: 1; }

/* ── Submenu ── */
.submenu {
    position: absolute;
    left: 100%;
    top: 0;
    z-index: 9501;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    font-size: 0.875rem;
    min-width: 165px;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.submenu--left {
    left: auto;
    right: 100%;
}

.submenu--flip-up {
    top: auto;
    bottom: 0;
}

.menu-item:hover .submenu {
    opacity: 1;
    visibility: visible;
}

/* ── Submenu item row ── */
.submenu-item {
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.1s ease;
    display: block;
}

.submenu-item:hover {
    background-color: #f1f5f9;
}

.submenu-item button {
    display: flex;
    align-items: center;
    width: 100%;
    border: none;
    background: none;
    color: #1e293b;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    padding: 7px 10px;
    border-radius: 8px;
    line-height: 1.4;
}

.submenu-item i {
    margin-right: 8px;
    font-size: 15px;
    opacity: 0.75;
}

/* ── Submenu chevron indicator ── */
.submenu-icon {
    margin-left: auto;
    font-size: 11px;
    color: #94a3b8;
    transition: transform 0.15s ease;
}

.menu-item:hover .submenu-icon {
    transform: translateX(3px);
}

/* Width is set via an inline min-width style computed dynamically in ShowContextMenu.
   This class is kept as a CSS fallback. */
.context-menu--wide {
    min-width: 260px;
}
