/* ============================================================================
   PROJECT SHARING
   ============================================================================ */

/* Share button active state */
#projectShareBtn.has-shares,
#noteShareBtn.has-shares {
    color: var(--accent-blue);
    background: var(--accent-blue-bg, rgba(59, 130, 246, 0.1));
}

/* Share Popover */
.share-popover {
    position: fixed;
    z-index: calc(var(--z-layer-menu) + 10);
    width: 320px;
    max-height: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity var(--duration-fast) var(--ease-in-out), transform var(--duration-fast) var(--ease-in-out);
}

.share-popover.visible {
    opacity: 1;
    transform: translateY(0);
}

.share-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 8px;
}

.share-popover-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.share-popover-search {
    padding: 0 14px 4px;
}

.share-search-input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
}

.share-search-input:focus {
    border-color: var(--accent-blue);
}

/* Unified people list */
.share-people-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 4px 6px 8px;
}

.share-people-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-md);
    cursor: default;
}

.share-people-item:hover {
    background: var(--bg-hover);
}

.share-owner-row:hover {
    background: transparent;
}

.share-member-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-circle);
    background: var(--accent-blue-bg, rgba(59, 130, 246, 0.1));
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-2xs);
    font-weight: 600;
    flex-shrink: 0;
}

.share-member-avatar.owner {
    background: var(--accent-green-bg, rgba(34, 197, 94, 0.1));
    color: var(--color-green-text);
}

.share-member-name {
    flex: 1;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.share-owner-badge {
    font-size: var(--font-size-2xs);
    color: var(--text-tertiary);
    flex-shrink: 0;
}

/* Split invite button (Invite | v) */
.share-invite-group {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.share-invite-btn {
    padding: 3px 8px;
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--accent-blue);
    background: var(--accent-blue-bg, rgba(59, 130, 246, 0.1));
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.share-invite-btn:hover {
    background: var(--accent-fill);
    color: white;
}

.share-invite-chevron {
    padding: 3px 4px;
    background: var(--accent-blue-bg, rgba(59, 130, 246, 0.1));
    border: none;
    border-left: 1px solid rgba(59, 130, 246, 0.2);
    cursor: pointer;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
}

.share-invite-chevron:hover {
    background: var(--accent-fill);
    color: white;
}

/* Invite permission dropdown menu */
.share-invite-menu {
    position: fixed;
    z-index: calc(var(--z-layer-menu) + 11);
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-2);
    padding: 4px;
    min-width: 180px;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity var(--duration-fast) var(--ease-in-out), transform var(--duration-fast) var(--ease-in-out);
}

.share-invite-menu.visible {
    opacity: 1;
    transform: translateY(0);
}

.share-invite-menu-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    text-align: left;
}

.share-invite-menu-item:hover {
    background: var(--bg-hover);
}

.share-invite-menu-item span:first-child {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    font-weight: 500;
}

.share-invite-menu-desc {
    font-size: var(--font-size-2xs);
    color: var(--text-tertiary);
    margin-top: 1px;
}

.share-permission-select {
    padding: 2px 4px;
    font-size: var(--font-size-2xs);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
}

.share-remove-btn {
    background: none;
    border: none;
    padding: 3px;
    cursor: pointer;
    color: var(--text-tertiary);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-in-out);
}

.share-shared-row:hover .share-remove-btn {
    opacity: 1;
}

.share-remove-btn:hover {
    color: var(--color-red-text);
    background: rgba(239, 68, 68, 0.1);
}

.share-popover-empty {
    padding: 16px 14px;
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    text-align: center;
}

/* Shared project badge on project cards */
.project-shared-badge {
    display: inline-flex;
    align-items: center;
    color: var(--accent-blue);
    flex-shrink: 0;
    margin-left: 2px;
}

.project-shared-badge.shared-with-me {
    color: var(--color-purple-text);
}

/* Projects group labels in sidebar */
.projects-group-label {
    padding: var(--space-3) var(--space-4) var(--space-1);
    font-size: var(--font-size-2xs);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.projects-group-label:first-child {
    padding-top: 4px;
}

/* Shared project task badge */
.task-meta-badge.meta-shared-project {
    background: transparent;
    color: var(--text-tertiary);
}

/* View-only badge */
.view-only-badge {
    display: inline-flex;
    align-items: center;
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    margin-left: 8px;
    white-space: nowrap;
    user-select: none;
    flex-shrink: 0;
}

/* View-only project modal */
/* Task rows in view-only mode never wire the drag mousedown handler, so the
   grab-handle affordance would be a lie — hide it entirely. */
.project-view-only .task-drag-handle {
    display: none;
    pointer-events: none;
}

.project-view-only .project-task-section-drag-handle {
    pointer-events: none;
    opacity: 0.3;
}

.project-view-only .project-add-task {
    display: none !important;
}

.project-view-only .task-quick-actions {
    display: none;
}

.project-view-only .checkbox-wrapper,
.project-view-only .checkbox-wrapper .checkbox {
    pointer-events: none;
    opacity: 0.25;
    cursor: default;
}

.project-view-only .checkbox-wrapper .checkbox:hover {
    border-color: var(--text-tertiary);
}

.project-view-only .task-row {
    cursor: default;
}

.project-view-only .section-add-task-btn,
.project-view-only .section-menu-btn {
    display: none;
}

/* View-only board view */
.project-view-only .board-card-checkbox {
    pointer-events: none;
    opacity: 0.25;
}

.project-view-only .board-card {
    cursor: default;
}

.project-view-only .board-column-add,
.project-view-only .board-add-column {
    display: none;
}

.project-view-only .board-column-actions {
    display: none;
}

/* View-only task modal */
.task-view-only .modal-action-btn,
.task-view-only .modal-delete-btn,
.task-view-only #formatToolbar {
    display: none;
}

.task-view-only .modal-checkbox {
    pointer-events: none;
    opacity: 0.25;
}

/* ============================================================================
   END PROJECT SHARING
   ============================================================================ */
